﻿
	function QuickSearch(){
		var str=document.QSearch.Searchkeys.value;
		str=str.replace(/^\s+/,"");
		document.QSearch.Searchkeys.value=str;
		
		//alert("Test:"+str);
		
		if(str.length==0 || str=="Search")
		{
				alert("Please enter a Keyword to search");
				document.QSearch.Searchkeys.value="";
				document.QSearch.Searchkeys.focus();
				return false;
		}
		else if(!checkChar(str))
		{
			return false;
		}
		else
		{
			document.QSearch.Searchkeys.value=str;
			document.QSearch.action="/SearchResults.aspx?q="+str;
			document.QSearch.submit();
			return true;
		}
	}
	
	function checkChar(str)
	{
	
		var Rule1= /^[a-zA-Z0-9]+|^[.][a-zA-Z]+/;
		var Rule2 = /[^a-zA-Z0-9,+#.\s]/;
		var Rule3=/^\d+$/;
		if(!str.match(Rule1))
		{
			alert("Please enter alphanumeric text only");
			document.QSearch.Searchkeys.value="";
			return false;
		}
		else if(str.match(Rule2))
		{
			alert("'+' ',' '#' '.' only allowed as a special character");
			document.QSearch.Searchkeys.value="";
			return false;
		}else if(str.match(Rule3))
		{
			alert("Text should be alphanumeric ");
			document.QSearch.Searchkeys.value="";
			return false;
		}
		return true;
	}
					
	function MM_openBrWindow(theURL,winName,w,h) 
	{ //v2.0
		var left = (screen.width/2)-(w/2);
		var top = (screen.height/2)-(h/2);
		window.open(theURL,winName,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', 			height='+h+', top='+top+', left='+left);
	}

