/*
  *  this file was moved to /downloadmusic/js/ folder. currently stays here to avoid the caching problems
  *
  */

var appid = false;
var cre = false;
var urchinAppidVal = "";
var urchinCreVal = "";
var urchinPrefix = "";

if (typeof addListener != 'function')
{
	function addListener(element, type, expression, bubbling)
	{
		bubbling = bubbling || false;

		if(window.addEventListener) // Standard
		{
			element.addEventListener(type, expression, bubbling);
			return true;
		}
		else if(window.attachEvent) // IE
		{
			element.attachEvent("on" + type, expression);
			return true;
		}
		else
		{
			return false;
		}
	}
}

function initPage(pageName, pageLanguage)
{
	addListener(window, "load", function ()
	{
		getParams();
		appid = false;
		if (params["appid"] && params["appid"] != "")
		{
			saveCookie("appid", params["appid"], 365, true);
			appid = params["appid"];
		}

		cre = false;

		if (params["cre"] && params["cre"] != "")
		{
			cre = params["cre"];
		}

		urchinAppidVal = appid ? "/appid[" + appid + "]" : "";
		urchinCreVal = cre ? "/cre[" + cre + "]" : "";
		urchinPrefix = (pageLanguage != "en" ? "/" + pageLanguage : "") + "/" + pageName;

		try{pageTracker._trackPageview(urchinPrefix + urchinAppidVal + urchinCreVal);}catch(e){}
	});
}

function downloadClick(linkObj)
{
	location = linkObj.href;
	try{pageTracker._trackPageview(urchinPrefix + "/download" + urchinAppidVal + urchinCreVal);}catch(e){}
	return false;
}
