var itheme = 0;
var themes = new Array();
	
function mudaHeader(){
	themes[0] = "images/topo.jpg";
	themes[1] = "images/topo3.jpg";
	themes[2] = "images/topo2.jpg";
	
	tms = themes.length;
	obj = document.getElementById("topo");	
	if(itheme > tms-1){
		itheme = 0
	}
	obj.style.backgroundImage = 'url('+themes[itheme]+')';
	itheme++;
} 

/*
function scrollWin(elm)
{
	$('html, body').animate({
	scrollTop: $('#'+elm).offset().top
	}, 2000);
}
*/

function showPlan(idplan,id)
{
	
	if($("#"+id).html() == "Ver detalhes do plano")
	{
		$("#"+id).html("Ocultar detalhes")
		$("#"+idplan).slideDown("slow");	
	}
	else
	{
		$("#"+id).html("Ver detalhes do plano");
		$("#"+idplan).slideUp("slow");
	}
	window.location = "#"+idplan+"_l";
	
}

function beauty(id){
	obj = document.getElementsByTagName("input");
	var tags = obj.length;
	
		for(i=0; i<=tags-1; i++){	
			obj = document.getElementsByTagName("input")[i];
			obj.className = 'upClass'
		}
	   
		obj = document.getElementById(id);
		if(obj.className = 'upClass'){
			obj.className = 'downClass';
		 }
		 else{
			 obj.className = 'downClass';
		 }
		
	}	
	
	
function formatel(){
	if(isNaN(document.contato.fone.value.substring(0,1)))
	{
		document.contato.fone.value = "";
	}
	
	if(isNaN(document.contato.fone.value.substring(3,document.contato.fone.value.length)))
	{
		document.contato.fone.value = "";
	}
	
	var x = document.contato.fone.value.length;

	if(x == 2){
		var y = document.contato.fone.value;
		document.contato.fone.value = y + '-';
	}
	
	if( x == 11){
		var y = document.contato.fone.value;
		document.contato.fone.value = y.substring(0,2);
		document.contato.fone.value += '-';
		document.contato.fone.value += y.substring(3,11);
	}

}	


