function Abre(url, width, height, rola)
	{						
	if (rola==""){rola="yes"}
	window.open(url,"_blank","resizable=no,toolbar=no,status=no,top=" + (window.screen.height - height)/2 + ",left=" + (window.screen.width - width)/2 + ",menubar=no,scrollbars=" + rola + ",width=" + width + ",height=" + height);
	}
function mudaCor(myTr,myCor){
	myTr.className=myCor;
}


//mostra a data e hora
function infData()
	{
	mydate = new Date();
	myday = mydate.getDay();
	mymonth = mydate.getMonth();
	myweekday= mydate.getDate();
	weekday= myweekday;
	myyear= mydate.getYear();
	year = myyear;
	myHour = mydate.getHours();
	hora = myHour	
	myMinutes = mydate.getMinutes();
	minutos = myMinutes
	mySeconds = mydate.getSeconds();
	segundos = mySeconds

	if(myday == 0){day = " Domingo, "} 
	else if(myday == 1){day = " Segunda-Feira, "}
	else if(myday == 2){day = " Terça-Feira, "} 
	else if(myday == 3){day = " Quarta-Feira, "} 
	else if(myday == 4){day = " Quinta-Feira, "}
	else if(myday == 5){day = " Sexta-Feira, "}
	else if(myday == 6){day = " Sábado, "}

	if(mymonth == 0){month = "Janeiro "}
	else if(mymonth ==1){month = "Fevereiro "}
	else if(mymonth ==2){month = "Março "}
	else if(mymonth ==3){month = "Abril "}
	else if(mymonth ==4){month = "Maio "}
	else if(mymonth ==5){month = "Junho "}
	else if(mymonth ==6){month = "Julho "}
	else if(mymonth ==7){month = "Agosto "}
	else if(mymonth ==8){month = "Setembro "}
	else if(mymonth ==9){month = "Outubro "}
	else if(mymonth ==10){month = "Novembro "}
	else if(mymonth ==11){month = "Dezembro "}


	
	document.write(""+ day);
		if ((navigator.userAgent.indexOf("MSIE")==-1) || navigator.appVersion.substring(0,1) < 4) 
			{
			document.write(myweekday+" de "+month+ " de 2005"+minutes);
			}
		else 
			{
			document.write(myweekday+" de "+month+ " de " + "<img src=\"img/relogio.gif\" hspace=\"3\" align=\"absMiddle\">"+hora+":"+ minutos+":"+ segundos);
			}
	
	}

function overMouse(myBot,myClass){
	myBot.className=myClass;
}
function goURL(url) {
	document.location.href=url;
}

function verifica(){
	erro=false;
	myFrm = document.frmMail
	msgErro = "Inrome "
	if(myFrm.user.value == "" || myFrm.user.value == "// usuario"){
		msgErro = msgErro+"seu nome de usuário no primeiro campo do formulário";
		erro=true;
	}
	if(myFrm.pass.value == "" || myFrm.pass.value == "// senha") {
		if (erro){
			msgErro = msgErro+" e "
		}
		msgErro = msgErro+"sua senha no segundo campo";
		if(!erro){
		msgErro = msgErro+" do formulario";
		}
		erro=true;
	}
	if(erro){
		alert(msgErro);
		return false;
	}
}

function montaFlash(destino, flavez, width, height, trans, scale){
	var myFlash =
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'%" height="'+height+'%" id="'+flavez+'" align="middle">'+
	'<param name="allowScriptAccess" value="sameDomain" />'+
	'<param name="movie" value="'+flavez+'.swf" />'
	;
	if (trans == "yes"){
		myFlash += '<param name="wmode" value="transparent" />';
	}
	if (scale == "yes"){
		myFlash += '<param name="scale" value="noscale" />';
	}
	myFlash +=
	'<param name="quality" value="high" />'+
	'<param name="bgcolor" value="#ffffff" />'+
	'<embed src="'+flavez+'.swf" wmode="transparent" quality="high" bgcolor="#ffffff" width="'+width+'%" height="'+height+'%" name="empresas" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
	'</object>'
	;
	document.getElementById(destino).innerHTML = myFlash;
}

