<!--
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_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_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];}
}

function ConfirmRemove(title, confirm_text, url){
	var text = title + "\n";
	text += "----------------------------------------------------------------\n";
	text += confirm_text + "\n";
	var doublecheck = confirm(text);
	if(doublecheck == true){
		document.location = url
	}
}

function ShowError(title, err_text){
	var text = title + "\n";
	text += "----------------------------------------------------------------\n";
	text += err_text;
	text += "----------------------------------------------------------------\n";
	text += "Please rectify the above before submitting the form.";
	alert(text);
}

function MakePrice(form,fieldname){
	var TheField = document.forms[form][fieldname];
	var price = TheField.value;
	if(isNaN(price) != false || price.length == 0){
		tempPrice = "0";
	} else {
		tempPrice = price.toString();
	}
	if(tempPrice.indexOf('.') == -1){
		newPrice = tempPrice + ".00"
	} else {
		thePrice = tempPrice.split(".");
		if(thePrice[1].length < 2){
			Filler = "";
			for(var i = thePrice[1].length; i < 2; ++i){
				Filler += "0";
			}
			newPrice = thePrice[0] + "." + thePrice[1] + Filler;
		} else {
			if(thePrice[1].length > 2){
				newPrice = thePrice[0] + "." + thePrice[1].substring(0,2);
			} else {
				newPrice = tempPrice;
			}
		}
	}
	price = newPrice;
	TheField.value = price;
}

function MakeNumeric(form,field){
	var thisField = document.forms[form][field];
	if(thisField.value != ""){
		if(isNaN(thisField.value)){
			thisField.value = thisField.value.slice(0, (thisField.value.length - 1));
			thisField.focus();
		}
	}
}

function LimitTextArea(form,field,limit){
	var thisField = document.forms[form][field];
	if(thisField.value.length > limit){
		thisField.value = thisField.value.slice(0, limit);
		thisField.focus();
	}
}

function VerifyEmail(form){

	thisForm = eval(form + "['EmailAddress'].value");

	if((thisForm == "" || thisForm.indexOf('@', 0) == -1) || thisForm.indexOf('.') == -1) {  
		alert ("A valid Email address is required");   
		return false;
	} else {
		return true;
	}
}

function CheckAdmin(){
var theForm =  document.forms['Content'];
var error_title = "Errors Found - Please Rectify";
var error_text = "";
var error_found = false;
	if(theForm['Username'].value == 0) {  
	error_text += "Username is required\n";
	error_found = true;
	} 
	if(theForm['Password'].value.length == 0) {  
	error_text += "Password is required\n";
	error_found = true;
	}
	if(error_found == true){
		ShowError(error_title,error_text)
		return false;
	} else {
		return true;
	}
}

function CheckContactForm(form,title){
	var errText = "";
	var errCount = 0;	
	if(form['Name'].value == "") {
		errText += "You must provide your name\n";
		errCount = errCount  + 1;
	}
	if(form['Email'].value == "") {
		errText += "You must provide your email address\n";
		errCount = errCount  + 1;
	}
	if(form['Body'].value == "") {
		errText += "Your query/comment cannot be left blank\n";
		errCount = errCount  + 1;
	}
	if(errCount != 0){
		ShowError(title, errText);
		return false;
	} else {
		return true;
	}
}

function CheckBasicRegister(form) {
	var errText = "";
	var errCount = 0;
	if(form['FirstName'].value == "") {
	    errText += "First name is a required field\n";
		errCount = errCount  + 1;
	}
    if(form['Surname'].value =="") {
    	errText += "Surname is a required field\n";
		errCount = errCount  + 1;
    } 
    if(form['Address2'].value =="") {
   		errText += "Address line 2 is a required field\n";
		errCount = errCount  + 1;
    } 
    if(form['Town'].value =="") {
    	errText += "Town is a required field\n";
		errCount = errCount  + 1;
    }
    if(form['AreaID'].value == 0) {
    	errText += "County is a required field\n";
		errCount = errCount  + 1;
    }
    if(form['Telephone'].value =="") {
    	errText += "Telephone is a required field\n";
		errCount = errCount  + 1;
    }
    if(form['EmailAddress'].value =="") {
    	errText += "Email Address is a required field\n";
		errCount = errCount  + 1;
    } else {
		if((form['EmailAddress'].value == "" || form['EmailAddress'].value.indexOf('@', 0) == -1) || form['EmailAddress'].value.indexOf('.') == -1) { 
    		errText += "valid Email Address is required\n";
			errCount = errCount  + 1;
		}
	}
    if(form['Password'].value =="") {
    	errText += "Password is a required field\n";
		errCount = errCount  + 1;
    }
	if(errCount != 0){
		ShowError("Registration Error", errText);
		return false;
	} else {
		return true;
	}
}

function CheckFullRegister(form) {
	var errText = "";
	var errCount = 0;
	if(form['SelfDescription'].value == "") {
	    errText += "Self Description is a required field\n";
		errCount = errCount + 1;
	}
    if(form['TheoreticalApproach'].value == "") {
    	errText += "Theoretical Approach is a required field\n";
		errCount = errCount + 1;
    } 
    if(form['TherapiesOffered'].value == "") {
   		errText += "Kinds of counselling is a required field\n";
		errCount = errCount + 1;
    } 
    if(form['Qualifications'].value == "") {
    	errText += "Qualifications is a required field\n";
		errCount = errCount + 1;
    }
    if(form['Liability'].value == "") {
    	errText += "Professional liability is a required field\n";
		errCount = errCount + 1;
    }
	if(errCount != 0){
		ShowError("Registration Error", errText);
		return false;
	} else {
		return true;
	}
}
function PaymentDetails(){

	var errText = "";
	var errCount = 0;
	var form = document.forms['Payment']
	if(form['CardNumber'].value == "") {
	    errText += "Card number is a required field\n";
		errCount = errCount + 1;
	}
    if(form['CardType'].value == "") {
    	errText += "Card type is a required field\n";
		errCount = errCount + 1;
    } 
    if(form['ExpiryDate'].value == "") {
   		errText += "Expiry date is a required field\n";
		errCount = errCount + 1;
    } 

	if(errCount != 0){
		ShowError("Registration Error", errText);
		return false;
	} else {
		return true;
	}
}

function Top(){
scroll(0,0)
}

function Back(){
history.go(-1)
}

function GoURL(url){
document.location.href = url;
}
//-->