// JavaScript Document

var divName = "InfoDiv";
var offX1 = 15; 
var offY1 = 15;	

function ShowDiv4(Action) {	
	document.getElementById('InfoDiv').style.display = Action;	
	var BuildObject = "<p>We use credit card info only to verify your account. You will never be charged without prior notice, and all data is encrypted for maximum security (see Security Policy)</p>";				
	
	document.getElementById('InfoDiv').innerHTML = BuildObject;			
	document.onmousemove = follow2; 
}	

function ShowDiv3(Action) {	
	document.getElementById('InfoDiv').style.display = Action;	
	
	var BuildObject = "<p>Join now to enjoy all the privileges of a paid member for 30 days FREE! Cancel any time during the 30 days with no obligation. Enter your email address in the box on the right to get started.</p>";				
	
	document.getElementById('InfoDiv').innerHTML = BuildObject;			
	document.onmousemove = follow2; 
}	
 
	function ShowDiv1(Action) {	
	document.getElementById('InfoDiv').style.display = Action;	
	var BuildObject = "<p>We'll email you a link to a free downloadable .pdf report that tells you how to get started right away. </p> <ul><li>What to expect as a BoxingForecast member</li><li>How and where to open your wagering accounts</li><li>How to make BoxingForecast work best for you</li><li>Legal issues you should know about</li></ul>";				
	
	document.getElementById('InfoDiv').innerHTML = BuildObject;			
	document.onmousemove = follow2;
}	

function mouseX(evt) {if (!evt) evt = window.event; if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return 0;}
		
function mouseY(evt) {if (!evt) evt = window.event; if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return 0;}
		
function follow2(evt) {if (document.getElementById) {var obj = document.getElementById(divName).style; obj.visibility = 'visible';
	obj.left = (parseInt(mouseX(evt))+offX1) + 'px';
	obj.top = (parseInt(mouseY(evt))+offY1) + 'px';}}
	
function OpenTrackRecord() {
		ApplicationWindow = window.open("DisplayPages/OtherPages/TrackRecord.cfm","mywindow","toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no,height=400,width=770");
		return false;
	}
	
	function emailcheckPassword() {
		var emailstring = document.Newsletterform.Email.value;
		var AtSign = "@"
		var Dot = "."
		var AtSignPOS = emailstring.indexOf(AtSign)
		var emailLength = emailstring.length
		var DotPOS = emailstring.indexOf(Dot)
		
		
		if (emailstring.indexOf(AtSign)==-1){
		   alert("Please enter a valid email address.")
		   return false
		}
		if (emailstring.indexOf(AtSign)==-1 || emailstring.indexOf(AtSign)==0 || emailstring.indexOf(AtSign)+1==emailLength){
		   alert("Please enter a valid email address.")
		   return false
		}
		if (emailstring.indexOf(Dot)==-1 || emailstring.indexOf(Dot)==0 || emailstring.indexOf(Dot)+1==emailLength){
			alert("Please enter a valid email address.")
			return false
		}
		 if (emailstring.indexOf(AtSign,(AtSignPOS+1))!=-1){
			alert("Please enter a valid email address.")
			return false
		 }
		 if (emailstring.substring(AtSignPOS-1,AtSignPOS)==Dot || emailstring.substring(AtSignPOS+1,AtSignPOS+2)==Dot){
			alert("Please enter a valid email address.")
			return false
		 }
		 if (emailstring.indexOf(Dot,(AtSignPOS+2))==-1){
			alert("Please enter a valid email address.")
			return false
		 }
		 if (emailstring.indexOf(" ")!=-1){
			alert("Please enter a valid email address.")
			return false
		 }
	
		 return true					
	}

	//Function to make sure the credit card Exp date is valid;
	function CheckBillingInfo() {
	
	//Check the passwords
	if(document.SubscriberForm.Password.value.length < 5 || document.SubscriberForm.Password.value.length > 10) {
		alert("The subscription password must be between 5 and 10 characters.")	;
		return false;
	}
	
	if(document.SubscriberForm.Password.value != document.SubscriberForm.Confirmpassword.value) {
		alert("The confirmation password must equal the desired password.");
		return false;
	}
	
	//Check the Email Address
	if(document.SubscriberForm.EmailAddress.value != document.SubscriberForm.ConfirmEmailAddress.value) {
		alert("The confirmation email address must equal the email address.");
		return false;
	}
			
	
	}	
