function GetSearch()
	{
		var keySearch,City,State,SearchCityState;
		
		//keySearch=document.getElementsByName("Input")[0].value;
		//SearchCityState=document.getElementsByName("Input2")[0].value; /*Commented By Pulak - 18 August 2008*/
		
		keySearch=document.getElementById("txtSearchTitle").value;
		SearchCityState=document.getElementById("txtSearchArea").value;
		
		City=document.location.toString();
		City=City.replace('http://localhost/MyLocally/','');	
		State=City.substring(0,2);
		City=City.replace(State+'/','');
		City=City.substring(0,City.indexOf("/"))
		window.open("http://Empower_vss/mylocally/Results.aspx?keySearch="+keySearch.replace('&','%26')+"&City="+City+"&State="+State+"&SearchCityState="+SearchCityState,"_self");
	}
function catchEnterTest(e)
{	
	var key;
	if(window.event)
	{key=window.event.keyCode; }
	else
	{key=e.which;}
	if(key==13)
	{
	var keySearch,City,State,SearchCityState;
		
		//keySearch=document.getElementsByName("Input")[0].value;
		//SearchCityState=document.getElementsByName("Input2")[0].value; /*Commented By Pulak - 18 August 2008*/
		
		keySearch=document.getElementById("txtSearchTitle").value;
		SearchCityState=document.getElementById("txtSearchArea").value;
		
		City=document.location.toString();
		City=City.replace('http://localhost/MyLocally/','');	
		State=City.substring(0,2);
		City=City.replace(State+'/','');
		City=City.substring(0,City.indexOf("/"))
		document.frmIndex.action="http://Empower_vss/mylocally/Results.aspx?keySearch="+keySearch.replace('&','%26')+"&City="+City+"&State="+State+"&SearchCityState="+SearchCityState;
		document.frmIndex.submit();
		event.keyCode=0;
	}

}

function catchEnter(e)
{	
	var key;
	if(window.event)
	{key=window.event.keyCode; }
	else
	{key=e.which;}
	if(key==13)
	{
document.getElementById('btnSearch').click(); 
		event.keyCode=0;
	}

}
function AdvncResultMouseMove()
{

	//document.getElementById('Advnc_results').="AdvncResultMouseOver";
	document.getElementById("Advnc_results").style.backgroundColor="Red"
	
	//document.getElementById('prem_results').style.color="Red";
	
	//alert(document.getElementById('prem_results').style.color);
}

function AdvncResultMouseOut()
{
	//document.getElementById('Advnc_results').className="AdvncResultMouseOut";
	document.getElementById("Advnc_results").style.backgroundColor="#FFFFFF"
}


/*function blockDefaultAction(ev)
{
    alert("Raghu");
    if (ev.preventDefault)
        ev.preventDefault();
    else
        ev.returnValue = false;
    if (ev.stopPropagation)
        ev.stopPropagation();
}

function text_onkeydown(ev)
{
alert("Raghu");
    if (ev.keyCode != "13")
        return;

    blockDefaultAction(ev);
    document.getElementById('btnSpan').click();
    //var resultText = document.getElementById("result");
    //resultText.innerHTML += " " + document.getElementById("trymeText").value;
    //if you need to alert better set it in a timeout... firefox seems to postback if it is in the main flow :(
    //setTimeout("alert('this breaks me for some reason, unless in a timeout ;)')",1);
}
*/

/*function EnterKey(txtButton)
{
   if (event.keyCode == 13 && txtButton == "btnSearch")
   {
      event.cancelBubble = true;
      event.returnValue = false;
      document.getElementById(txtButton).click();
      return true;
   }
   else
   {
	  return false;
   }
}
*/
/*function HandleKeyPressEvent(e)
{ // handle i.e. (window.event) and firefox (e) 
	var eventInstance = window.event ? event : e;  
// handle i.e. (charCode) and firefox (keyCode) 
	var unicode = eventInstance.charCode ? eventInstance.charCode : eventInstance.keyCode;

	alert(unicode); 
}
*/

