﻿function CheckForEnterReturnSearch(evt)
{
    var key;
    var tempkeyword;
    var rExp;

    if (navigator.appName == 'Netscape')
    {
        key = evt.which ;
    }
    else
    {
	    key = window.event.keyCode;
	}

    if (key == 13)   //user has hit return/enter so search for the words
	{
	    keyword = window.document.forms[0].searchtext.value;
	    
	    if ( keyword != "" ) 
		{
		        if (navigator.appName == 'Netscape') 
			    {
				        rExp = / /gi;  //do a global regular express search and replace for spaces in the string
				        tempkeyword = keyword.replace(rExp, "%20");
				        keyword = tempkeyword;         //netscape can't have spaces in the querystring

		        }
		         
		        rExp = /&/gi;
		        tempkeyword = keyword.replace(rExp, "");
		        keyword = tempkeyword; 
		              
		        rExp = /'/gi;
		        tempkeyword =keyword.replace(rExp, "''");
		        keyword = tempkeyword;      
    	
		        if (navigator.appName != 'Netscape')
		        {
		            event.cancelBubble = true; 
		            event.returnValue = false;
		        }  	
		        
		        fnPerformSearch();
    			
			    if (navigator.appName == 'Netscape')
			    {
		            event.cancelBubble = true; event.returnValue = false;
		        }  	
        }		
	}
}

function clearField(field)
{
    var fieldContent = field.value;
    
	if(fieldContent.substring(0,5) == "Enter")
	{
			field.value = ""
	}
}

function fnPerformSearch(bttnsearch,ddlSearch,location,textsearch)
{
	var searchtext;  
	searchtext = window.document.forms[0].searchtext.value;	
    
	this.document.location.href = "search.aspx?loc=S&sv=" + searchtext;    
}