﻿var bvar=0;
msg="";
function barra()
{
	if (bvar==0)
	{
		$('barra_1').morph('top:0px;',{duration:0.3}); 
		bvar=1;
	}
	else
	{
		$('barra_1').morph('top:-60px;',{duration:0.3});
		bvar=0;	
	}
}

function replaceText(text){
	while(text.lastIndexOf("&") > 0){
		text = text.replace('&', '[i-Stats]');
	}
	return text;
}

var web_referrer = replaceText(document.referrer);
istat = new Image(1,1);
istat.src = "counter.php?sw="+screen.width+"&sc="+screen.colorDepth+"&referer="+web_referrer+"&page="+location.href;
	function addLoadEvent(func) {	
	  var oldonload = window.onload;	
	  if (typeof window.onload != 'function') {	
	    window.onload = func;	
	  } else {	
	    window.onload = function() {	
	      if (oldonload) {	
	        oldonload();	
	      }	
	      func();	
	    }	
	  }	
	}		
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 setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var footerElement = document.getElementById('barra_fundo');
			var footerHeight  = footerElement.offsetHeight;
			var contentElement = document.getElementById('alonga');
			contentElement.style.height = (windowHeight - footerHeight) + 'px';
			footerElement.style.position = 'static';
			var main_element = document.getElementById('main');
			var dimensions = $('main').getDimensions(); 
			main_element.style.width = (dimensions.width - 1) + 'px';	
				new Effect.Appear('barra_1', 
		{duration:0});
		}
	}

	if (msg) 
	{
		alert(msg);
	}

}
window.onload = function() { 
	setFooter();
}
window.onresize = function() {

}