var gaId = "UA-2209546-9";
window.onload = init;
function analytics()
{
	if (!gaId) return null;
	gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	loadScript(gaJsHost + "google-analytics.com/ga.js", alalyticsLoaded);
}
function alalyticsLoaded()
{
	if (!gaId) return null;
	var pageTracker = _gat._getTracker(gaId);
	pageTracker._trackPageview();
}
function loadScript(url, aFunction)
{
	var e = document.createElement("script");
	e.onreadystatechange= function() 
	{
    	if ((this.readyState == 'completed' || this.readyState == 'loaded') && !this.loadScriptDone) 
    	{
        	this.loadScriptDone = true;
        	aFunction();
       	}
    }
    e.onload= aFunction;
	e.type = "text/javascript";
	e.src = url;
	document.getElementsByTagName("head")[0].appendChild(e);
	return e;
}
function init()
{
	//setFooterHeight();
	sifr();
	
	//call google analytics last of all!!
	analytics();
}

function setFooterHeight()
{
	var f = document.getElementById('footer');
	var c = document.getElementById('container');
	f.style.marginTop = 5+(getWindowHeight()-c.offsetHeight)+'px';
}

function getWindowHeight()
{
	var windowHeight = 0;
	if (typeof(window.innerHeight)=='number')
	{
		windowHeight = window.innerHeight;
	}
	else
	{
		if (document.documentElement && document.documentElement.clientHeight)
		{
			windowHeight = document.documentElement.clientHeight;
		}
		else
		{
			if (document.body && document.body.clientHeight)
			{
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function sifr()
{
	if(typeof sIFR == "function")
	{
        // sColor:"#aaa798"
        // sLinkColor:"#aca99a"
		sIFR.replaceElement(named({sSelector:"h2", sFlashSrc:"/assets/swf/sifr.swf", sColor:"#6d6759", sLinkColor:"#6d6759", sBgColor:"#ece9da", sHoverColor:"#aca99a", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=0",sWmode:"transparent"}));
	};
}
