function check()
{
	
	if((document.getElementById("q").value=="")||(document.getElementById("q").value==null))
	{
		alert("Enter Search Criteria");
		document.getElementById("q").focus();
		//return false;
	}
	else
	{	
		var v;
		v=strim(document.getElementById("q"));
		
		if(exceptionlist(document.getElementById("q").value)==0)
		{
			alert("Your Query contains ignored words");
			document.getElementById("q").select();
			document.getElementById("q").focus(); 
		
		}	
		else		
		{
			var searchType;
			searchType=document.getElementById("rightmenu_hSubmit").value;
			//alert(searchType);
			if(searchType.toUpperCase() == "Intranetsearch".toUpperCase())
				{	
					document.forms[0].action = "Intranetsearch.aspx?q="+document.getElementById("q").value;
				}
			if(searchType.toUpperCase() == "www.google.com".toUpperCase())
				{	
					document.forms[0].action = "frames.aspx?q="+document.getElementById("q").value+"&sitesearch="+searchType;
				}
			document.forms[0].target="_self";	
			document.forms[0].submit();
		}
	}
}

function searchchange()
{
	//window.open("../newadvanced.asp","AdvSearchPage","height=325,width=600,screenX=0,screenY=0,stat//us=no,toolbar=no,menubar=no,location=no,resizable=no,titlebar=no")
	window.open("../aspxfiles/newadvanced.aspx","AdvSearchPage","height=325,width=600,screenx=100,screeny=100,dependent=yes,resizable=yes,scrollbars=yes,menubar=no,status=no,titlebar=no")
}

function strim(fld)
{
	//Left Trim
	
	str = fld.value;
	//alert(str);
	tempstr="";
	for(i=0;i< str.length;i++)
	{
		if(str.substr(i,1)!=' ')
		{
			tempstr = str.substr(i);
			break;
		}
	}
	
	//Right Trim
	str = tempstr;
	tempstr = "";
	for(i=str.length-1;i>=0;i--)
	{
		if(str.substr(i,1)!=' ')
		{
			tempstr=str.substr(0,i+1)
			break;
		}
	}
	fld.value=tempstr;
}	
 
function exceptionlist(v)
{
	var strarray
	strarray = new Array("about","1","after","2","all","also","3","an","4","and","5","another",
	"as","9","at","0","be","$","because","been","before","being","between","both","but","by","came",
	"can","come","could","did","do","does","each","else","for","from","get","got","has","had","he",
	"have","her","here","him","himself","his","how","if","in","into","is","it","its","just","like",
	"make","many","me","might","more","most","much","must","my","never","now","of","on","only","or",
	"other","our","out","over","re","said","same","see","should","since","so","some","still","such",
	"take","than","that","the","their","them","then","there","these","they","this","those","through",
	"to","too","under","up","use","very","want","was","way","we","well","were","what","when","where",
	"which","while","who","will","with","would","you","your","a","b","c","d","e","f","g","h","i","j",
	"6","any","7","are","8","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");

	for(i=0;i<strarray.length;i++)
	{
		if (strarray[i]==v)
		{ 
			return 0
			break;
		}
	}
	return 1
}

function keypressed()
{
	if(event.keyCode==13)
	{
		event.keyCode=0;
		strim(document.getElementById("q").value);
		//check(); commented by hari ,to be included when search is included 
	}
}

function siteSearch_Click()
{
    //alert(document.getElementById("siteSearch").value);
	document.getElementById("rightmenu_hSubmit").value=document.getElementById("siteSearch").value;
}
function portalSearch_Click()
{
//alert(document.getElementById("portalSearch").value);
	document.getElementById("rightmenu_hSubmit").value=document.getElementById("portalSearch").value;
}

