// JavaScript Document

//<![CDATA[
var quote=new Array();
  quote[0]='Reach Your 2009 Financial & Investment Goals!';    /* add as many quotes as you like!*/
  quote[1]='We provide specific guidelines for success in turbulent times.';
  quote[2]='Works in ANY timeframe on ANY market';
  quote[3]='93% Student Satisfaction *';
  quote[4]='Live Wealth Techniques demonstrated';
  quote[5]='Instructors have 125+ yrs. Experience combined';
  quote[6]='Coherent, comprehensive strategies that you can implement at home';
  quote[7]='No Market Research necessary - Begin Today!';
  quote[8]='"Vision without action is a daydream ... action without vision is a nightmare."  Japanese proverb';


var speed=2000;    /*this is the time in milliseconds adjust to suit*/
var q=0;

function showQuote() {

     document.getElementById("quotes").innerHTML=quote[q];
     q++;
if(q==quote.length) {
     q=0;
  }
}
setInterval('showQuote()',speed);
   
 //]]>

function validateMyForm(form) { 
	if (form.firstname.value=='') {
		alert('Please enter your First Name.'); 
		form.firstname.focus(); 
		form.firstname.select(); 
		return false; 
	}
	if (form.lastname.value=='') {
		alert('Please enter your Last Name.'); 
		form.firstname.focus(); 
		form.firstname.select(); 
		return false; 
	}
	if (form.phone.value=='') { 
		alert('Please enter a phone number.'); 
		form.phone.focus(); 
		form.phone.select(); 
		return false; 
	}
	if (parseInt(form.phone.value) != form.phone.value) { 
		alert('Please enter a phone number, numbers only'); 
		form.phone.focus(); 
		form.phone.select(); 
		return false; 
	}
	if (echeck(form.email.value)==false){
		form.email.focus(); 
		form.email.select(); 
		return false
	}
	if (form.email.value!=form.emailretype.value) {
		alert('Email addresses do not match.');
		form.emailretype.focus();
		form.emailretype.select();
		return false;
	}
}

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 ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.frmSample.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
