// JavaScript Document

//ag.js
function passTheSearch(txtKeyWords)
{
	//alert("Ad Group: " + txtAdGroup);
	window.location = "search.php?zoom_query=" + txtKeyWords + "&zoom_per_page=10&zoom_and=0&zoom_sort=0";
}///zoom_query=Beef&zoom_per_page=10&zoom_and=0&zoom_sort=0

function fakeSearch(frm)
{
	if(!frm)return false;
	if(trimAll(frm.txt_keywords.value) == "")
	{
		alert("Sorry you need to enter a keyword to search.");
		return false;
	}
	passTheSearch(frm.txt_keywords.value);
	return false;
}

/************************************************
DESCRIPTION: Removes leading and trailing spaces.
PARAMETERS: Source string from which spaces will be removed;
RETURNS: Source string with whitespaces removed.
*************************************************/
function trimAll( strValue ) {

 var objRegExp = /^(\s*)$/;

    //check for all spaces
    if(objRegExp.test(strValue)) 
	{
       strValue = strValue.replace(objRegExp,'');
       if( strValue.length == 0)
	   {
          return strValue;
	   }
    }

   //check for leading & trailing spaces
   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
   if(objRegExp.test(strValue)) 
   {	//remove leading and trailing whitespace characters
       strValue = strValue.replace(objRegExp,'$2');
    }
  return strValue;
}//end trimAll()