// JavaScript Document

<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

document.clicked=true;

function ClickedMe()
{
document.clicked=!(document.clicked);
CopyIt();
if (document.form1.ship.checked==true){

document.form1.txtFname_ship.disabled=true;
document.form1.txtLname_ship.disabled=true;
document.form1.txtPOBox_Ship.disabled=true;
document.form1.txtStreet_Ship.disabled=true;
document.form1.txtBuilding_ship.disabled=true;
document.form1.txtCity_Ship.disabled=true;
document.form1.txtZip_Ship.disabled=true;
document.form1.txtState_Ship.disabled=true;
document.form1.lstCountry_Ship.disabled=true;
document.form1.txtHomeTel_Ship.disabled=true;
document.form1.txtOfficeTel_Ship.disabled=true;
document.form1.txtFax_Ship.disabled=true;
document.form1.txtMobile_Ship.disabled=true;
document.form1.txtEmail_Ship.disabled=true;
}
if (document.form1.ship.checked==false){
document.form1.txtFname_ship.disabled=false;
document.form1.txtLname_ship.disabled=false;
document.form1.txtPOBox_Ship.disabled=false;
document.form1.txtStreet_Ship.disabled=false;
document.form1.txtBuilding_ship.disabled=false;
document.form1.txtCity_Ship.disabled=false;
document.form1.txtZip_Ship.disabled=false;
document.form1.txtState_Ship.disabled=false;
document.form1.lstCountry_Ship.disabled=false;
document.form1.txtHomeTel_Ship.disabled=false;
document.form1.txtOfficeTel_Ship.disabled=false;
document.form1.txtFax_Ship.disabled=false;
document.form1.txtMobile_Ship.disabled=false;
document.form1.txtEmail_Ship.disabled=false;
}
}

function CopyIt()
{
if (document.clicked)
{
document.form1.txtFname_ship.value=document.form1.txtFname.value;
document.form1.txtLname_ship.value=document.form1.txtLname.value;
document.form1.txtPOBox_Ship.value=document.form1.txtPOBox.value;
document.form1.txtStreet_Ship.value=document.form1.txtStreet.value;
document.form1.txtBuilding_ship.value=document.form1.txtBuilding.value;
document.form1.txtCity_Ship.value=document.form1.txtCity.value;
document.form1.txtZip_Ship.value=document.form1.txtZip.value;
document.form1.txtState_Ship.value=document.form1.txtState.value;
document.form1.lstCountry_Ship.selectedIndex=document.form1.lstCountry.selectedIndex;
document.form1.txtHomeTel_Ship.value=document.form1.txtHomeTel.value;
document.form1.txtOfficeTel_Ship.value=document.form1.txtOfficeTel.value;
document.form1.txtFax_Ship.value=document.form1.txtFax.value;
document.form1.txtMobile_Ship.value=document.form1.txtMobile.value;
document.form1.txtEmail_Ship.value=document.form1.txtemail.value;
}

}


