function getLanguage(strLocale){
	if(strLocale == "en_au") {
		openAustralia();
	}
	else {
		cookieManager.setCookie(cookieName,strLocale);
		document.location.href="/nikeproeurope/?l="+strLocale+"&ref=http://www.nike.com/nikeproeurope/gateway/";
	}
}

//== DOWNLOADS ==
function getDownload(strLanguage,strURL,strType) {
	var iHeight = "";
	var iWidth  = "";
	
	if(strType == "zip")
  	{
		iWidth	= "400";
		iHeight = "100";
  	} else if (strType == "exe"){
		iWidth	= "400";
		iHeight = "100";
	} else {
		iWidth	= "400";
		iHeight = "100";
	}
  	
	var strGoTo 	= "/freeeurope/download.jsp?l=" + escape(strLanguage) + "&url=" + escape(strURL);
	strParams 	= "scrollbars=yes,resizable=yes,status=0,height=" + iHeight + ",width=" + iWidth;
	downloadWin 	= window.open(strGoTo,"downloadWin",strParams);
	downloadWin.moveTo(100,100);
	downloadWin.focus();
}

function openPopup(strGoTo,iWidth,iHeight,strScrollbars,strWinName){

	if (strScrollbars == 'yes'){
		iWidth += 16;
	}
	strParams = "scrollbars=" + strScrollbars + ",status=0,height=" + iHeight + ",width=" + iWidth;
	newWindow = window.open(strGoTo,strWinName,strParams);
	var w = screen.availWidth;
	var h = screen.availHeight;
	if (!isNaN(w) && w != null){
		var leftPos = (w-iWidth)/2;
		var topPos = (h-iHeight)/2;
		newWindow.moveTo(leftPos,topPos);
	} else {
		newWindow.moveTo(1,1);
	}
	newWindow.focus();
	newWindow = null;
}

function getWallpaper(strURL,iWidth,iHeight){
	popupLoc = 'wallpaper.jsp?url=' + strURL + '&width=' + iWidth + '&height=' + iHeight;
	openPopup(popupLoc,iWidth,iHeight,'yes','downloadwallpaper');
}

function centerWin(iWidth,iHeight){
	var w = screen.availWidth;
	var h = screen.availHeight;
	if (!isNaN(w) && w != null){
		var leftPos = (w-iWidth)/2;
		var topPos = (h-iHeight)/2;
		window.moveTo(leftPos,topPos);
	} else {
		window.moveTo(1,1);
	}
}

function getExternalLink(strLinkId,strLocale){
	var strURL = "";
	switch (strLinkId){
		case 'nikeid':
			strURL = 'http://nikeid.nike.com/nikeid/index.jhtml?ref=http://nikeproeurope.com#collection,free';
			window.open(strURL, strLinkId, 'width=800,height=600,resizable=1,titlebar=1,menubar=1,toolbar=1,scrollbars=1,status=1')
		break;

	}
}

// opens wallpapers for nikeproeurope
// e.g. openWallpaper('ronaldo','0101','800x600');

function openWallpaper(athlete,id,dimensions) {
	if (dimensions == '1024x768') {
		openPopup('/nikeproeurope/wallpaper/prowp_'+athlete+'_'+dimensions+'.jpg',1024,768,'no','wallpaper');
	} else {
		openPopup('/nikeproeurope/wallpaper/prowp_'+athlete+'_'+dimensions+'.jpg',800,600,'no','wallpaper');
	}
}

function getMp3(strLocale,strPath){
	getDownload(strLocale,strPath,'mp3');
}

// provide gateway with click throughs

function openAustralia() {
	document.location.href="http://www.nikepro.com.au/";
}

function openChina() {
	document.location.href="http://www.nike.com.cn/nikepro/";
}

function openHongKong() { 
	document.location.href="http://www.nike.com.hk/";
}

function openJapan() {
	document.location.href="http://www.nike.jp/";
}

function openKorea() {
	document.location.href="http://www.nike.co.kr/";
}

function openMalaysia() { 
	document.location.href="http://www.nike.com.my/";
}

function openNewZealand() {
	document.location.href="http://www.nike.co.nz/";
}

function openPhilippines() {
	document.location.href="http://www.nike.com.ph/";
}

function openSingapore() {
	document.location.href="http://www.nike.com.sg/";
}

function openTaiwan() { 
	document.location.href="http://www.nike.com.tw/";
}

function openThailand() {
	document.location.href="http://www.nike.in.th/";
}