var cWidth = screen.width; 

function funcreload()
{
 	if (screen.width != cWidth) 
	window.location.reload(); 
}

//******function to remove blank spaces*******//
function trim(value)
{	
	var text = value;
	while ((text.length) && (text.charAt(0) == " ")) 
		text = text.substring(1, text.length);
	while ((text.length) && (text.charAt(text.length-1) == " "))
		text = text.substring(0, text.length-1);
return text;
}
//******End of function to remove blank spaces*******//


function centerWindow() 
{
    if (document.all)
        var xMax = screen.width, yMax = screen.height;
    else
        if (document.layers)
            var xMax = window.outerWidth, yMax = window.outerHeight;
        else
            var xMax = 440, yMax=680;

    var xOffset = (xMax - 200)/3, yOffset = (yMax - 200)/3;

    window.open('fresherform.aspx','myExample7','width=500,height=350,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'');
}


function fn_ChkEnter()
{
	if(window.event.keyCode == 13)
	{

		if(document.forms[0].txtSearch.value.indexOf(" ")== 0)
		{
			alert("Search criterion cannot contain leading spaces.");
			document.forms[0].txtSearch.focus();
			return false;
		}
		if(document.forms[0].txtSearch.value =="")
		{
			alert("Search criterion cannot be left blank.");
			document.forms[0].txtSearch.focus();
			return false;
		}
		else
		{
			funcSearch();	
		}
	}	

}
function fnGeoSite(strGeo)
{
	if(strGeo != "SELECT") 
		window.open(strGeo,'_self'); 
}	

function fnMailPage() 
{ 	
	var strUrl = location.href; 
	window.open('/gen/email.aspx?mailURL='+strUrl,"null","height=450,width=450").moveTo(0,0); 
}

function funcSearch() 
{
	var geoid;
	var strKW = document.forms[0].txtSearch.value; 

	if(strKW.indexOf(" ")== 0)
	{
		alert("Search criterion cannot contain leading spaces.");
		document.forms[0].txtSearch.focus();
		return false;
	}

	if(strKW =="")
	{
		alert("Search criterion cannot be left blank.");
		document.forms[0].txtSearch.focus();
		return false;
	}
	else
	{

		if(trim(window.document.referrer) == '')
		{
			geoid = 0;
		}
		else
		{
			var cmpStr = window.location.pathname;
			if(trim(cmpStr) != '/search/search.aspx')
			{
				geoid = 0;
			}
			else
			{
				var id = document.forms[0].gid.value;
				geoid = id;
			}
		}

		if(geoid!=0)
		{
			document.forms[0].action='/search/search.aspx?txtSearch='+strKW+'&gid='+geoid ; 
			document.forms[0].submit();
		}
		else
		{
			document.forms[0].action='/search/search.aspx?txtSearch='+strKW ; 
			document.forms[0].submit();
		}	
	}
}


