function ContactForm () {
	$('form').style.display = "none";
	Loading();
	new Ajax.Request('#oh?_r=' + Math.random(), {method: 'post', parameters: $('form').serialize(true), evalScripts: true, onSucess:Contact()});

}
function numonly(field) {
	field.value=field.value.replace(/[^0-9]/g, '');
}
function Contact () {
	window.location = "#boo";
}
function Loading () {
	$('alert').style.display = "block";
}

function CheckContactForm () {
var error = "";
var i;
//text
	error += check($('form').field1);
	error += check($('form').field2);
	error += check($('form').field3);
	error += check($('form').field8);
	error += check($('form').field9);
	error += check($('form').field10);
	error += check($('form').field11);
	error += check($('form').field12);
	error += check($('form').field13);
	error += check($('form').field15);
	error += check($('form').field16);
	error += check($('form').field17);
	error += check($('form').field18);
	error += check($('form').field20);
	error += check($('form').field22);
	error += check($('form').field23);
	error += check($('form').field24);
	error += check($('form').field25);
	error += check($('form').field26);
	error += check($('form').field27);
	error += check($('form').field29);
//dmy
	error += check_($('form').field4);	
	error += check_($('form').field5);	
	error += check_($('form').field6);	
//email
	error += checkemail($('form').field7);
//drop downs
	error += check__($('form').field14);
	error += check__($('form').field19);
	error += check__($('form').field21);
	error += check__($('form').field28);

if (error != "") {
  // alert("Some of the fields were not completed correctly, please correct them and try again. There are problems with the following fields: "+wg.slice(0, -2)+".");
  alert("Please correct the fields highlighted in red.");
  return false;
}
	if ($('form').check1.checked == false) {
	alert("Please confirm that you have read, understood and agreed to the Foreign Currency Exchange Terms and Conditions");
	return false;
	}
	if ($('form').check2.checked == false) {
	alert("Please confirm that the information provided by yourself is correct and that Foreign Currency Exchange will be notified imddediately of any changes.");
	return false;
	}
}

function checkemail(email) {
	var error = "";
	apos=email.value.indexOf("@")
	dotpos=email.value.lastIndexOf(".")

if (email.value == "" || apos<1 || dotpos-apos<2)
{
 email.className = "form-inp-";
 		error = email.name;
} else {
 email.className = "form-inp";
}
	return error;  
}

function check(field) {
var error = "";
    if (field.value.length == 0) {

		field.className = "form-inp-";
       error = field.name;
    } else {
    	field.className = "form-inp";
    }
	return error;
}


function check_(field) {
var error = "";
    if (field.value.length == 0) {

		field.className = "form-dmy-";
       error = field.name;
    } else {
    	field.className = "form-dmy";
    }
	return error;
}
function check__(field) {
var error = "";
    if (field.value.length == 0) {

		field.className = "form-cntry-";
       error = field.name;
    } else {
    	field.className = "form-cntry";
    }
	return error;
}
