function divisbill() {
document.main.del_title.value = document.main.select2.value
document.main.del_name.value = document.main.name.value
document.main.del_last_name.value = document.main.last_name.value
document.main.del_building_name.value = document.main.building_name.value
document.main.del_street.value = document.main.street.value
document.main.del_city.value = document.main.city.value
document.main.del_country.value = document.main.country.value
document.main.del_county.value = document.main.county.value
document.main.del_postCode.value = document.main.postCode.value
}

function divnotbill() {
document.main.del_title.value = ""
document.main.del_name.value = ""
document.main.del_last_name.value = ""
document.main.del_building_name.value = ""
document.main.del_street.value = ""
document.main.del_city.value = ""
document.main.del_country.value = ""
document.main.del_county.value = ""
document.main.del_postCode.value = ""

}
function formhandler(purpose,i) {
	var purp;
	purp=purpose;
	document.forms[i].option.value=purp;
	document.forms[i].submit();
}
function checkData() {
	var error = "";
	if (main.name.value == "") { error = "Please enter the required field: First name"; }
	if (main.last_name.value == "") { error = "Please enter the required field: Last name"; }
	if (main.building_name.value == "") { error = "Please enter the required field: Building number/name"; }
	if (main.street.value == "") { error = "Please enter the required field: Street"; }
	if (main.city.value == "") { error = "Please enter the required field: City"; }
	if (main.county.value == "") { error = "Please enter the required field: County"; }
	if (main.country.value == "") { error = "Please enter the required field: Country"; }
	if (main.postCode.value == "") { error = "Please enter the required field: Post code"; }
	if (main.phone.value == "") { error = "Please enter the required field: Phone"; }
	if (main.email.value == "") { error = "Please enter the required field: Email"; }
	if (main.cardType.value == "") { error = "Please enter the required field: Card type"; }
	if (main.cardHolder.value == "") { error = "Please enter the required field: Card holder's name"; }
	if (main.cardNumber.value == "") { error = "Please enter the required field: Card number"; }
//	if (main.secCode.value == "") { error = "Please enter the required field: Security code"; }
	if (main.expiryDatem.value == "") { error = "Please enter the required field: Expiry month"; }
	if (main.expiryDatey.value == "") { error = "Please enter the required field: Expiry year"; }
	if (error != "") { alert(error); return false; }
	else { return true; }
}
function checkData_wrld() {
	var error = "";
	if (main.name.value == "") { error = "Please enter the required field: First name"; }
	if (main.last_name.value == "") { error = "Please enter the required field: Last name"; }
	if (main.building_name.value == "") { error = "Please enter the required field: Building number/name"; }
	if (main.street.value == "") { error = "Please enter the required field: Street"; }
	if (main.city.value == "") { error = "Please enter the required field: City"; }
	if (main.county.value == "") { error = "Please enter the required field: County"; }
	if (main.country.value == "") { error = "Please enter the required field: Country"; }
	if (main.postCode.value == "") { error = "Please enter the required field: Post code"; }
	if (main.phone.value == "") { error = "Please enter the required field: Phone"; }
	if (main.email.value == "") { error = "Please enter the required field: Email"; }
	if (error != "") { alert(error); return false; }
	else { return true; }
}
function checkData_invoice() {
	var error = "";
	if (main.name.value == "") { error = "Please enter the required field: First name"; }
	if (main.last_name.value == "") { error = "Please enter the required field: Last name"; }
	if (main.building_name.value == "") { error = "Please enter the required field: Building number/name"; }
	if (main.street.value == "") { error = "Please enter the required field: Street"; }
	if (main.city.value == "") { error = "Please enter the required field: City"; }
	if (main.county.value == "") { error = "Please enter the required field: County"; }
	if (main.country.value == "") { error = "Please enter the required field: Country"; }
	if (main.postCode.value == "") { error = "Please enter the required field: Post code"; }
	if (main.phone.value == "") { error = "Please enter the required field: Phone"; }
	if (main.email.value == "") { error = "Please enter the required field: Email"; }
	if (error != "") { alert(error); return false; }
	else { return true; }
}
function modifyObjectStates() {
	if (registrationDetails.accountType.value=='Personal Account') {
		registrationDetails.companyName.disabled=true;
		registrationDetails.companyType.disabled=true;
		registrationDetails.companyRegNo.disabled=true;
		registrationDetails.companyVatRegNo.disabled=true;
		registrationDetails.postion.disabled=true;
		registrationDetails.fax.disabled=true;
		registrationDetails.companyName.readonly=true;
		registrationDetails.companyType.readonly=true;
		registrationDetails.companyRegNo.readonly=true;
		registrationDetails.companyVatRegNo.readonly=true;
		registrationDetails.postion.readonly=true;
		registrationDetails.fax.readonly=true;
		registrationDetails.companyName.style.background='#cccccc';
		registrationDetails.companyType.style.background='#cccccc';
		registrationDetails.companyRegNo.style.background='#cccccc';
		registrationDetails.companyVatRegNo.style.background='#cccccc';
		registrationDetails.postion.style.background='#cccccc';
		registrationDetails.fax.style.background='#cccccc';
	}
	else {
		registrationDetails.companyName.disabled=false;
		registrationDetails.companyType.disabled=false;
		registrationDetails.companyRegNo.disabled=false;
		registrationDetails.companyVatRegNo.disabled=false;
		registrationDetails.postion.disabled=false;
		registrationDetails.fax.disabled=false;
		registrationDetails.companyName.readonly=false;
		registrationDetails.companyType.readonly=false;
		registrationDetails.companyRegNo.readonly=false;
		registrationDetails.companyVatRegNo.readonly=false;
		registrationDetails.postion.readonly=false;
		registrationDetails.fax.readonly=false;
		registrationDetails.companyName.style.background='#f5f5f5';
		registrationDetails.companyType.style.background='#f5f5f5';
		registrationDetails.companyRegNo.style.background='#f5f5f5';
		registrationDetails.companyVatRegNo.style.background='#f5f5f5';
		registrationDetails.postion.style.background='#f5f5f5';
		registrationDetails.fax.style.background='#f5f5f5';
	}
}
function checkForm() {
	var error = "";
	if (registrationDetails.firstname.value == "") { error = "Please enter the required field: First Name"; }
	if (registrationDetails.surname.value == "") { error = "Please enter the required field: Last Name"; }
	if (registrationDetails.addressBuildingName.value == "") { error = "Please enter the required field: Building Name / No."; }
	if (registrationDetails.addressStreetName.value == "") { error = "Please enter the required field: Street Name"; }
	if (registrationDetails.addressTownCity.value == "") { error = "Please enter the required field: Town / City"; }
	if (registrationDetails.postal_code.value == "") { error = "Please enter the required field: Post Code / Zip Code"; }
	if (registrationDetails.email.value == "") { error = "Please enter the required field: Email (username)"; }
	if (registrationDetails.pwd.value == "") { error = "Please enter the required field: Password"; }
	if (registrationDetails.email.value != registrationDetails.emailConfirm.value) { error = "Email (username)'s do not match"; }
	if (registrationDetails.pwd.value != registrationDetails.passwordConfirm.value) { error = "Passwords do not match"; }
	if (error != "") { alert(error); return false; }
	else { return true; }
}
function sitemap_openCat(category_element, category_image) {
	if (document.getElementById(category_element)) {
		if (document.getElementById(category_element).style.display == "none") {
			document.getElementById(category_element).style.display = "block";
			document.getElementById(category_image).src = "images/fe.gif";
		}else{
			document.getElementById(category_element).style.display = "none";
			document.getElementById(category_image).src = "images/fc.gif";
		}
	}else{
		document.getElementById(category_image).src = "images/fe.gif";
	}
}

function checkDelivery()
{
	var error = "";
	if (document.main.selectDestination)
	{
  	if (document.main.selectDestination.value == "") { error = "Please select the Delivery Destination"; }
 	if (error != "") { alert(error); return false; }
	else { return true; }
	}
	else
		return true;
}
function check_location(chk) {
	if (chk==1)
	{
		var error = "";
		if (document.getElementById('selectDestination')) {
		if (document.getElementById('selectDestination').value == "") { alert("please select the destination"); return false; }
		}
	}
	return true;
}
