// Flash header Script
// Tormont 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();
	_boutonNewsletter();
	_checkPlaceOrder();
	
		if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){
		_checkTabPosition();
	}
}

// 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(oDivLogo){oDivLogo.innerHTML = '<a id="logoTormont" href="/" title="Tormont">Tormont</a>';}
	}
}

function _checkTabPosition()
{
	if(document.getElementById("oucProductDescription_oTabs"))
	{
		document.getElementById("oucProductDescription_oTabs").style.marginBottom = "-1px";
	}
}

function _boutonNewsletter()
{
	if(document.getElementById("oucLeftMenu_oucNewsletterSubscription_btnSubmit"))
	{
		if(EcommercePageCulture == "fr-CA"){document.getElementById("oucLeftMenu_oucNewsletterSubscription_btnSubmit").src = "/ecom_theme/img/btn/fr-ca/send_orange.gif";}
		else{document.getElementById("oucLeftMenu_oucNewsletterSubscription_btnSubmit").src = "/ecom_theme/img/btn/en-us/send_orange.gif";}
	}
}

function changeculture()
{
	if(EcommercePageCulture == "fr-CA")
	{
		window.location = _skCMSCurrentPage_enus;
	}
	else
	{
		window.location = _skCMSCurrentPage_frca;
	}
}

function _checkPlaceOrder(){
	if(document.getElementById("oucLeftMenu_oucMenuMyAccount_trCheckout"))
	{
		if(document.getElementById("oucLeftMenu_oucMenuMyAccount_trCheckout").style.display == "inline")
		{
			document.getElementById("oucLeftMenu_oucMenuMyAccount_trCheckout").style.display = "table-row";
		}
	}
}
