//--- This function is used in /home/aboutus_experienced.asp
	function openCertificate(adminID) {
		certificateWin = window.open("pop_certificate.asp?adminID=" + adminID,"feedback","width=710,height=780,top=50,left=300,titlebar=no,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no");
	}	

//--- This functions are used in /home/affiliate_applicationform.asp
function Form1_Validator(theForm)
	{
	  if ((theForm.LoginName.value == "") || (theForm.LoginName.value.length < 3) || (theForm.LoginName.value.length > 10))
	  {
	    alert("Please enter a 3-10 character value for the \"User Name\" field.");
	    theForm.LoginName.focus();
	    return (false);
	  }
	  if (theForm.LoginPassword.value != theForm.LoginPasswordConfirm.value)
	  {
	    alert("Re-entered password is not same as Password");
	    theForm.LoginPasswordConfirm.focus();
	    return (false);
	  }
	  if ((theForm.LoginPassword.value == "") || (theForm.LoginPassword.value.length < 3) || (theForm.LoginPassword.value.length > 10))
	  {
	    alert("Please enter a 3-10 character value for the \"Password\" field.");
	    theForm.LoginPassword.focus();
	    return (false);
	  }
	  //if ((theForm.Phrase.value == "") || (theForm.Phrase.value.length < 5) || (theForm.Phrase.value.length > 50))
	  //{
	  //  alert("Please enter a 5-50 character value for the \"Personal Phrase\" field.");
	  //  theForm.Phrase.focus();
	  //  return (false);
	  //}
	  if (theForm.Contact.value == "")
	  {
	    alert("Please enter a value for the \"Name\" field.");
	    theForm.Contact.focus();
	    return (false);
	  }
	  //if (theForm.CompanyName.value == "")
	  //{
	  //  alert("Please enter a value for the \"Company Name\" field.");
	  //  theForm.CompanyName.focus();
	  //  return (false);
	  //}
	  //if (theForm.PositionInCompany.value == "")
	  //{
	  //  alert("Please enter a value for the \"Position in Company\" field.");
	  //  theForm.PositionInCompany.focus();
	  //  return (false);
	  //}
	
	  // check email address validity
	  var emailStr = theForm.Email.value;
	  var emailPat = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,6}|[0-9]{1,3})(\]?)$/;
	  var matchArray = emailStr.match(emailPat);
	  if (matchArray == null) {
	    alert("Your email address seems incorrect. Please enter a valid email address.");
		theForm.Email.focus();
	    return (false);
	  }
	  // make sure the IP address domain is valid
	  var IPArray = matchArray[2].match(/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/);
	  if (IPArray != null) {
	    for (var i=1;i<=4;i++) {
	      if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!");
			theForm.Email.focus();
	        return (false);
	      }
	    }
	  }
	
	  if (theForm.CompanyAddress.value == "")
	  {
	    alert("Please enter a value for the \"Address\" field.");
	    theForm.CompanyAddress.focus();
	    return (false);
	  }
	  if (theForm.City.value == "")
	  {
	    alert("Please enter a value for the \"City\" field.");
	    theForm.City.focus();
	    return (false);
	  }
	  if (theForm.Zip.value == "")
	  {
	    alert("Please enter a value for the \"Zip/Postal Code\" field.");
	    theForm.Zip.focus();
	    return (false);
	  }
	  if ((theForm.Country.value == "") || (theForm.Country.value == "Select"))
	  {
	    alert("Please enter a value for the \"Country\" field.");
	    theForm.Country.focus();
	    return (false);
	  }
	  if (theForm.WebSiteURL.value.length < 5)
	  {
	    alert("Please enter at least 5 characters in the \"Web Site URL\" field.");
	    theForm.WebSiteURL.focus();
	    return (false);
	  }
	  if (theForm.WebSiteTitle.value.length < 2)
	  {
	    alert("Please enter at least 2 characters in the \"Web Site Title\" field.");
	    theForm.WebSiteTitle.focus();
	    return (false);
	  }

	  if (theForm.agree.checked != true)
	  {
	    alert("You must read and agree to our terms and conditions before you can proceed.");
	    theForm.agree.focus();
	    return (false);
	  }
	  if (theForm.agree1.checked != true)
	  {
	    alert("You must verify that you are over 18 years old before you can proceed.");
	    theForm.agree1.focus();
	    return (false);
	  }

	  function noABN(){
	    if (confirm("You have not provided an ABN\nAs an Australian affiliate we need your ABN.\nWithout this, we can't pay you GST.\nFurthermore, we will deduct the maximum tax amount from any income we provide you.\nClick OK to proceed or Cancel to provide an ABN.")) {
	      alert('You have chosen to not supply your ABN');
	    }else{
	      theForm.TaxorSocialSecurity.focus();
	      return (false);
	    }
	  }
	
	  if ((theForm.Country.value == "Australia") && (theForm.TaxorSocialSecurity.value.length < 7))
	  {
		return noABN();
	  }
	  
	  return (true);
	}
