// Flash header Script
// Blank 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();
	_initLeftMenuMyAccount();
	_initTopSection();
	_initLogoSSL();
}

// function that insert a link over the logo in the header of the page for SEO
function _initLogo()
{
	var oDivLogo = document.getElementById('contentLogo');
	if(EcommercePageCulture == "fr-CA")
	{
		if(oDivLogo){oDivLogo.innerHTML = '<a id="votreLogo" href="/" title="Friberg Fine Art">Friberg Fine Art</a>';}
	}
	else
	{
		if(oDivLogo){oDivLogo.innerHTML = '<a id="votreLogo" href="/" title="Friberg Fine Art - Serving a cause through Fine Art">Friberg Fine Art - Serving a cause through Fine Art</a>';}
	}
		
}


function _initTopSection()
{
	oDivOnlineSupport = document.getElementById('scK8Eg');
	oDivSearch = document.getElementById('contentSearchAvailable');
	oDivCustomTopNavig = document.getElementById('customTopNavig');
	oDivCulture = document.getElementById('culture');
	
	if(!oDivSearch){oDivSearch = document.getElementById('contentSearchUnavailable');}
	
	if(oDivCulture)
	{
		oDivCulture.style.display = "none";
		oDivCulture.style.visibility = "hidden";
	}

	if(document.getElementById('oucLeftMenu_oucMenuMyAccount_lblCustomerName'))
	{
		oDivCustomTopNavig = document.getElementById('customTopNavigLogued');
	}


	if(oDivSearch)
	{

		if(oDivOnlineSupport)
		{
			oDivOnlineSupport.style.position = "relative";

			if(document.all)
			{
				oDivOnlineSupport.style.top = -(getPosition(oDivOnlineSupport).y) + ((getPosition(oDivSearch).y) - 4); //74
			}
			else
			{
				
				if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1)
				{
					oDivOnlineSupport.style.top = -(getPosition(oDivOnlineSupport).y) + ((getPosition(oDivSearch).y) - 8); //78
				}
				else if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1) 
				{
					oDivOnlineSupport.style.top = -((oDivOnlineSupport.offsetTop - oDivSearch.offsetTop) + 7); //78
				}

			}

			oDivOnlineSupport.style.left = 697;

			oDivOnlineSupport.style.display = "block";
			oDivOnlineSupport.style.visibility = "visible";

		}

		if(oDivCustomTopNavig)
		{	
	

			oDivCustomTopNavig.style.display = "block";
			oDivCustomTopNavig.style.visibility = "visible";		
			oDivCustomTopNavig.style.position = "relative";

			if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1)
			{
				oDivCustomTopNavig.style.top = -(oDivCustomTopNavig.offsetTop - oDivSearch.offsetTop);;
			}
			else
			{
				oDivCustomTopNavig.style.top = -(getPosition(oDivCustomTopNavig).y) + ((getPosition(oDivSearch).y))
			}

			oDivCustomTopNavig.style.left = 807;

					
		}

	
	}

}


function _initLeftMenuMyAccount()
{
	oLeftMenu = document.getElementById('oucLeftMenu_oucMenuMyAccount_oDivMenuMyAccount');
	oLeftMenuCustomer = document.getElementById('oucLeftMenu_oucMenuMyAccount_lblCustomerName');

	if(oLeftMenuCustomer)
	{
		oLeftMenu.style.display = "block";
		oLeftMenu.style.visibility = "visible";
	}
	else
	{
		oLeftMenu.style.display = "none";
		oLeftMenu.style.visibility = "hidden";
	}
}

function _initLogoSSL()
{
	oDivLogoSSL = document.getElementById('logoSSL');
	oDivFooter = document.getElementById('footer');

	if(oDivLogoSSL)
	{
		if(oDivFooter)
		{
			oDivFooter.innerHTML += oDivLogoSSL.innerHTML;

			oDivLogoSSL.style.display = "none";
			oDivLogoSSL.style.visibility = "hidden";
		}
	}

}
