function checkForm(errMsg) {
	if(	errMsg!="") {	
		alert("Please correct error(s) below:\n"+errMsg);
		return false;
	}
	else return true;
}


function checkAlpha_Num(objName, objTitle, allowEmpty) { //Aplpha Numeric using Underscore - useful for usernames
	if (!objName.value && allowEmpty) return ""; // allowing empty string
	if (!objName.value && !allowEmpty) { 
objName.focus(); // Jump to that field
return "- "+objTitle+" is mandatory.\n"; // tell its mandatory
}
		
	var filter=/^[A-Z|a-z][A-Z|a-z|0-9|_]*[A-Z|a-z|0-9]+$/
	if (!filter.test(objName.value)) {
		objName.focus();
		return "- Invalid input for "+objTitle+".\n";
	}
	return "";
}

function checkEmpty(objName, objTitle, allowEmpty) {
	if (!objName.value) {
		if (objName.type!="hidden")	objName.focus();
		return "- Missing input for "+objTitle+".\n";
	}
	return "";
}

function checkDate(objName, objTitle, allowEmpty) {
	if (!objName.value && allowEmpty) return ""; // allowing empty string
	if (!objName.value && !allowEmpty) { 
objName.focus(); // Jump to that field
return "- "+objTitle+" is mandatory.\n"; // tell its mandatory
}
		
	var filter=/^(19|20)\d\d[-/](0[1-9]|1[012])[-/](0[1-9]|[12][0-9]|3[01])$/
	if (!filter.test(objName.value)) {
		objName.focus();
		return "- Invalid input for "+objTitle+". The set format is yyyy/mm/dd.\n";
	}
	return "";
}
function checkInteger(objName, objTitle, allowEmpty) {
	if (!objName.value && allowEmpty) return ""; // allowing empty string
	if (!objName.value && !allowEmpty) { 
objName.focus(); // Jump to that field
return "- "+objTitle+" is mandatory.\n"; // tell its mandatory
}
		
	var filter=/^[0-9]+$/
	if (!filter.test(objName.value)) {
		objName.focus();
		return "- Invalid input for "+objTitle+".\n";
	}
	return "";
}
function checkEmail(objName, objTitle, allowEmpty) {
	if (!objName.value && allowEmpty) return ""; // allowing empty string
	if (!objName.value && !allowEmpty) { 
objName.focus(); // Jump to that field
return "- "+objTitle+" is mandatory.\n"; // tell its mandatory
}
		
	var filter=/^[\w-_\.]+@[\w-\.]+\.[a-zA-Z0-9]{2,13}$/
	if (!filter.test(objName.value)) {
		objName.focus();
		return "- Invalid input for "+objTitle+".\n";
	}
	return "";
}
function checkDuplicate(objName,objName2,objTitle) {
	if (!(objName.value==objName2.value)) {
		objName2.focus();
		return "- Values do not match for "+objTitle+".\n";
	}
	return "";
}
function checkUrl(objName, objTitle, allowEmpty) {
	if (!objName.value && allowEmpty) return ""; // allowing empty string
	if (!objName.value && !allowEmpty) { 
objName.focus(); // Jump to that field
return "- "+objTitle+" is mandatory.\n"; // tell its mandatory
}
		
	var filter=/^[\/\.\-\$\&_:\s@\?#a-zA-Z\d]+$/
	if (!filter.test(objName.value)) {
		objName.focus();
		return "- Invalid input for "+objTitle+".\n";
	}
	return "";
}
function checkCheck(objName,objValue,errMessage) {

	if (objName.checked!=objValue) {
		objName.focus();
		return errMessage;
	}
	return "";
}
function checkPhone(objName, objTitle, allowEmpty) {
	if (!objName.value && allowEmpty) return ""; // allowing empty string
	if (!objName.value && !allowEmpty) { 
objName.focus(); // Jump to that field
return "- "+objTitle+" is mandatory.\n"; // tell its mandatory
}
		
	var filter=/^[\+\(\)\-\s\d]+$/
	if (!filter.test(objName.value)) {
		objName.focus();
		return "- Invalid input for "+objTitle+". \n";
	}
	return "";
}
function checkAddress(objName, objTitle, allowEmpty) {
	if (!objName.value && allowEmpty) return ""; // allowing empty string
	if (!objName.value && !allowEmpty) { 
objName.focus(); // Jump to that field
return "- "+objTitle+" is mandatory.\n"; // tell its mandatory
}
		
	var filter=/^[\#\(\)\/\'\,\.\-\s_a-zA-Z\d]+$/
	if (!filter.test(objName.value)) {
		objName.focus();
		return "- Invalid input for "+objTitle+". \n";
	}
	return "";
}
function checkName(objName, objTitle, allowEmpty) {
	if (!objName.value && allowEmpty) return ""; // allowing empty string
	if (!objName.value && !allowEmpty) { 
objName.focus(); // Jump to that field
return "- "+objTitle+" is mandatory.\n"; // tell its mandatory
}
		
	var filter=/^([\'\,\.\-a-zA-Z]+ ?)+$/
	if (!filter.test(objName.value)) {
		objName.focus();
		return "- Invalid input for "+objTitle+". \n";
	}
	return "";
}
function adjustMinMax(max_price,min_price,way){
	if (max_price.selectedIndex<min_price.selectedIndex && way==1) 
		max_price.selectedIndex=min_price.selectedIndex;
	if (min_price.selectedIndex>max_price.selectedIndex && way==2) 
		min_price.selectedIndex=max_price.selectedIndex;
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function a(i) {
i.style.filter = 'Invert()';
}
function verifyForm(f) {
	if (checkAlphaOrNum(f.keyword,"Search Keywords"))	{
		f.action=f.action+"#search";
		f.submit(); 
	}
	else 
		return false;
}
function checkAlpha(objName, objTitle, allowEmpty) { //Strictly Alpha
	if (!objName.value && allowEmpty) return ""; // allowing empty string
	if (!objName.value && !allowEmpty) { 
objName.focus(); // Jump to that field
return "- "+objTitle+" is mandatory.\n"; // tell its mandatory
}
		
	var filter=/^[A-Z|a-z]+$/
	if (!filter.test(objName.value)) {
		alert("Please input valid value for "+objTitle+". Some valid examples are abc, XYZ, abCD\n> You can only use alphabetics (a-z)\n> May NOT contain numerics or spaces\n> Minnimum length 1\n> Must end in an alphabetic");
		objName.focus();
		return false;
	}
	return true;
}
function checkAlphaSpaces(objName, objTitle, allowEmpty) { //Alpha with spaces
	if (!objName.value && allowEmpty) return ""; // allowing empty string
	if (!objName.value && !allowEmpty) { 
objName.focus(); // Jump to that field
return "- "+objTitle+" is mandatory.\n"; // tell its mandatory
}
		
	var filter=/^[A-Z|a-z][A-Z|a-z|\s]*[A-Z|a-z]+$/
	if (!filter.test(objName.value)) {
		alert("Please input valid value for "+objTitle+". Some valid examples are abc we, XY Z, abCD\n> You can only use alphabetics (a-z) and spaces\n> May NOT contain numerics or underscores\n> Minnimum length 2\n> Must end in an alphabetic");
		objName.focus();
		return false;
	}
	return true;
}
function checkAlphaNum(objName, objTitle, allowEmpty) { //Strictly Aplpha Numeric
	if (!objName.value && allowEmpty) return ""; // allowing empty string
	if (!objName.value && !allowEmpty) { 
objName.focus(); // Jump to that field
return "- "+objTitle+" is mandatory.\n"; // tell its mandatory
}
		
	var filter=/^[A-Z|a-z][A-Z|a-z|0-9|\s]*[A-Z|a-z|0-9]+$/
	if (!filter.test(objName.value)) {
		objName.focus();
		return "- Invalid input for "+objTitle+". \n";
	}
	return "";
}

function checkAlphaOrNum(objName, objTitle, allowEmpty) {
	if (!objName.value && allowEmpty) return ""; // allowing empty string
	if (!objName.value && !allowEmpty) { 
objName.focus(); // Jump to that field
return "- "+objTitle+" is mandatory.\n"; // tell its mandatory
}
		
	var filter=/^[A-Za-z0-9]([A-Za-z0-9\s]*[A-Za-z0-9])*$/
	if (!filter.test(objName.value)) {
		objName.focus();
		return "- Invalid input for "+objTitle+". \n";
	}
	return "";
}
function setCountry(f) {
	a = f.zone.options(f.zone.selectedIndex).text.split("/");
/*	if (a[0]=="---")	{
		f.zone.selectedIndex=f.zone.selectedIndex+1; 
		a = f.zone.options(f.zone.selectedIndex).text.split("/");
	}*/
	f.country.value=a[0];
	f.country1.value=a[0];
}
function setCountry2(z,c,c1) {
	a = z.options(z.selectedIndex).text.split("/");
/*	if (a[0]=="---")	{
		f.zone.selectedIndex=f.zone.selectedIndex+1; 
		a = f.zone.options(f.zone.selectedIndex).text.split("/");
	}*/
	c.value=a[0];
	c1.value=a[0];
}
function makeEqual(s1,s2) {
	s1.selectedIndex=s2.selectedIndex;
}