function ocultaMostraDiv(div, statusDiv, ajax, page, page2){
	objDiv = document.getElementById(div);
	objDiv.innerHTML = "";
	objDiv.style.display = ""+statusDiv+"";
	if(ajax=="yes"){
		executaAjaxText("inc/"+page+".php", "titulo="+page+"&det="+page2, "get", div, "Carregando Página...");
	}
}

function validaMail(objMail){
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(objMail))) 
    { 
		email = false;
	} 
	else{
		email = true;
	}
	return email;
}

function validaForm(obj) {
	objAux = obj.elements;
	parametros = "";
	erro = 0;
	msgErro = "Campo Obrigatórios\n\n";
	if(obj.txtnome.value=="") {
		erro = 1;
		msgErro += "- Nome\n";
	}
	if(obj.txtddd.value=="" || obj.txttelefone.value=="") {
		erro = 1;
		msgErro += "- Telefone\n";
	}
	if(obj.txtemail.value=="") {
		erro = 1;
		msgErro += "- E-Mail\n";
	}else{
		if(!validaMail(obj.txtemail.value)) {
			erro = 1;
			msgErro += "- E-Mail c/ Formato Inválido\n";
		}
	}
	if(erro) {
		alert(msgErro);
		//return false;
	}else{
		//return true;
		for(var i=0; i < objAux.length; i++) {
			if(obj[i].type=="select-one" || obj[i].type=="text" || obj[i].type=="hidden" || obj[i].type=="textarea") {
				parametros += obj[i].name+"="+obj[i].value+"&";
			}
		}
		executaAjaxText("submeteForms.php", parametros, "post", "conteudo", "Enviando E-Mail Aguarde...");		
	}
}

function onlyNumbers(){
	if (event.keyCode < 48 || event.keyCode > 57) 
		event.returnValue = false;
}	

function validaTelefone(elemId) {
	if (event.keyCode < 48 || event.keyCode > 57) {
		event.returnValue = false;
	}
	var nkey = event.keyCode;
	d = document.getElementById(elemId);
	if (nkey != 8) {
		if (d.value.length == 4) {
			d.value += "-";
		}
		else if (d.value.length == 9){
			return false;
		}
	}
	
}

function maskTel(objTel, e) {
	if (document.all)
		var tecla = event.keyCode;
	else{
		var tecla = e.which;
	}
	
	if(tecla != 8){
		if(objTel.value.length==1){
			objTel.value = objTel.value.replace("(","");
			tel = "("+objTel.value;
			objTel.value = tel;
		}
		if(objTel.value.length==3) {
			objTel.value = objTel.value.replace(")","");
			tel = objTel.value+")";
			objTel.value = tel;
		}
		if(objTel.value.length==8) {
			tel = objTel.value+"-";
			objTel.value = tel;
		}
	}
}

function markData(objData, e){
	if (document.all)
		var tecla = event.keyCode;
	else{
		var tecla = e.which;
	}
	
	if(tecla != 8){
		if(objTel.value.length==1){
			objTel.value = objTel.value.replace("(","");
			tel = "("+objTel.value;
			objTel.value = tel;
		}
		if(objTel.value.length==3) {
			objTel.value = objTel.value.replace(")","");
			tel = objTel.value+")";
			objTel.value = tel;
		}
		if(objTel.value.length==8) {
			tel = objTel.value+"-";
			objTel.value = tel;
		}
	}
}

function onlyNumbers(e){
	if (document.all)
		var tecla = event.keyCode;
	else{
		var tecla = e.which;
	}
	if ((tecla > 47 && tecla < 58) || tecla == 8 || tecla == 0 )
		return true;
	else{
		return false;
	}
}
