try
   {
	window.onerror = null 
   	var temp = parent.document.location.href;	  
   }
   catch(errorObject)
   {
   	var csspath = "<link rel=\"stylesheet\" type=\"text/css\"  href=\"/global/content.nsf/resources/Global_CSS_Files/$file/eyonlineintegrationcareers.css\" />";
	document.write (csspath);
	var eyonlinesource = "yes";
   }
function contactUs(Sender)
{
window.open('https://forms.ey.com/global/content.nsf/DContactus?Openform&EmailId='+Sender+'&Site='+Site+'&URL='+location.href,"sWin",'width=770,height=700,screenX=0,screenY=0,alwaysRaised=yes,toolbar=no,scrollbars=yes,status=no');
}
//------ Hit Count Code-----------
var top1;
var msgPrompt ;

switch (Site)
{
case "US":
msgPrompt  = "Your Opinion is Requested."  + "\n" + "Ernst & Young is developing its website to provide maximum value to visitors. Your participation in this short website evaluation survey will allow us to tailor the ey.com site to your needs. The results will be analyzed by a leading, independent market research firm and will be kept strictly confidential";
break;
case "Australia":
msgPrompt  = "Give us your opinion."  + "\n" + "Ernst &Young is developing its website to provide maximum value to visitors. Your participation in this short website evaluation survey will allow us to tailor the EY.com site to your needs. The results will be analysed by a leading, independent market research firm and will be kept strictly confidential";
break;
case "China_E":
msgPrompt  = "Give us your opinion."  + "\n" + "Ernst &Young is developing its website to provide maximum value to visitors. Your participation in this short website evaluation survey will allow us to tailor the EY.com site to your needs. The results will be analysed by a leading, independent market research firm and will be kept strictly confidential";
break;
case "UK":
msgPrompt  = "Give us your opinion."  + "\n" + "Ernst & Young is developing its website to provide maximum value to visitors. Your participation in this short website evaluation survey will allow us to tailor the ey.com to your needs. The results will be analyzed by a leading, independent market research firm and will be kept strictly confidential";
break;
case "France":
msgPrompt  = "Donnez votre avis."  + "\n" + "Nous développons notre site afin de vous apporter le maximum de valeur ajoutée. En nous donnant votre avis au travers de cette enquete rapide, nous pourrons ainsi améliorer notre service et faire évoluer notre site en fonction de vos besoins. Les résultats seront analysés par une agence indépendante et resteront strictement confidentiels.";
break;
case "Germany":
msgPrompt  = "Ihre Meinung zählt."  + "\n" + "Ernst & Young entwickelt seine Website kontinuierlich weiter. Mit Ihrer Teilnahme an unserer kurzen Online-Umfrage helfen Sie uns, unsere Website noch besser an Ihre Bedürfnisse anzupassen. Die Ergebnisse werden von einem unabhängigen  Marktforschungsinstitut analysiert und streng vertraulich behandelt..";
break;
case "International":
msgPrompt  = "Give us your opinion."  + "\n" + "Ernst & Young is developing its website to provide maximum value to visitors. Your participation in this short website evaluation survey will allow us to tailor the EY.com site to your needs. The results will be analyzed by a leading, independent market research firm and will be kept strictly confidential";
break;
default : 
msgPrompt  = "Give us your opinion."  + "\n" + "Ernst & Young is developing its website to provide maximum value to visitors. Your participation in this short website evaluation survey will allow us to tailor the EY.com site to your needs. The results will be analyzed by a leading, independent market research firm and will be kept strictly confidential";
}
function BuildXMLVariables() 
{ 
	   	var objDOM = new ActiveXObject("Microsoft.XMLDOM")   
		RootEl = objDOM.createNode(1, "RootElement", "")
		objDOM.documentElement = RootEl
		objHeaders = objDOM.createNode(1, "S", "")
		objHeaders.text = Site;
		RootEl.appendChild(objHeaders)
		objHeaders = objDOM.createNode(1, "PT", "")
		objHeaders.text = pageTitle;
		RootEl.appendChild(objHeaders)
		return objDOM;
}
function runAgent(strAgentName, strXMLvariables) 
{
    objHTTP = new ActiveXObject("Microsoft.XMLHTTP"); 
    objHTTP.open("POST", strAgentName, false, "", ""); 
	objHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
	objHTTP.send(strXMLvariables); 
	resp = objHTTP.responseText;	
	objHTTP = null; 
	return resp; 
}

