// Flash header Script
// JBNails theme

if(window.attachEvent) //IE
{
	window.attachEvent("onload", _initPageFunction);
}
else if(window.addEventListener) //DOM
{
	window.addEventListener("load", _initPageFunction, false);
}

// Function used to initialize all functions used in page
function _initPageFunction()
{
	_initLogo();
	_setAjaxDiv();
	_setRegister();
}

// function that insert a link over the logo in the header of the page for SEO
function _initLogo()
{
	if(document.getElementById('contentLogo'))
	{
		var oDivLogo = document.getElementById('contentLogo');
		if(EcommercePageCulture == "fr-CA")
		{
			if(oDivLogo){oDivLogo.innerHTML = '<a id="logoJBNails" href="/" title="JB Nails">JB Nails</a>';}
		}
		else
		{
			if(oDivLogo){oDivLogo.innerHTML = '<a id="logoJBNails" href="/" title="JB Nails">JB Nails</a>';}
		}
	}
}

function _checkTabPosition()
{
	if(document.getElementById("oucProductDescription_oTabs"))
	{
		document.getElementById("oucProductDescription_oTabs").style.marginBottom = "-1px";
	}
}

function _setAjaxDiv(){
	if(document.getElementById("oDivAjax"))
	{
		document.getElementById("oDivAjax").style.width = "596px";
	}
}

function changeCulture()
{
	if(EcommercePageCulture == "fr-CA")
	{
		window.location = _skCMSCurrentPage_enus;
	}
	else
	{
		window.location = _skCMSCurrentPage_frca;
	}
}

function _setRegister()
{
	if(document.getElementById("culture") && !document.getElementById("oucLeftMenu_oucMenuMyAccount_lnkLogoff"))
	{
		var sCultureHTML = document.getElementById("culture").innerHTML;
		if(EcommercePageCulture == "fr-CA")
		{
			var sNewCultureHTML = "<a href='/CreateAccount.aspx' class='cultureLink' title=\"S'inscrire\" id='headerSubscribeLink'>S'inscrire</a><span class='cultureText'>&nbsp;&nbsp;|&nbsp;&nbsp;</span>";
		}
		else
		{
			var sNewCultureHTML = "<a href='/CreateAccount.aspx' class='cultureLink' title='Register' id='headerSubscribeLink'>Register</a><span class='cultureText'>&nbsp;&nbsp;|&nbsp;&nbsp;</span>";
		}
		
		sNewCultureHTML += sCultureHTML;
		document.getElementById("culture").innerHTML = sNewCultureHTML;
	}
}
