// clear the Sarch Text & reset the Style       
function styleSearch()
{
	//alert('in the stylesearch func');
	var searchBox = document.getElementById("searchQuery");
	if(searchBox.value == "Type in question")
	{
		searchBox.value = "";
		searchBox.style.color = "#000";
	}
	else if( searchBox.value == "" )
	{
		searchBox.value = "Type in question";
		searchBox.style.color = "#999";
	}
}
function doClick(e)
{
	//the purpose of this function is to allow the enter key to 
	//point to the correct button to click.	    
    var code;
	if (!e) var e = window.event;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
		
    if (code == 13)
       {	       
			if (e.cancelable)	
			{
				e.preventDefault();							
			}
			else
			{			
				e.keyCode=0;			
			}
			pageSearch();
	    }	               
}  
//function to remove special characters from the search query
function filterNum(str) 
{//search
          
          var re = /\?|\&|=|\#/g;
          // remove special character like "?" 
          return str.replace(re, "");
}

// Search Function
function pageSearch()
{
	var lvsearchterm = filterNum(document.getElementById("searchQuery").value);
	//alert(searchterm);
	var reNonSpace = /\S/g;
	var rex = /[^a-zA-Z ]/; 
	// setting the max length for the search query term 
	var searchterm = lvsearchterm.slice(0,75);
	if(searchterm != "Type in question")
	{
	        if ((reNonSpace.test(searchterm)))
	        {		
		       var loc = "/cellcept/Google-Search.htm?q="+ searchterm +"";
		        window.location = loc;		
	        } 
	        else 
	        {
		        alert("Please enter a question.");
		        document.getElementById("searchQuery").focus();
		        return false;
	        }
	 }
	 else
	 {	    
	    //alert('if not the search the site term');
	    alert("Please enter a question.");
		document.getElementById("searchQuery").focus();
		return false;
	 }
}
