function openClientLogin()
{
	clientLogin = window.open("http://www.harrisonassessments.com/servlet/HI?ENTITY=CL", "clientLogin", "HEIGHT=600,WIDTH=800,resizable,scrollbars");
}

function openDistributorLogin()
{
	distributorLogin = window.open("http://www.harrisonassessments.com/servlet/HI?ENTITY=DI", "distributorLogin", "HEIGHT=600,WIDTH=800,resizable,scrollbars");
}

function openTalentSolutionsLogin()
{
	ret = window.open("https://ha8.harrisonassessments.com/customer/jobFitLogin.do", "", "HEIGHT=660,WIDTH=1000,scrollbars=yes,resizable=no"); 	
}

function FlashPopup() {
	window.open( "http://www.harrisonassessments.com/main/presentation/FlashPresentation.html", "myWindow", 
	"status = 1, height = 555, width = 800, resizable = 0" )
}


var requestSent = false;

function validateAndSubmit()
{
	errorMessage = "";

	if (document.data.NAME.value == "")
	{
		errorMessage = "Please enter your Name." + "<br>";
	}

	if (document.data.EMAIL.value == "")
	{
		errorMessage += "Please enter your Email Address." + "<br>";
	}
	
	if ((document.data.COUNTRY.value == "United States") && (document.data.STATE.value == ""))
	{
		errorMessage += "When in the US, we require you to enter your state so we can best handle your enquiry. Please enter your state." + "<br>";
	}

	if (document.data.COMMENTS.value.indexOf("www") != -1 || document.data.COMMENTS.value.indexOf("http") != -1)
	{
		errorMessage += "We do not allow URL's to be sent in the mail as it encourages spammers. If you would like to sent us a legitimate URL, then you will be given that chance when we respond to your email.";
	}

	if (errorMessage.length > 0)
	{
		generateErrorPage(errorMessage);
		return;
	}

	requestSent = true;
	document.data.submit();
}

function validateAndSubmitFreeReport()
{
	errorMessage = "";

	if (document.data.NAME.value == "")
	{
		errorMessage = "Please enter your Name." + "<br>";
	}
	
	if (document.data.COMPANY_NAME.value == "")
	{
		errorMessage += "Please enter your Company Name." + "<br>";
	}
	
	if (document.data.NUMBER_OF_EMPLOYEES.value == "")
	{
		errorMessage += "Please enter your Number of Employees." + "<br>";
	}

	if (document.data.EMAIL.value == "")
	{
		errorMessage += "Please enter your Email Address." + "<br>";
	}
	
	if ((document.data.COUNTRY.value == "United States") && (document.data.STATE.value == ""))
	{
		errorMessage += "When in the US, we require you to enter your state so we can best handle your enquiry. Please enter your state." + "<br>";
	}
	
	if (document.data.COMMENTS.value.indexOf("www") != -1 || document.data.COMMENTS.value.indexOf("http") != -1)
	{
		errorMessage += "We do not allow URL's to be sent in the mail as it encourages spammers. If you would like to sent us a legitimate URL, then you will be given that chance when we respond to your email.";
	}

	if (errorMessage.length > 0)
	{
		generateErrorPage(errorMessage);
		return;
	}

	requestSent = true;
	document.data.submit();
}

function generateErrorPage(errorMessage)
{
	errorWindow = window.open("", "errorWin", "toolbar=no,location=no,scrollbars=yes,HEIGHT=50,WIDTH=350")
	errorWindow.focus();
	errorWindow.document.write("<html><head><title>Error Message<\/title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><\/head><body><table border=\"0\" width=\"100%\" height=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr align=\"center\" valign=\"middle\"><td>" + errorMessage + "</td></tr></table></body\></html\>");
	errorWindow.document.close()
}


function openWindow(URL)
{
	newWindow = window.open(URL, "newWindow", "fullscreen=yes, scrollbars=auto");
}

function forward(URL)
{
	document.location.href = URL;
}

function setLanguage()
{
	if (checkLanguage())
	{
		if (navigator.appName == 'Netscape')
		var language = navigator.language;
		else
		var language = navigator.browserLanguage;
		
		if (language.indexOf('zh') > -1)
		{
			if (language.indexOf('cn') > -1)
			{
				document.location.href = 'http://www.harrisonassessments.com.cn/index.html';
			}
			else
			{
				document.location.href = 'http://www.harrisonassessments.com.tw/index.html';
			}
		}
		else
		if (language.indexOf('id') > -1)
		{
			document.location.href = 'http://www.harrisonassessments.co.id/index.html';
		}
		else
		if (language.indexOf('de') > -1)
		{
			document.location.href = 'http://www.harrisonassessments.de/index.html';
		}
	
	}
}

function checkLanguage()
{
	var idx = document.URL.indexOf('?');
	if (idx != -1)
	{
		return false;
	}
	else
	{
		return true;
	}
	return true;
}
