

/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 * with minor mods to handle destination changes.
 */

/*
function fInsiderAccess( dest )
{
	var emailID = emailInsiderAccess ;
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email address to gain VIP Insider Access" ) ;
		emailID.focus() ;
		return false ;
	}
	if (echeck(emailID.value)==false){
		emailID.value="" ;
		emailID.focus() ;
		return false ;
	}
	document.location = "http://www.1Pswd.com/register.user.email.php"
		+ "?siteID=01f8a83bd633ea5722e35ed366718766&usage=index.1&email=" + emailID.value
		+ "&dest=http://www.SanDiegosFinestRealEstate.com/VIPAccess/" + dest + ".html" ;
}
*/

function fInsiderAccess( widget, dest )
{
	var emailID = widget ;
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email address to gain VIP Insider Access" ) ;
		emailID.focus() ;
		return false ;
	}
	if (echeck(emailID.value)==false){
		emailID.value="" ;
		emailID.focus() ;
		return false ;
	}
	document.location = "http://www.1Pswd.com/register.user.email.php"
		+ "?siteID=01f8a83bd633ea5722e35ed366718766&usage=" + dest + "&email=" + emailID.value
		+ "&dest=http://www.SanDiegosFinestRealEstate.com/VIPAccess/" + dest + ".html" ;
}






function echeck(str)
{

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   alert("Invalid E-mail Address") ;
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail Address") ;
	   return false ;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    alert("Invalid E-mail Address") ;
	    return false ;
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    alert("Invalid E-mail Address") ;
	    return false ;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    alert("Invalid E-mail Address") ;
	    return false ;
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    alert("Invalid E-mail Address") ;
	    return false ;
	 }
		
	 if (str.indexOf(" ")!=-1){
	    alert("Invalid E-mail Address") ;
	    return false ;
	 }

	 return true ;
}


// Rather than a consistent blink periodic, this blink keeps the text visible N-times as long as it is hidden.
var blinkItCnt = 0 ;
function blinkIt()
{
  if (!document.all) return;
  else {
    for(i=0;i<document.all.tags('blink').length;i++)
    {
	s=document.all.tags('blink')[i];
	if  ( ( 'visible' == s.style.visibility )  &&  ( 0 == blinkItCnt ) )
	  s.style.visibility = 'hidden' ;
	else s.style.visibility = 'visible' ;
//	s.style.visibility=(s.style.visibility=='visible')?'hidden':'visible';
    }
    blinkItCnt = (1 + blinkItCnt) % 8 ;
  }
}