function setCookie(crick, value, expdate)
 {
curCookie = crick + "=" + escape (value) +"; path=/";
document.cookie = curCookie;
}

function strTrim(FieldValue)
{
 return FieldValue.replace(/^\s+/,'').replace(/\s+$/,'');
}

function HitCount()
{
if (document.domain != "www.ey.com" || browserName != 'Microsoft Internet Explorer')
{
return false;
}

top1= self.screenTop;
returnedText = runAgent("http://" + document.domain + "/Global/content.nsf/aHitCount?OpenAgent", BuildXMLVariables());
var Arrstr = returnedText.split("~")
	if ( returnedText.length > 3)
     {	
          setCookie('htcookie_ey_online_survey_site',strTrim(Arrstr[0]));
          setCookie('htcookie_ey_online_survey_count',strTrim(Arrstr[1]));
          setCookie('htcookie_ey_online_survey_url',strTrim(Arrstr[2]));
          setCookie('htcookie_ey_online_survey_Lcount',1);
          setCookie('htcookie_ey_online_survey_pageTitle',pageTitle);
          setCookie('htcookie_ey_online_survey_window',top1);
      }
	else 
	{
		//alert ("You Are Not Lucky")	
	}
}
//---------End of Hit count Code----------------------
//---------Page Unload Code Start----------------------
function getCookie(name) 
{
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
	if (begin == -1)
	{ begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else
	begin += 2;
	var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return (dc.substring(begin + prefix.length, end));
}
function BuildXMLVariables_Reverse()
{
	var objDOM = new ActiveXObject("Microsoft.XMLDOM")
	RootEl = objDOM.createNode(1, "RootElement", "")
	objDOM.documentElement = RootEl
	objHeaders = objDOM.createNode(1, "S", "")
	objHeaders.text = Site;
	RootEl.appendChild(objHeaders)
	objHeaders = objDOM.createNode(1, "PT", "")
	objHeaders.text = getCookie("htcookie_ey_online_survey_pageTitle")
	RootEl.appendChild(objHeaders)
	objHeaders = objDOM.createNode(1, "rcount", "")
	objHeaders.text = getCookie("htcookie_ey_online_survey_count")
	RootEl.appendChild(objHeaders)
	return objDOM;
}
function unloadHitCount()
{
if (document.domain != "www.ey.com" || browserName != 'Microsoft Internet Explorer')
{
return false;
}
if (getCookie("htcookie_ey_online_survey_site") == null )
	{
	//alert("No cookie - No action done")
	}
else
	{
	a = getCookie("htcookie_ey_online_survey_window")
	b = self.screenTop
	 	if ( a == b)
		{
		CurrentLcount =getCookie("htcookie_ey_online_survey_Lcount")
			if (CurrentLcount == 2)
			{
			var x=window.confirm(msgPrompt)
				if (x)
				{
				var txt = getCookie("htcookie_ey_online_survey_url")
				txt = txt.substr(3,txt.length-1)
				txt = txt.replace("%3A",":")
				setCookie('htcookie_ey_online_survey_Lcount',"");
				setCookie('htcookie_ey_online_survey_Refused',"y");
				window.open(unescape(txt))
				return (true)
				}
				else
				{
				setCookie('htcookie_ey_online_survey_Lcount',"");
				setCookie('htcookie_ey_online_survey_Refused',"y");
				var returnedText1;
				returnedText1 = runAgent("http://" + document.domain + "/Global/content.nsf/aHitCountReverse?OpenAgent", BuildXMLVariables_Reverse());
				}
			}
			else
			{
			if (getCookie('htcookie_ey_online_survey_Refused') == null || getCookie('htcookie_ey_online_survey_Refused' != "y"))
			setCookie('htcookie_ey_online_survey_Lcount',parseInt(CurrentLcount)+1);
			}
		}
	else
		{
		if (getCookie("htcookie_ey_online_survey_Lcount") != null)
		{
		var x=window.confirm(msgPrompt)
			if (x)
			{
			var txt = getCookie("htcookie_ey_online_survey_url")
			txt = txt.substr(3,txt.length-1)
			txt = txt.replace("%3A",":")
			window.open(unescape(txt))
			}
			else
			{
			var returnedText2
			returnedText2 = runAgent("http://" + document.domain + "/Global/content.nsf/aHitCountReverse?OpenAgent", BuildXMLVariables_Reverse());
			}
		}
		}
	 }
}

//---to be called on all the layout forms, unload event -----------------
