window.onload = _load;

function _load(){
	externalLinks();
	getLinks();
	getInputLogin();
	autoScroll();
	
	_uacct = "UA-416988-31";
	urchinTracker();
}

function getLinks(){
	var el, bc;

	el = document.getElementsByTagName("a");
	for(i=0; i < el.length; i++){
		if(el[i].rel == "clickMap"){
			el[i].onclick = function ifonclick(){ expand(this.id); return false; };
		}
	}
	
	if(document.getElementById("esconderBanner") != null){
		bc = document.getElementById("esconderBanner");
		bc.onclick = function(){ escondeBanner(); return false; };
	}
}

function expand(id){
	var elExpand, idExpand;
	
	idExpand = "ctrl_" + id;
	if(document.getElementById(id) != null){
		elId = document.getElementById(id);
		elExpand = document.getElementById(idExpand);
		cook = "ctrl_" + id;
		
		//alert(elExpand.style.display);
		
		if(elExpand.style.display == 'none'){
			elExpand.style.display = "block";
			elId.innerHTML = "<span>[-]</span>";
			elId.setAttribute("title", "Recolher links desta Área.");
			elId.className = "off";
			SetCookie(cook, "block");
		} else {
			elExpand.style.display = "none";
			elId.innerHTML = "<span>[+]</span>";
			elId.setAttribute("title", "Mostrar links para conteúdo desta Área.");
			elId.className = "on";
			SetCookie(cook, "none");
		}
	}
}

function getInputLogin(){
	var cpf, senha, busca;
	
	if(document.getElementById('inome') != null){
		nome = document.getElementById('inome');
		email = document.getElementById('iemail');
		
		nome.onclick = function(){
			if(nome.value == "Seu nome")
				nome.value = "";
		}
		nome.onblur = function(){
			if(nome.value == "")
				nome.value = "Seu nome";
		}
		
		email.onclick = function(){
			if(email.value == "Seu e-mail")
				email.value = "";
		}
		email.onblur = function(){
			if(email.value == "")
				email.value = "Seu e-mail";
		}
	}
}

function escondeBanner(){
	var banner;
	
	banner = document.getElementById("banner_flutuante");
	banner.style.display = "none";
}

function autoScroll(){
	var link = window.location.href;

	if(link.indexOf("#") == -1){
		if(LNK != window.location.href){
			window.location.href += "#conteudo";
		}
	}
}

function limpaCampos(form){
	var user, pas;
	
	form.submit();

	user = document.getElementById("e-user");
	pas = document.getElementById("e-pass");
	
	user.value = "@clicprovida.com.br";
	pas.value = "";
}








