var ni = document.getElementById('myelement');
	
	function info(option){
		var ni = document.getElementById('myelement');
		if (option == 'Y'){
			ni.innerHTML = " ";
			value = "<input type=\"checkbox\" name=\"terms\" onclick=\"info('N');\" checked/>";
			value += "I agree to the Terms & Conditions<br/><br/>";
			value += "<input type=\"submit\" name=\"submit\" value=\"Apply Now\" style=\"padding:3px;\" onclick=\"return checkForm();\"/>";
			value += "&nbsp;";
			value += "<input type=\"button\" name=\"Save\" value=\"Save & Finish Later\" style=\"padding:3px;\" onclick=\"return saveform();\">";
			ni.innerHTML = value;
		} else {
			ni.innerHTML = " ";
			value = "<input type=\"checkbox\" name=\"terms\" onclick=\"info('Y');\"/>";
			value += "I agree to the Terms & Conditions<br/><br/>";
			value += "<input type=\"submit\" name=\"submit\" value=\"Apply Now\" style=\"padding:3px;\" disabled />";
			value += "&nbsp;";
			value += "<input type=\"button\" name=\"Save\" value=\"Save & Finish Later\" style=\"padding:3px;\" onclick=\"return saveform();\">";
			ni.innerHTML = value;
		}
	}
	
function checkForm() {
	
	// Default variables
	var errorMsg = "";
	var errorMsgLong = "";
	
	// Check for a title
	if (document.frmpage.name.value == "") {
		errorMsg += "\nName - Please enter a name";
	}
	
	myOption = -1;
	for (i=document.frmpage.gender.length-1; i > -1; i--) {
		if (document.frmpage.gender[i].checked) {
			myOption = i; 
			i = -1;
	}
	
	}
	
	if (myOption == -1) {
		errorMsg += "\nGender- Please select your gender";
	}
	
	var validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	var strEmail = document.frmpage.email.value;
	
	if (strEmail == "") {
		errorMsg += "\nEmail - Please enter your email address";
	} else if (strEmail.search(validRegExp) == -1) {
		errorMsg += "\nInvalid e-mail address entered. Please amend and retry";
	}

	
	// If there is a problem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")) {
		msg = "The form was not submitted as there are errors in your input\n";
		msg += "Please correct the following error(s) and re-submit the form.\n\n";
		
		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		
		// Return false
		return false;
	} else {
		//document.frmpage.action="mailapplication.php";
		//document.frmpage.action="mailer/mail.php";
	}
	
	// Return true
	return true;
}

