var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

var appIdCookieValue = null;

// APPID START

var mlHost = (("https:" == document.location.protocol) ? "https://" : "http://");
var mlHost = mlHost + "www.mlstat.com";
document.write(unescape("%3Cscript src='" + mlHost + "/scripts/appid.js' type='text/javascript'%3E%3C/script%3E"));

window.appidLoaded = function()
{
	appid_hit(2, mlHost);
}

// APPID ENDS

if (typeof readCookie != 'function')
{
	function readCookie(name) 
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) 
		{
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return false;
	}
}


function callGA(utValue, gaAccount)
{
	// APPID START
	
	if ((utValue) && (utValue.indexOf("/download/") > -1))
	{
		lang = utValue.split("/");
		
		if (lang.length >= 3)
			lang = lang[2];
		else
			lang = "";
			
		appid_dl(2, mlHost, lang);
	}
	
	// APPID ENDS
	
	if (appIdCookieValue == null)
		appIdCookieValue = readCookie("appid");
	
	if (!utValue)
		utValue = "";
	if (utValue == "")
	{				
		var subdmnCountry = document.location.hostname.substring(0,document.location.hostname.indexOf("."));
		if (subdmnCountry != "www")
			utValue = "/" + subdmnCountry;
		utValue += document.location.pathname;	
	}
	
	var appIdString = "";
	if (appIdCookieValue)
	{
		appIdString = "appid[" + appIdCookieValue + "]";
		if (utValue.length > 0 && utValue.substring(utValue.length-1) == "/")
			appIdString += "/";
		else
			appIdString = "/" + appIdString;
	}
	
	try
	{
		if (!gaAccount)
			gaAccount = "UA-342615-1";
		var pageTracker = _gat._getTracker(gaAccount);
		pageTracker._initData();
		pageTracker._trackPageview(utValue + appIdString);
	}
	catch(e)
	{		
	}
}