// Flash header Script
// Club Express

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();
	_checkMessageBarDashboard();
}

// function that insert a link over the logo in the header of the page for SEO
function _initLogo()
{
	var oDivLogo = document.getElementById('contentLogo');
	
	if(oDivLogo){oDivLogo.innerHTML = '<a id="mobileGSLogo" href="/" title="Club Express">Club Express</a>';}
}

function _checkMessageBarDashboard()
{
	if(Form1.action.indexOf("Dashboard.aspx") != -1)
	{
		var statusBar = document.getElementById("oDivStatusBar");
		if(statusBar)
		{
			var tableStatusBar = statusBar.firstChild;
			if(tableStatusBar)
			{
				tableStatusBar.style.marginTop = "55px";
			}
		}
	}
}


function openCatalog(sPath, sLang)
{	
							
	var w = 1000 + 32;
 	var h = 700 + 96;
  	
	var wleft = (screen.width - w) / 2;
  	var wtop = (screen.height - h) / 2;
	
	var win = window.open('/ecom_theme/img/medias/catalogue/catalogue.htm?p='+sPath+'&l='+sLang,'mywindow','width=1000,height=700,left='+wleft+'top='+wtop);
	
	if(win && win.moveTo)
	{
	
		try
		{		
			win.moveTo(wleft,wtop);

			win.focus();
		}
		catch(e){}
	}
}



function openPdfFile(sFileName)
{
	
	var sFile = '/ecom_theme/img/medias/catalogue/' + sFileName;

	var w = 900 + 32;
 	var h = 600 + 96;
  	
	var wleft = (screen.width - w) / 2;
  	var wtop = (screen.height - h) / 2;

	var win = window.open(sFile, 'mypdfwindow','width=900, height=600, resizable=yes, left='+wleft+', top='+wtop);
	
	if(win && win.moveTo)
	{
		try
		{
			win.moveTo(wleft,wtop);
		}
		catch(e){}
	}


}

function getQueryVariable(variable) 
{  
	var query = window.location.search.substring(1);  
	var vars = query.split("&");  

	for (var i=0;i<vars.length;i++) 
	{    
		var pair = vars[i].split("=");
		if (pair[0] == variable) 
		{      
			return pair[1];    
		}  
	} 
}
