/******************************************************
	FUNCTIONS TO EMPTY AND RE-FILL A TEXT FIELD
******************************************************/
function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
	thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
	thisfield.value = defaulttext;
	}
}
/******************************************************/
/******************************************************
	FUNCTION TO VALIDATE SITE SEARCH FORM
******************************************************/

/*
function validate_sitesearch(){
	
	var bError = 0
	
	if(document.frm_search.txt_search.value == "" || toLowerCase(document.frm_search.txt_search.value) == 'search site'){
		if(bError==0){
			alert("Please enter a search.")
			bError=1
			return false
		}
	}

	
				
	if(bError==0){
		document.frm_search.submit()
	}
}
*/


/******************************************************/
/******************************************************
	FUNCTION TO VALIDATE SUBSCRIPTION FORM
******************************************************/
function validate_subscription(){
	
	var bError = 0
	
	if(document.frm_subscribe.txt_title.value == ""){
		if(bError==0){
			alert("Please select a title.")
			bError=1
			return false
		}
	}
	
	if(document.frm_subscribe.txt_firstname.value == ""){
		if(bError==0){
			alert("Please enter your first name.")
			bError=1
			return false
		}
	}
	
	if(document.frm_subscribe.txt_surname.value == ""){
		if(bError==0){
			alert("Please enter your surname.")
			bError=1
			return false
		}
	}
	
	if(document.frm_subscribe.txt_email.value == ""){
		if(bError==0){
			alert("Please enter your email address.")
			bError=1
			return false
		}
	}
	
	if(echeck(document.frm_subscribe.txt_email.value) != true){
		if(bError==0){
			alert("Please enter a valid email address.")
			bError=1
			return false
		}
	}
	
	if(document.frm_subscribe.txt_cellphone.value == ""){
		if(bError==0){
			alert("Please enter your cellphone number.")
			bError=1
			return false
		}
	}
	
	if(document.frm_subscribe.txt_tel.value == ""){
		if(bError==0){
			alert("Please enter your telephone number.")
			bError=1
			return false
		}
	}
	
	if(document.frm_subscribe.txt_address.value == ""){
		if(bError==0){
			alert("Please enter your address.")
			bError=1
			return false
		}
	}
	
	if(document.frm_subscribe.txt_city.value == ""){
		if(bError==0){
			alert("Please enter the city in which you live.")
			bError=1
			return false
		}
	}
	
	if(document.frm_subscribe.txt_postalcode.value == ""){
		if(bError==0){
			alert("Please enter your postal code.")
			bError=1
			return false
		}
	}
	
	if(document.frm_subscribe.txt_country.value == ""){
		if(bError==0){
			alert("Please select your country.")
			bError=1
			return false
		}
	}
	
	 if ( 
		(document.frm_subscribe.txt_subscription[0].checked == false) &&
		(document.frm_subscribe.txt_subscription[1].checked == false) &&
		(document.frm_subscribe.txt_subscription[2].checked == false) &&
		(document.frm_subscribe.txt_subscription[3].checked == false) &&
		(document.frm_subscribe.txt_subscription[4].checked == false) &&
		(document.frm_subscribe.txt_subscription[5].checked == false) &&
		(document.frm_subscribe.txt_subscription[6].checked == false) &&
		(document.frm_subscribe.txt_subscription[7].checked == false) &&
		(document.frm_subscribe.txt_subscription[8].checked == false)
		){
		
		alert("Please select a subscription option.")
		bError=1
		return false
	}


	
				
	if(bError==0){
		document.frm_subscribe.submit()
	}
}
/******************************************************/
/******************************************************
	FUNCTION TO ALLOW ONLY NUMBERS IN A TEXTFIELD
******************************************************/
<!--
// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;

// decimal point jump
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}

//-->

/******************************************************
	FUNCTION TO VALIDATE A GIVEN EMAIL ADDRESS
******************************************************/

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}

/******************************************************
	FUNCTION TO VALIDATE A GIVEN EMAIL ADDRESS
******************************************************/

function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false;}
else {return true;}
}
}