function saveform(){
	// Default variables
	var errorMsg = "";
	var errorMsgLong = "";
	
	var validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	var strEmail = document.frmpage.email.value;
	
	if (document.frmpage.name.value == "") {
		errorMsg += "\nName - Please enter a name";
	}
	
	if (strEmail == "") {
		errorMsg += "\nEmail - Please enter your email address";
	} else if (strEmail.search(validRegExp) == -1) {
		errorMsg += "\nInvalid e-mail address entered. Please amend and retry";
	}
    // If there is a problem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")) {
		msg = "The form was not submitted as there are errors in your input\n";
		msg += "Please correct the following error(s) and re-submit the form.\n\n";
		
		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		
		// Return false
		return false;
	} else {;
		document.frmpage.action="mailer/saveit.php";
	}
	
	// Return true
	return true;
}
var RateCode = new Object();
	// Set the Countries option to ""
		RateCode["Countries"] = "";
		RateCode["AFGHANISTAN"] = "93";
		RateCode["ALBANIA"] = "355";
		RateCode["ALGERIA"] = "213";
		RateCode["AMERICAN SAMOA"] = "684";
		RateCode["ANDORRA"] = "376";
		RateCode["ANGOLA"] = "244";
		RateCode["ANGUILLA"] = "264";
		RateCode["ANTIGUA"] = "268";
		RateCode["ARGENTINA"] = "54";
		RateCode["ARMENIA"] = "374";
		RateCode["ARUBA"] = "297";
		RateCode["ASCENSION ISLAND"] = "247";
		RateCode["AUSTRALIA"] = "61";
		RateCode["AUSTRALIAN TERR"] = "672";
		RateCode["AUSTRIA"] = "430";
		RateCode["AZERBAIJAN"] = "994";
		RateCode["B. VIRGIN ISLAND"] = "284";
		RateCode["BAHAMAS"] = "242";
		RateCode["BAHRAIN"] = "973";
		RateCode["BANGLADESH"] = "880";
		RateCode["BARBADOS"] = "246";
		RateCode["BELARUS"] = "375";
		RateCode["BELGIUM"] = "32";
		RateCode["BELIZE"] = "501";
		RateCode["BENIN"] = "229";
		RateCode["BERMUDA"] = "441";
		RateCode["BHUTAN"] = "975";
		RateCode["BOLIVIA"] = "591";
		RateCode["BOSNIA"] = "387";
		RateCode["BOTSWANA"] = "267";
		RateCode["BOURKINA FASSO"] = "226";
		RateCode["BRAZIL"] = "550";
		RateCode["BRUNEI"] = "673";
		RateCode["BULGARIA"] = "359";
		RateCode["BURUNDI"] = "257";
		RateCode["CAMBODIA"] = "855";
		RateCode["CAMEROON"] = "237";
		RateCode["CANADA"] = "1 + (NADP)";
		RateCode["CAPE VERDE IS"] = "238";
		RateCode["CAYMAN IS"] = "345";
		RateCode["CENTL AFRCAN REP"] = "236";
		RateCode["CHAD REP"] = "235";
		RateCode["CHILE"] = "56";
		RateCode["CHINA"] = "86";
		RateCode["COLOMBIA"] = "57";
		RateCode["COMOROS ISLM REP"] = "269";
		RateCode["CONGO DEM. REPUBLIC"] = "243";
		RateCode["CONGO REP"] = "242";
		RateCode["COOK ISLANDS"] = "682";
		RateCode["COSTA RICA"] = "506";
		RateCode["CROATIA"] = "385";
		RateCode["CUBA"] = "53";
		RateCode["CYPRUS"] = "357";
		RateCode["CZECH REP."] = "420";
		RateCode["DENMARK"] = "45";
		RateCode["DIEGO GARCIA"] = "246";
		RateCode["DJIBOUTI"] = "253";
		RateCode["DOMINICA"] = "767";
		RateCode["DOMINICAN REPUBLIC"] = "809";
		RateCode["ECUADOR"] = "593";
		RateCode["EGYPT"] = "20";
		RateCode["EL SALVADOR"] = "503";
		RateCode["EQUATORL GUIN"] = "240";
		RateCode["ERITREA"] = "291";
		RateCode["ESTONIA"] = "372";
		RateCode["ETHIOPIA"] = "251";
		RateCode["FALKLAND ISLANDS"] = "500";
		RateCode["FAROE ISLANDS"] = "298";
		RateCode["FIJI"] = "679";
		RateCode["FINLAND"] = "358";
		RateCode["FRANCE"] = "33";
		RateCode["FRENCH ANTILLES"] = "596";
		RateCode["FRENCH GUIANA"] = "594";
		RateCode["FRENCH POLYNESIA"] = "689";
		RateCode["GABON"] = "241";
		RateCode["GAMBIA"] = "220";
		RateCode["GEORGIA"] = "995";
		RateCode["GERMANY"] = "49";
		RateCode["GHANA"] = "233";
		RateCode["GIBRALTAR"] = "350";
		RateCode["GREECE"] = "30";
		RateCode["GREENLAND"] = "299";
		RateCode["GRENADA"] = "473";
		RateCode["GUADELOUPE"] = "590";
		RateCode["GUANTANAMO"] = "53";
		RateCode["GUATEMALA"] = "502";
		RateCode["GUINEA PEOP REP"] = "224";
		RateCode["GUINEA-BISSAU"] = "245";
		RateCode["GUYANA"] = "592";
		RateCode["HAITI"] = "509";
		RateCode["HONDURAS"] = "504";
		RateCode["HONG KONG"] = "852";
		RateCode["HUNGARY"] = "36";
		RateCode["ICELAND"] = "354";
		RateCode["INDIA"] = "91";
		RateCode["INDONESIA"] = "62";
		RateCode["IRAN"] = "98";
		RateCode["IRAQ"] = "964";
		RateCode["IRELAND"] = "353";
		RateCode["ISRAEL"] = "972";
		RateCode["ITALY"] = "39";
		RateCode["IVORY COAST"] = "225";
		RateCode["JAMAICA"] = "876";
		RateCode["JAPAN"] = "81";
		RateCode["JORDAN"] = "962";
		RateCode["KAZAKHSTAN"] = "7";
		RateCode["KENYA"] = "254";
		RateCode["KIRIBATI"] = "686";
		RateCode["KOREA (NORTH)"] = "850";
		RateCode["KOREA (SOUTH)"] = "82";
		RateCode["KUWAIT"] = "965";
		RateCode["KYRGHYZSTAN"] = "7";
		RateCode["LAOS"] = "856";
		RateCode["LATVIA"] = "371";
		RateCode["LEBANON"] = "961";
		RateCode["LESOTHO"] = "266";
		RateCode["LIBERIA"] = "231";
		RateCode["LIBYA"] = "218";
		RateCode["LITHUANIA"] = "370";
		RateCode["LUXEMBOURG"] = "352";
		RateCode["MACAO"] = "853";
		RateCode["MACEDONIA"] = "389";
		RateCode["MADAGASCAR"] = "261";
		RateCode["MALAWI"] = "265";
		RateCode["MALAYSIA"] = "60";
		RateCode["MALDIVES REP"] = "960";
		RateCode["MALI REP"] = "223";
		RateCode["MALTA REP"] = "356";
		RateCode["MARSHALL IS"] = "692";
		RateCode["MAURITANIA"] = "222";
		RateCode["MAURITIUS"] = "230";
		RateCode["MAYOTTE IS"] = "269";
		RateCode["MEXICO"] = "52";
		RateCode["MICRONESIA"] = "691";
		RateCode["MOLDOVA"] = "373";
		RateCode["MONACO"] = "377";
		RateCode["MONGOLIA PEOP REP"] = "976";
		RateCode["MONTSERRAT"] = "664";
		RateCode["MOROCCO"] = "212";
		RateCode["MOZAMBIQUE"] = "258";
		RateCode["MYANMAR"] = "95";
		RateCode["NAMIBIA"] = "264";
		RateCode["NAURU"] = "674";
		RateCode["NEPAL"] = "977";
		RateCode["NETH ANTILLES"] = "599";
		RateCode["NETHERLANDS"] = "31";
		RateCode["NEW CALEDONIA"] = "687";
		RateCode["NEW ZEALAND"] = "64";
		RateCode["NICARAGUA"] = "505";
		RateCode["NIGER REP"] = "227";
		RateCode["NIGERIA"] = "234";
		RateCode["NIUE"] = "683";
		RateCode["NORWAY"] = "470";
		RateCode["OCEAN ATLANTIC EAST"] = "871";
		RateCode["OCEAN ATLANTIC WEST"] = "874";
		RateCode["OCEAN INDIAN"] = "873";
		RateCode["OCEAN PACIFIC"] = "872";
		RateCode["OMAN"] = "968";
		RateCode["PAKISTAN"] = "92";
		RateCode["PALAU"] = "680";
		RateCode["PANAMA"] = "507";
		RateCode["PAPUA N. GUINEA"] = "675";
		RateCode["PARAGUAY"] = "595";
		RateCode["PERU"] = "51";
		RateCode["PHILIPPINES"] = "63";
		RateCode["POLAND"] = "480";
		RateCode["PORTUGAL"] = "351";
		RateCode["QATAR"] = "974";
		RateCode["REUNION IS"] = "262";
		RateCode["ROMANIA"] = "40";
		RateCode["RUSSIAN FED"] = "7";
		RateCode["RWANDA"] = "250";
		RateCode["SAIPAN"] = "670";
		RateCode["SAN MARINO"] = "378";
		RateCode["SAO TOME"] = "239";
		RateCode["SAUDI ARABIA"] = "966";
		RateCode["SENEGAL"] = "221";
		RateCode["SEYCHELLES"] = "248";
		RateCode["SIERRA LEONE"] = "232";
		RateCode["SINGAPORE"] = "65";
		RateCode["SLOVAKIA"] = "421";
		RateCode["SLOVENIA"] = "386";
		RateCode["SOLOMON ISLS"] = "677";
		RateCode["SOMALIA"] = "252";
		RateCode["SOUTH AFRICA"] = "27";
		RateCode["SPAIN"] = "34";
		RateCode["SRI LANKA"] = "94";
		RateCode["ST. HELENA"] = "290";
		RateCode["ST. KITTS/NEVIS"] = "869";
		RateCode["ST. LUCIA"] = "758";
		RateCode["ST. PIERRE"] = "508";
		RateCode["ST. VINCENT"] = "809";
		RateCode["SUDAN"] = "249";
		RateCode["SURINAME"] = "597";
		RateCode["SWAZILAND"] = "268";
		RateCode["SWEDEN"] = "46";
		RateCode["SWITZERLAND"] = "41";
		RateCode["SYRIAN ARABREP"] = "963";
		RateCode["TAIWAN"] = "886";
		RateCode["TAJIKISTAN"] = "7";
		RateCode["TANZANIA"] = "255";
		RateCode["THAILAND"] = "66";
		RateCode["TOGO"] = "228";
		RateCode["TOKELAU"] = "690";
		RateCode["TONGA"] = "676";
		RateCode["TRINIDAD"] = "868";
		RateCode["TUNISIA"] = "216";
		RateCode["TURKEY"] = "900";
		RateCode["TURKMENISTAN"] = "933";
		RateCode["TURKS & CAICOS"] = "649";
		RateCode["TUVALU"] = "688";
		RateCode["UGANDA"] = "256";
		RateCode["UKRAINE"] = "380";
		RateCode["UNITED A. E."] = "971";
		RateCode["UNITED KINGDOM"] = "44";
		RateCode["UNITED STATES"] = "11";
		RateCode["URUGUAY"] = "598";
		RateCode["UZBEKISTAN"] = "7";
		RateCode["VANUATU"] = "678";
		RateCode["VENEZUELA"] = "58";
		RateCode["VIETNAM"] = "84";
		RateCode["WALLIS ISL"] = "681";
		RateCode["WESTERN SAMOA"] = "685";
		RateCode["YEMEN"] = "967";
		RateCode["YUGOSLAVIA"] = "381";
		RateCode["ZAMBIA"] = "260";
		RateCode["ZIMBABWE"] = "263";
		RateCode["other"] = "";

