function MM_preloadImages() 
{ //v3.0
  var d=document; 
  if(d.images){
  	if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
    for(i=0; i<a.length; i++)
    	if (a[i].indexOf("#")!=0){ 
    		d.MM_p[j]=new Image;
    		d.MM_p[j++].src=a[i];
    	}
   }
}

function changeover(e){
	//e.style.backgroundImage = "url(/g1on1/images/backbar_over.jpg)";
	//e.style.color = "#333333";
	e.style.cursor = "pointer";
	e.style.textDecoration="underline";
}
function changeout(e){
	//e.style.backgroundImage = "url(/g1on1/images/backbar.jpg)";
	//e.style.color = "#FFFFFF";
	e.style.textDecoration="none";
}
function linkto(destination){
	window.location = destination;
}


var path = location.pathname;
var first_slash= path.indexOf("/",1);//the first slash after /g1on1
var second_slash = path.indexOf("/", first_slash+1);
if (second_slash==-1)
	second_slash=path.indexOf(".",first_slash+1);
var dir = path.substring(first_slash+1,second_slash);

function setTag(){
	if (document.getElementById){
		var tag = document.getElementById(dir);
		tag.style.backgroundImage= "url(/g1on1/images/backbar_over.jpg)";
		tag.style.color="#333333";
	}
}
var error_msg = "";
function ValidateForm(form)
{
   if(IsEmpty(form.txtFirstName)) 
   { 
      alert('Please enter your first name.'); 
      error_msg = "Please enter your first name.<br>";
      form.txtFirstName.focus(); 
      return false; 
   }
    if(IsEmpty(form.txtLastName)) 
   { 
      alert('Please enter your last name.'); 
      form.txtLastName.focus(); 
      return false; 
   }
   if(IsEmpty(form.txtOrg)) 
   { 
      alert('Please enter the organization you are affiliated with.'); 
      form.txtOrg.focus(); 
      return false; 
   } 
   if(IsEmpty(form.txtPosition)) 
   { 
      alert('Please enter your position in the organization you are affiliated with.'); 
      form.txtPosition.focus(); 
      return false; 
   } 
   if(IsEmpty(form.txtCountry)) 
   { 
      alert('Please choose a country.'); 
      form.txtCountry.focus(); 
      return false; 
   } 
   if(IsEmpty(form.txtEmail)) 
   { 
      alert('Please enter your email address.'); 
      form.txtEmail.focus(); 
      return false; 
   }
   if(!isValidEmail(form.txtEmail.value))
   {
   		alert("The provided email address is not a valid address!");
   		form.txtEmail.focus(); 
      	return false; 
   }
   if(IsEmpty(form.txtPasswd)) 
   { 
      alert('Please enter a password.');
      form.txtPasswd.focus(); 
      return false; 
   } 
   if(IsEmpty(form.txtRepeatPasswd)) 
   { 
      alert('Please repeat the password you entered.'); 
      form.txtRepeatPasswd.focus(); 
      return false; 
   }
   if(form.txtPasswd.value != form.txtRepeatPasswd.value) 
   {
 	  alert("The repeated password doesn't match the password you entered. Please repeat your password again"); 
      form.txtRepeatPasswd.focus(); 
      return false; 
   }   	  

  
  return true;
}
function IsEmpty(aTextField) {
   if ((aTextField.value.length==0) || (aTextField.value==null)) 
   {
      return true;
   }
   else { return false; }
}	

function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}