//--------------------------------------------------------------------------------------------------------------

// This part is used in how_work_content.asp ; /home/include/faq_content.asp
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// This part is used in /home/australian_embassies.asp
	function formHandler(form) {
		var URL = document.form.site.options[document.form.site.selectedIndex].value;
		window.location.href = URL;
	}
	
//This function will be used in /home/contact.asp
function isValidEmailAddr(string) {
		 if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
			  return true;
		 else
			  return false;
	}
	

// This function is used in /home/refer_a_friend.asp
function recommendSubmit(theForm){
			// reset the form
			if (theForm.checkSubmit.value=='no'){
				theForm.reset();
				return false;
			}
			// check the sender's info
			if (trimSpaces(theForm.firstname.value)==""){
				alert("Please enter your first name.");
				theForm.firstname.focus();
				theForm.firstname.select();
				return false;
			}
			if (trimSpaces(theForm.lastname.value)==""){
				alert("Please enter your last name.");
				theForm.lastname.focus();
				theForm.lastname.select();
				return false;
			}
			if (trimSpaces(theForm.email.value)==""){
				alert("Please enter your email address.");
				theForm.email.focus();
				theForm.email.select();
				return false;
			}
			else if (!isValidEmailAddr(theForm.email.value)){
				alert("Your email address does not seem to be correct.");
				theForm.email.focus();
				theForm.email.select();
				return false;
			}
			if (trimSpaces(theForm.Comments.value)==""){
				alert("Please enter your suggestions to your friends.");
				theForm.Comments.focus();
				theForm.Comments.select();
				return false;
			}
			// check the friend's info
			testValue=true;
			for(i=1;i<=10;i++){
				testValue=testValue && checkFriendInfo(i);
			}
			return testValue;
		}
		
		function checkFriendInfo(friend_id){
			firstname_k=document.recommend.elements["firstname"+friend_id];
			email_k=document.recommend.elements["email"+friend_id];
			var theName=trimSpaces(firstname_k.value);
			if (friend_id==1){
				if (theName==""){
					alert("Please enter the  first name of your friend number "+friend_id+".");
					firstname_k.focus();
					firstname_k.select();
					return false;
				}
			}
			if (theName!=""){
				if (trimSpaces(email_k.value)==""){
					alert("Please enter the email address of your friend number "+friend_id+".");
					email_k.focus();
					email_k.select();
					return false;
				}
				else if (!isValidEmailAddr(email_k.value)){
					alert("The email address of your friend number "+friend_id+" does not seem to be correct.");
					email_k.focus();
					email_k.select();
					return false;
				}
			}
			return true;
		}

//This function is used in /home/visa_services_preparation.asp
 function windowOpen(aWindow,width,height,aPage,scroll) {
   		myWindow = window.open("",aWindow,"scrollbars=" + scroll + ",width=" + width + ",height=" + height+",top=0,left=0,screenX=0,screenY=0");
   		myWindow.location.href = aPage;
   		if (!myWindow.opener) myWindow.opener = self;
			myWindow.focus();
	}		

