//*******************************************************************************
//'* Purpose  : Commonly used Javascript Functions on the AOME Career Site.
//'* Date     : 17 Oct 2006
//'* Author   : Mohammed Owais
//'* History      Auth        Date	Description
//'  --------     --------    ------- ---------------------------------------------
//'
//'*******************************************************************************
// Start

	
function openCentered (url, width, height, windowName, featureString) 

			{
				if (!windowName)
						windowName = '';
				if (!featureString)
						featureString = '';
				else
						featureString = ',' + featureString;
						var x = Math.round((screen.availWidth - width) / 2);
						var y = Math.round((screen.availHeight - height) / 2);
						featureString = 'left=' + x + ',top=' + y + ',width=' + width 
							+ ',height=' + height + featureString;
				winname = open (url, windowName, featureString);
				
				if (!winname) {
					alert("The window could not be opened. Please check if you have a popup blocker installed that may be preventing the window from opening.");
				}
				else
				{
					winname.focus();
				}				
			}			
			
function ContainOnlyAlphabetsWithSpaces(strValue)
{
		strValue = strValue.toUpperCase();
		for (i=0;i<strValue.length;i++)
		{
			if (strValue.charAt(i)<"A" || strValue.charAt(i) > "Z")
			{
				if (strValue.charAt(i) != ' '){
					return false;
				}	
			}
		}
		return true;
}

function EmailWindow()
{	
	strurl="Email.aspx?Title=" + VacancyName + "&CompanyID="+CompanyID+ "&VacancyID="+VacancyID
	openCentered(strurl, 500,350, "email",'toolbar=no,location=no,status=no,scrollbars=yes,resizable=no')  
}

function OpenWindow(Agent,Relogin)
			{
				var CompanyId = document.getElementById('txtCompanyID').value;
				if (Relogin)
					eurl = "../Frameset.aspx?CompanyID="+ CompanyId;
				else
				{
					var VacancyId = document.getElementById('txtVacancyID').value
					if (CompanyId == 14)
						eurl = "../PrivacyStatement.aspx?CompanyID="+ CompanyId + "&VacancyID=" + VacancyId;
					else
						{
						eurl = "../Frameset.aspx?CompanyID="+ CompanyId + "&VacancyId=" + VacancyId;
						}
				}	
				if (Agent){
					eurl+="&Agent=1"
				}
				awindow = openCentered(eurl, 795, 520, 'application', 'toolbar=yes,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes')	
			}	
					
function openWindow(url, windowName, featureString) 
{
	if (featureString == "")
	{
		featureString = "width=780,height=580,status=yes,scrollbars=yes,minimize=yes,top=10,left=10,resizable=1,toolbar=1,location=1,menubar=1";
	}

	winname = open (url, windowName, featureString);
	if (!winname) {
		alert("The window could not be opened. Please check if you have a popup blocker installed that may be preventing the window from opening. Try holding down the Ctrl key on your keyboard while clicking on the link.");
	}else 
	{
		winname.focus();
	}				
}

	function clearLogin(e)
	{
		if (e.value == "(enter email address)")
			e.value = "";
	}
	
	function defaultLogin(e)
	{	
		if (e.value.length == 0)
		{
			e.value = "(enter email address)";
		}
	}

	function popHelp()
	{
		window.open ("../keywordhelp.aspx?CompanyId=" + document.getElementById("txtCompanyID").value, null, "width=650,height=450,scrollbars=yes");
	}	
//End
