


function verifySimple() {
	 var whatKeywd = document.ypform.C.value;
	 var whereKeywd = document.ypform.L.value;
	 whatKeywd = whatKeywd.replace( /^\s+/g, "" );
	 whatKeywd = whatKeywd.replace( /\s+$/g, "" ); 
	 whereKeywd = whereKeywd.replace( /^\s+/g, "" );
	 whereKeywd = whereKeywd.replace( /\s+$/g, "" ); 
   if (whatKeywd == "" || whatKeywd == "Required field" || whatKeywd == "Business Name, Category, Keyword") {
   		document.ypform.C.value = "Required field";
   		document.ypform.C.style.color = "red";
		document.ypform.C.focus();
		
		return false;
   }
   else if (whereKeywd == "City, State, Zip") {
   		document.ypform.L.value = "Enter valid city and state or zip code";
   		document.ypform.L.style.color = "red";
		document.ypform.L.focus();
		
		return false;
   }
   return true;
}


function checkSTYPE () {
	if (document.ypform.RR != null && document.ypform.RR.selectedIndex == 0) {
		document.ypform.STYPE.value = "S";
		document.ypform.R.value = "";
	} else if (document.ypform.RR != null) {
			document.ypform.STYPE.value = "D";
			document.ypform.R.value = "D";
	}
}
  
function MM_setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value = newText;
}

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 changeTxtColor(objName, objText) {
	var obj = MM_findObj(objName);
	if (obj) var objVal = obj.value;
	objVal = objVal.replace( /^\s+/g, "" );

	if (objVal == 'Required field') {
		obj.style.color = "#FF0000";  // Required Field is red
	} else if (objVal == objText) {
		obj.style.color = "#999999";  // Default text is gray
	} else {
		obj.style.color = "#000000";  // user text is black
	}
}

function isInputEmpty(objName, msgText) {
	var obj = MM_findObj(objName);
  
	if (obj) var objVal = obj.value;

	objVal = objVal.replace( /^\s+/g, "" );

	if (objVal == "") {
		alert(msgText);		
		obj.focus();		
		return false;
   }
	   return true;
}

function getInputText(objName) {
	var obj = MM_findObj(objName);
	var objVal =  '';
	if (obj) objVal = obj.value;
	objVal = objVal.replace( /^\s+/g, "" );

	return objVal;
}

function HandleInputEvents(input) {
    var input2 = document.getElementById(input);
 	if (input2.value == "Business Name, Category, Keyword" || input2.value == "Required field" || input2.value == "City, State, Zip"  || input2.value == "Enter valid city and state or zip code") {
		input2.value = "";
    }
}