function FillResults()
{
	var strKey = "";
	var fullURL = parent.document.URL;
	if(fullURL.indexOf('&q=')>-1)
    {
		var stIndex = fullURL.indexOf('&q=');
		var endIndex = 0;
		for(var m=stIndex+3; m<fullURL.length; m++)
		{
			if(fullURL.charAt(m) == '&')
			{
				endIndex = m;
				break;
			}
		}
		if(endIndex != 0)
		{
			strKey = fullURL.substring(stIndex + 3, endIndex);
		}
		if(strKey != "")
		{
			var key = "";
			for(var n=0;n<strKey.length;n++)
			{
				strKey = strKey.replace('+',' ');
			}
			for(var n=0;n<strKey.length;n++)
			{
				strKey = strKey.replace('%2B','+');
				strKey= strKey.replace('%2C',',');
				strKey= strKey.replace('%3B',';');
				strKey= strKey.replace('%3D','=');
				strKey= strKey.replace('%2F','/');
				strKey= strKey.replace('%3F','?');
				strKey= strKey.replace('%3A',':');
				strKey= strKey.replace('%26','&');
				strKey= strKey.replace("%27","'");
			}
			document.getElementById("q").value = strKey;
		}
	}
}

function Fill()
{
	try{

	document.getElementById("p").value = "Search For (Business Name or Category)";
	document.getElementById("r").value=document.getElementById("header").innerHTML;

	//document.getElementById("r").value = "Near City (Choose your Location)";


	/*if(City!="")
	{
		document.getElementById("r").value = City;
	}
	else
	{
		document.getElementById("r").value = "Near City (Choose your Location)";
	}*/
}catch(err){}
}

function GetTextboxClearonClick(TextboxID)
{
	if(TextboxID == "p")
	{
		if(document.getElementById("p").value == "Search For (Business Name or Category)")
		{
			document.getElementById("p").value = "";
		}
		else
		{
			document.getElementById("p").value = document.getElementById("p").value;
		}
	}
	if(TextboxID == "r")
	{
		if(document.getElementById("r").value == "Near City (Choose your Location)")
		{
			document.getElementById("r").value = "";
		}
		else
		{
			document.getElementById("r").value = document.getElementById("r").value;
		}
	}
}

function GetTextboxValueonLostFocus(TextboxID)
{
	if(TextboxID == "p")
	{
		if(document.getElementById(TextboxID).value == "" || document.getElementById(TextboxID).value == "undefined")
		{
			document.getElementById("p").value = "Search For (Business Name or Category)";
		}
	}
	if(TextboxID == "r")
	{
		if(document.getElementById(TextboxID).value == "" || document.getElementById(TextboxID).value == "undefined")
		{
			document.getElementById("r").value = "Near City (Choose your Location)";
		}
	}
}

function submitOnEnter(e) 
{
    var ENTER_KEY = 13;
    var code = "";

    if (window.event) // IE
    {
        code = e.keyCode;
    }
    else if (e.which) // Netscape/Firefox/Opera
    {
        code = e.which;
    }

    if (code == ENTER_KEY) 
    {
        doSubmit();
        return false;
    }
}

function doSubmit() 
{
    // omitted logic that sets the action on the form based on the selected option
    //document.frmSearch.submit();
    document.getElementById('btnSearchTest').click();
}

function combine()
{
	var str = "";
	if((document.getElementById("p").value != '' && document.getElementById("p").value != "Search For (Business Name or Category)") && (document.getElementById("r").value != '' && document.getElementById("r").value != "Near City (Choose your Location)"))
	{
		str = document.getElementById("p").value + ' in ' + document.getElementById("r").value;
	}
	else if(document.getElementById("p").value != '' && document.getElementById("p").value != "Search For (Business Name or Category)")
	{
		str = document.getElementById("p").value;
	}
	else if (document.getElementById("r").value != "Near City (Choose your Location)")
	{
		str = document.getElementById("r").value;
	}

	if(str != "")
	{
		document.getElementById("q").value = str;
	}
}

function combineResults()
{
	var str = "";
	if(document.getElementById("q").value != '' && document.getElementById("q").value != "Search For (Business Name or Category)")
	{
		str = document.getElementById("q").value;
	}

	if(str != "")
	{
		document.getElementById("q").value = str;
	}
}