﻿// JScript File

 

 

// Version: July 28, 2007
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
if(self.pageYOffset) {
	rX = self.pageXOffset;
	rY = self.pageYOffset;
	}
else if(document.documentElement && document.documentElement.scrollTop) {
	rX = document.documentElement.scrollLeft;
	rY = document.documentElement.scrollTop;
	}
else if(document.body) {
	rX = document.body.scrollLeft;
	rY = document.body.scrollTop;
	}
if(document.all) {
	cX += rX; 
	cY += rY;
	}
d.style.left = (cX+10) + "px";
d.style.top = (cY+10) + "px";
}
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
dd.style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}
 


function verifyzipcode1(){

if (document.getElementById("Freefinancialevaluation1_txtzipcode1").value=='' || document.getElementById("Freefinancialevaluation1_txtzipcode1").value=='Zip code'){
alert("please enter zip code");
document.getElementById("Freefinancialevaluation1_txtzipcode1").focus();
return false;

}
return true;
}


function validateinformation(){

if (document.getElementById("Freefinancialevaluation1_txtfirstname").value=='' || document.getElementById("Freefinancialevaluation1_txtfirstname").value=='First Name'){
alert("please enter your first name");
document.getElementById("Freefinancialevaluation1_txtfirstname").focus();
return false;
}

if (document.getElementById("Freefinancialevaluation1_txtlastname").value=='' || document.getElementById("Freefinancialevaluation1_txtlastname").value=='Last Name'){
alert("please enter your last name");
document.getElementById("Freefinancialevaluation1_txtlastname").focus();
return false;
}

if (document.getElementById("Freefinancialevaluation1_txthomephone").value=='' || document.getElementById("Freefinancialevaluation1_txthomephone").value=='Home Phone'){
alert("please enter your home phone");
document.getElementById("Freefinancialevaluation1_txthomephone").focus();
return false;
}

if (document.getElementById("Freefinancialevaluation1_txtemail").value=='' || document.getElementById("Freefinancialevaluation1_txtemail").value=='Email Address'){
alert("please enter your email address");
document.getElementById("Freefinancialevaluation1_txtemail").focus();
return false;
}
if (echeck(document.getElementById("Freefinancialevaluation1_txtemail").value)==false){
		document.getElementById("Freefinancialevaluation1_txtemail").value=""
		document.getElementById("Freefinancialevaluation1_txtemail").focus()
		return false
	}
	

 

return true;
}
 
function echeck(str) {

		var at="@"
		var dot="."
		var msg="please enter your email address in correct format"
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert(msg)
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert(msg)
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert(msg)
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert(msg)
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert(msg)
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert(msg)
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert(msg)
		    return false
		 }

 		 return true					
	}