function validateFrom(){
var msg="";
var msg1="";
var msg2=""
var msg3=""

if (document.form1.txtFname.value.length == 0)
	msg=msg+"  First Name \n"	
if (document.form1.txtLname.value.length==0)
    msg=msg+"  Last Name \n"	
if(document.form1.txtPOBox.value.length==0)
	msg=msg+"  P.O.Box \n"	
if (document.form1.txtStreet.value.length==0)
	msg=msg+"  Street Name \n"	
if (document.form1.txtBuilding.value.length==0)
	msg=msg+"  Building \n"	
if (document.form1.txtCity.value.length==0)
	msg=msg+"  City\n"
if (document.form1.txtZip.value.length==0)
	msg=msg+"  Zip\n"	
if (document.form1.lstCountry.selectedIndex==0) 
	msg=msg+"  Country \n"	
if (document.form1.txtHomeTel.value.length==0)
	msg=msg+"  Home Tel \n"	
if (document.form1.txtMobile.value.length==0)
	msg=msg+"  Mobile \n"
	
if (document.form1.txtemail.value.length==0) {
	msg=msg+"  Email \n"	}
else{
		  var strvalmail=IsValidEmail(document.form1.txtemail);
	      if (strvalmail.length>0){
	     msg1=msg1 + strvalmail
}}



if (document.form1.ship.checked==false){
  
if (document.form1.txtFname_ship.value.length == 0)
	msg2=msg2+"  First Name \n"	
if (document.form1.txtLname_ship.value.length==0)
    msg2=msg2+"  Last Name \n"	
if(document.form1.txtPOBox_Ship.value.length==0)
	msg2=msg2+"  P.O.Box \n"	
if (document.form1.txtStreet_Ship.value.length==0)
	msg2=msg2+"  Street Name \n"	
if (document.form1.txtBuilding_ship.value.length==0)
	msg2=msg2+"  Building \n"	
if (document.form1.txtCity_Ship.value.length==0)
	msg2=msg2+"  City\n"
if (document.form1.txtZip_Ship.value.length==0)
	msg2=msg2+"  Zip\n"	

if (document.form1.lstCountry_Ship.selectedIndex==0) 
	msg2=msg2+"  Country \n"	
if (document.form1.txtHomeTel_Ship.value.length==0)
	msg2=msg2+"  Home Tel \n"	
if (document.form1.txtMobile_Ship.value.length==0)
	msg2=msg2+"  Mobile \n"
	
if (document.form1.txtEmail_Ship.value.length==0) {
	msg2=msg2+"  Email \n"	}
else{
		  var strvalmail=IsValidEmail(document.form1.txtEmail_Ship);
	      if (strvalmail.length>0)
	     msg3=msg3 + strvalmail
}

 if (msg2!="") 
    msg=msg+" Shipping Address:\n" +msg2   
 if (msg3!="")
   msg1=msg1+ " Shipping Address:\n " + msg3
}


if (msg!="") {
		  msg="The following fields are required:\n" + msg ;
		  }
if (msg1!=""){
		 msg1="Please check the following:\n"+msg1;
		 if (msg!="") {
			 msg1="\n" + msg1
			  }
		 }
		  
if ((msg!="") || (msg1!=""))  {
	 mymsg=msg + msg1;
	 alert (mymsg);
	 return false;
	     }
else{
   return true;
	}
}

function IsValidEmail(txt){
    var stremail="";
	if(txt.value !=""){ 
		var goodEmail = txt.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (goodEmail){
		    return true;
		} else {
			stremail="  The Email address is not valid\n";
			return stremail;
		}
	}
}

function empty(e, v){
		      if (e.value == v){
	       		e.value = "";	
	       	} 
	       else {
	        	e.select();
	        }
	       e.onblur = function()
	        {
	        	if (e.value == ""){
	        			e.value = v;
	        	}
	        }
	        }
	
function SubmitLogin(btn) {
 // process only the Enter key 
 if (event.keyCode == 13) {
  // cancel the default submit 
  event.returnValue=false; 
  event.cancel = true; 
  // submit the form by programmatically clicking the specified button 
  document.getElementById(btn).click();
   } 
  }      
  
  function Validateregister(type){
  
  var msg="";
var msg1="";
var i;
if (document.Form1.txtusername.value.length == 0)
	msg=msg+"  User Name \n"
if (type==1)
	{
		if (document.Form1.txtpassword.value.length == 0)
			msg=msg+"  Password \n"
	}		
		
if (document.Form1.txtTitle.value.length == 0)
	msg=msg+"  Title \n"
if (document.Form1.txtfname.value.length == 0)
	msg=msg+"  First Name \n"
/*if (document.Form1.txtFatherName.value.length == 0)
	msg=msg+"  Father Name \n"	*/
if (document.Form1.txtlname.value.length == 0)
	msg=msg+"  Last Name \n"	
/*if (document.Form1.txtMaidenName.value.length == 0)
	msg=msg+"  Maiden Name \n"*/
/*if ((document.Form1.lstDay.selectedIndex==0) || (document.Form1.lstYear.selectedIndex==0)||(document.Form1.lstMonth.selectedIndex==0))
	msg=msg+"  Birth Date \n"*/
if ((document.Form1.lstDay.selectedIndex==0) || (document.Form1.lstYear.selectedIndex==0)||(document.Form1.lstMonth.selectedIndex==0))
{
	if((document.Form1.lstDay.selectedIndex==0) && (document.Form1.lstYear.selectedIndex==0) && (document.Form1.lstMonth.selectedIndex==0))
	{
	}
	else
	{
		msg=msg+"  Full Birth Date \n"	
	}
}


var Gradchecked=false;
//rdGraduated

for (i=0;i<document.Form1.rdGraduated.length;i++)
{ if (document.Form1.rdGraduated[i].checked){
    Gradchecked=true
 }
}

if (Gradchecked==false)
msg=msg+"  Graduated?\n"
/*
//rdCivilStatus
var civilchecked=false;
for (i=0;i<document.Form1.rdCivilStatus.length;i++)
{
 if (document.Form1.rdCivilStatus[i].checked==true){
    civilchecked=true
 }
}
if (civilchecked==false)
msg=msg+"  Civil Status?\n"
	*/
if (document.Form1.lstYearLeft.selectedIndex==0)
	msg=msg+"  Year Left \n"	
/*if (document.Form1.lstSupYearGrad.selectedIndex==0)
	msg=msg+"  Supposed year of graduation \n"	*/
	
if (document.Form1.txtemail.value.length==0) {
	msg=msg+"  Email \n"	}
else{
		  var strvalmail=IsValidEmail(document.Form1.txtemail);
	      if (strvalmail.length>0)
	     msg1=msg1 + strvalmail
}
	if ((msg!="") || (msg1!=""))  {
	 mymsg=msg + msg1;
	 alert ("The following fields are required:\n" + mymsg);
	 return false;
	     }
else{
   return true;
	}
	
	  }

