function openPopup(u,n,w,h,o,c) {
	var l = t = 18;
	if (c) {
		l = (screen.availWidth-w) / 2;
		t = (screen.availHeight-h) / 2;
	}
	return window.open(u,'pop_'+n,'left='+l+',top='+t+',width='+w+',height='+h+',scrollbars='+((o)?o:'1'));
}

function showWallpaper(i, res, lang) {
	var wXh = res.split('x');
	openPopup('/wallpaper/?i='+i+'&res='+res+'&lang='+(lang==undefined ? '/' : '/'+lang+'/'), 'wall'+i+res, wXh[0], wXh[1], false, true);
}

function adjustWindow() {
	var h = $.browser.msie ? document.body.clientHeight : window.innerHeight;
	$('#flashcontent').css('height', Math.max(h, 590)+'px');
}

function fundo(status) {
	if(status){
		var elementFund = document.createElement("div");
		elementFund.className = "fundo";
		elementFund.setAttribute("id","divFundo");
		elementFund.style.width = document.body.offsetWidth + "px";
		elementFund.style.height = document.body.offsetHeight + "px";
		
		$("body").css({padding:"0px"});
		$("body").append(elementFund);
	}else{
		$("div").remove("#divFundo");
		$("body").css({padding:"50px 0 0 0"});
	} 
}

//redirect to fiat sites and register metrics
function registerAndOpenSite(url, metric) {
	atmCLL(metric);
	location.href=url;
}


function openMobile(metric) {
	openPopup('http://200.143.24.213/projetos/fiatpunto/fiatpunto.aspx', 'mobile', '560', '540');
	atmCLL(metric);
}

function openCompatibleMobiles() {
	openPopup('/aparelhos/index.jsp','compatiblemobile',555,485,'scrollbars=0',true);
}