// Function to display the rate in the text box
function displayRate(x)
	{
	var emptyString = "";
	var numString = "0";
	var currVal = x.options[x.selectedIndex].value;
	if((currVal != emptyString) && (currVal != numString)){
		{
		// change the text field for each entry in the RateField list
		document.RateForm.RateCode.value = "+" + RateCode[currVal];
		}
	} else {
		document.RateForm.RateCode.value = "+";
	}
	}

function contactform(){
	// Default variables
	var errorMsg = "";
	var errorMsgLong = "";
	
	var validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	
	var strEmail = document.RateForm.emailaddress.value;
	var firstname = document.RateForm.firstname.value;
	var surname = document.RateForm.surname.value;
	var country = document.RateForm.Rates.value;
	
	if (firstname == "") {
		errorMsg += "\nFirstname - Please enter your first name";
	}
	
	if (surname == "") {
		errorMsg += "\nSurname - Please enter your Surname";
	}
	
	//if (country == "0"){
		//errorMsg += "\nPlease select a country";	
	//}
	
	if (strEmail == "") {
		errorMsg += "\nEmail - Please enter your email address";
	} else if (strEmail.search(validRegExp) == -1) {
		errorMsg += "\nInvalid e-mail address entered. Please amend and try again";
	}
	
    // If there is a problem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")) {
		msg = "The form was not submitted as there are errors in your input\n";
		msg += "Please correct the following error(s) and re-submit the form.\n\n";
		
		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		
		// Return false
		return false;
	} 
	
	// Return true
	return true;
}