function toggleBlock(d, i)
{
	var e = document.getElementById(d);
	var img = document.getElementById(i);
	if (!e)return;
	if (e.style.display == "block"){
		e.style.display = "none";
		img.src = "images/expand.gif";
	} else {
		e.style.display = "block";
		img.src = "images/collapse.gif";
	}
}

function CheckLogin(username, password){

/*alert((document.getElementById(username).value=='Your e-mail') || (document.getElementById(username).value=='') || (document.getElementById(password).value==''))
return false;*/
if ((document.getElementById(username).value=='Your e-mail') || (document.getElementById(username).value=='') || (document.getElementById(password).value=='')){
alert("Please enter your e-mail and your password");
return false;
}
else{
return true;}

}

function validatePasswords(OldPassword, Password, ConfirmPassword){
   if ((document.getElementById(OldPassword).value=="")||(document.getElementById(Password).value=="")||(document.getElementById(ConfirmPassword).value==""))
      {
      alert("Plase enter your old password, your new password \nand confirm your new password")
      return false;
      }
  else
     {
     if (document.getElementById(Password).value==document.getElementById(ConfirmPassword).value){
       return true;}
     else
       {
       alert("Password do not match");
       return false;
       }
     }
 }


function ValidateSearch(){
if ((document.Form1.txtFname.value.length == 0) && (document.Form1.txtLname.value.length == 0) && (document.Form1.lstSupYearGrad.selectedIndex==0) && (document.Form1.lstCountry.selectedIndex==0))	
{
alert("Please Fill at least one search criteria");
return false;
}
else{
return true;
}

}

function openIT(u,W,H, sc) {
		var x = (screen.width - W) / 2;
		var y = (screen.height - H) / 2;
		//window.moveBy(left, top);
		window.open(u, '',"width="+W+",height="+H+",scrollbars="+(sc ? "yes" : "no")+", left="+250+",top="+200);
}

function popImage(img, caption)
{
	caption = escape(caption);
	openIT('frmImage.aspx?img='+img+"&caption="+caption,400,250);
}

function ValidateAdminRegister(type)
{
  
	var msg="";
	var msg1="";
	var i;
	if (document.form1.txtusername.value.length == 0)
		msg=msg+"  User Name \n"
	if (type==1)
		{
			if (document.form1.txtpassword.value.length == 0)
				msg=msg+"  Password \n"
		}		
	if (document.form1.txtFname.value.length == 0)
		msg=msg+"  First Name \n"
	if (document.form1.txtLname.value.length == 0)
		msg=msg+"  Last Name \n"	
	if ((document.form1.lstDay.selectedIndex==0) || (document.form1.lstYear.selectedIndex==0)||(document.form1.lstMonth.selectedIndex==0))
	{
		if((document.form1.lstDay.selectedIndex==0) && (document.form1.lstYear.selectedIndex==0) && (document.form1.lstMonth.selectedIndex==0))
			{
			}
		else
			{
			msg=msg+"  Full Birth Date \n"	
			}
	}

	if (document.form1.txtemail.value.length!=0) 
	{
		  var strvalmail=IsValidEmail(document.form1.txtemail);
	      if (strvalmail.length>0)
	     msg1=msg1 + strvalmail
}
	if ((msg!="") || (msg1!=""))  {
	 mymsg=msg + msg1;
	 alert ("The following fields are required:\n" + mymsg);
	 return false;
	     }
else{
   return true;
	}
	
	  }

-->





