//clear on focus
	function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}

//show hide questions
if(document.layers) {
    var ns4 = true;
}

if(document.all) {
    var ie4 = true;
}

function showObject(obj) {
    var myObj;
    if (ns4) {
         myObj = document[obj];
         myObj.visibility = "show";
    }
    else if (ie4) {
         myObj = document.all[obj];
         myObj.style.visibility = "visible";
    }
}

function hideObject(obj) {
    var myObj;
    if (ns4) {
         myObj = document[obj];
         myObj.visibility = "hide";
    }
    else if (ie4) {
         myObj = document.all[obj];
         myObj.style.visibility = "hidden";
    }
}

//generic required fields
function checkrequired(which) {
	var pass=true;
	if (document.images) {
		for (i=0;i<which.length;i++) {
			var tempobj=which.elements[i];
			if (tempobj.id.substring(0,8)=="required") {
				if (((tempobj.type=="text"||tempobj.type=="password"||tempobj.type=="textarea")&&
					tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
					tempobj.selectedIndex==0)) {
					pass=false;
					break;
         		}
      		}
   		}
	}
	if (!pass) {
	shortFieldName=tempobj.id.substring(8,30);
	//alert(shortFieldName+" Is a Required Field");
	document.getElementById("error").innerHTML = "<strong>'" + shortFieldName + "'</strong> Is a Required Field<br>";
	document.getElementById("error").style.display = "inline";
	document.getElementById("error2").innerHTML = "<strong>'" + shortFieldName + "'</strong> Is a Required Field<br>";
	document.getElementById("error2").style.display = "inline";
	return false;
	}
	else
	return true;
}



//required field in mapsearch
function validate() {
Av=mapsearch.AD2.value;
Cv=mapsearch.CITY.value;
if ((Av!='') && (Cv=='')) {
document.getElementById("error").innerHTML = "Please Enter A Town or City<br>";
document.getElementById("error").style.display = "inline";
event.returnValue=false;
}

}


//check password is the same as well as all compulory fields in user page
function Password_Validator(editUsers)
{
if (editUsers.password.value != editUsers.password2.value)
{
	alert("The two passwords are not the same.");
	editUsers.password2.focus();
	return (false);
}
// check if both password fields are the same
var pass=true;
if (document.images) {
for (i=0;i<editUsers.length;i++) {
var tempobj=editUsers.elements[i];
if (tempobj.id.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="password"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.id.substring(8,30);
//alert(shortFieldName+" Is a Required Field");
document.getElementById("error").innerHTML = "<strong>'" + shortFieldName + "'</strong> Is a Required Field<br>";
document.getElementById("error").style.display = "inline";
return false;
}
else
return true;
}

function flip(_panelName) { 
// hide them both 
document.getElementById("searchproducts").style.display = "none"; 
document.getElementById("searchwastetypes").style.display = "none"; 
document.getElementById("searchall").style.display = "none"; 
// show the one we want 
document.getElementById(_panelName).style.display = "block"; 
} 





