function someBanner()
{
	var b = document.getElementById("banner-natal");
	b.style.display = "none";
	b.parentNode.removeChild(b);
}

function enviaForm()
{
	var f = $("formNewsletter");
	var n = f.nome.value;
	var e = f.email.value;
	if(f.nome.initVal == undefined || n == f.nome.initVal){
		f.nome.value = "Sem Nome";
	}
	if(n.length > 0 && e.length > 0	&& e.indexOf("@") > -1){
		f.submit();
	} else {
		f.email.style.borderColor = "#FF0000";
		f.email.style.color = "#FF0000";
		f.email.value = "NECESSÁRIO";
		f.email.focus();
	}
}

function abreTrabalhos(o)
{
	window.open(o.href, "trabWin", "width=200px, height=360px, scrollbars=yes, status=yes, left=50, top=50");
}

function abreNews(o)
{
	window.open(o.href, "newsWin", "width=363px, height=360px, scrollbars=yes, status=yes, left=50, top=50");
}

function alternateRows(o, a, st)
{
	var iColor = 0, l = o.childNodes.length, oc = o.childNodes;
	for(var i=0; i<l; i++)
	{
		if(oc[i].nodeType == 1)
		{
			var obj = oc[i];
			if(st != undefined)
			{
				obj = $t("a", oc[i])[0];
			}
			obj.style.backgroundColor = a[iColor];
			iColor = iColor == 0 ? 1 : 0;
		}
	}
}

var lDados, data, loadTrabalho;
_c(function(){

	/*addEvent($("nome"), "focus", initValue);
	addEvent($("email"), "focus", initValue);
	addEvent($("btOk"), "click", enviaForm);*/
	alternateRows($("rodape-news-list"), ["#EEE", "#DDD"]);

	for(var i=0; i<document.links.length; i++){
		var a = document.links[i];
		if(a.rel && a.rel == "blank"){
			a.target = "_blank";
		}
	}

	lDados = Ajax.getTransport();
	if(lDados)
	{
		loadTrabalho = function(o)
		{
			$("carregando").style.visibility = "visible";
			lDados.open("GET", "burn.trabalho.php?id=" + o.href.toString().split("idtrabalho=")[1], true);
			lDados.onreadystatechange = function(){
			if(lDados.readyState == 4 && (lDados.status == 200 || lDados.status == 0))
			{
					data = eval(' ( ' + lDados.responseText + ' ) ');
					
					var c = $("trabalho-desc"), a = $("linkDesc"), t = $t("SPAN", c), img = $("imgPort");
					t[0].innerHTML = data.nome;
					t[1].innerHTML = data.desc;
					
					a.innerHTML = a.href = "http://" + data.url + "/";
					
					img.src = data.img;
					img.alt = data.nome;
					img.onload = function(){ $("carregando").style.visibility = "hidden"; }
					
					var s = $("swfInf");
					s.setInf(data.nome, data.data);
				}
			}
			lDados.send(null);
		}
		
		$("#portifa-menu li a").apply("e", "click", function(e){
			
			if(!Browser.isOpera())
			{
				loadTrabalho(this);
				
				Event.cancel(e);
				return false;
			}
			else
			{
				return true;
			}		
			
		});
	}
	
	var btMaisClientes = $("btMaisClientes");
	
	if(empty(btMaisClientes)) return;

	btMaisClientes.e("click", function(e){
		
		abreTrabalhos(this);
		
		Event.cancel(e)
		return false;
	});		
	
	$("#rodape-news-list li a").apply("e", "click", function(e){
		
		abreNews(this);
		
		Event.cancel(e)
		return false;
	});

});
