// JavaScript Document
function verifica_email(obj)
	{
		if ((obj.remetente.value=="")||(obj.remetente.value.length<3))
			{
			alert("Complete o campo REMETENTE corretamente")
			obj.remetente.focus();
			obj.remetente.select();	
			return false;				
			}
				if ((obj.email.value=="")||(obj.email.value.length<6))
					{
					alert("Complete o campo EMAIL corretamente")
					obj.email.focus();
					obj.email.select();	
					return false;				
					}
				else
					{
					prim = obj.email.value.indexOf("@")
					if(prim < 2) 	
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf("@",prim + 1) != -1) 
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf(".") < 1) 
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf(" ") != -1) 
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf("zipmeil.com") > 0) 
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf("hotmeil.com") > 0) 
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf(".@") > 0) 
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf("@.") > 0) 
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf(".com.br.") > 0) 
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}	
					if(obj.email.value.indexOf("/") > 0) 
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf("[") > 0) 
					   {
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf("]") > 0)
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf("(") > 0)
					    {
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf(")") > 0)
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					if(obj.email.value.indexOf("..") > 0)
						{
						alert("O e-mail digitado parece não estar correto.");
						obj.email.focus();
						obj.email.select();
						return false;
						}
					return true;
					}

}

function confere_campo_senha(obj)				
	{
	if ((obj.cd_login.value=="")||(obj.cd_login.value.length<6))	
		{
		alert("Preencha corretamente o LOGIN da atendente!")	
		obj.cd_login.focus();
		obj.cd_login.select();
		return false;
		}
	else ///else do confere LOGIN
		{
		if ((obj.cd_senha.value=="")||(obj.cd_senha.value.length<6))	
			{
			alert("Preencha corretamente o SENHA da atendente!")	
			obj.cd_senha.focus();
			obj.cd_senha.select();
			return false;
			}
		else ///else do confere SENHA
			{
			return true;
			}///else do confere SENHA
	}///else do confere LOGIN					
}			
function tamanho_tela(width, height) 
				{
				var width_janela	= eval(width);
				var height_janela	= eval(height);
				var width_tela 		= self.screen.width;
				var height_tela 	= self.screen.height;
				var pos_esquerda 	= (width_tela - width_janela)/2;
				var pos_direita 	= (height_tela - height_janela)/2;
			
				self.moveTo(pos_esquerda,pos_direita); //centraliza
				self.resizeTo(width_janela, height_janela); //redimensiona
				}

//function tamanho(){
//	var xmax=window.screen.width;
//	var ymax=window.screen.height;
//	var posx=(xmax-680)/2;
//	var posy=(ymax-330)/2;
//	window.resizeTo(635,430);
//	window.moveTo(posx,posy);
//	}

function limpa_login_online(){
	if (window.document.logar.login_online.value == "Nome do usuário"){
		window.document.logar.login_online.value = "";
	}
}

function coloca_login_online(){
	if (window.document.logar.login_online.value == ""){
		window.document.logar.login_online.value = "Nome do usuário";
	}
}
function limpa_senha_online(){
	if (window.document.logar.senha_online.value == "000000"){
		window.document.logar.senha_online.value = "";
	}
}

function coloca_senha_online(){
	if (window.document.logar.senha_online.value == ""){
		window.document.logar.senha_online.value = "000000";
	}
}

  function showdata(){
    Todays = new Date();
	if (Todays.getDate() < 10){
		if (Todays.getMonth() <10){
			TheDate = " 0" + Todays.getDate() +"/0"+ (Todays.getMonth() + 1) + "/" + Todays.getYear()
		}
		else{
			TheDate = "  0" + Todays.getDate() +"/"+ (Todays.getMonth() + 1) + "/" + Todays.getYear()
		}
	}
	else{
    	if (Todays.getMonth() <10){
			TheDate = "  " + Todays.getDate() +"/0"+ (Todays.getMonth() + 1) + "/" + Todays.getYear()
		}
		else{
			TheDate = "   " + Todays.getDate() +"/"+ (Todays.getMonth() + 1) + "/" + Todays.getYear()
		} 
	}
    document.form_hora.input_data.value = TheDate;
  }

  function showtime(){
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds()
	var timeValue = "" + ((hours >12) ? hours  :hours)
	if (hours < 10){
		timeValue = "0" + hours;
	}
	else{
		timeValue = " " + hours;
	}
	timeValue += ((minutes < 10) ? ":0" : ":") + minutes
	timeValue += ((seconds < 10) ? ":0" : ":") + seconds
	//timeValue += (hours >= 12) ? " P.M." : " A.M."
	document.form_hora.input_hora.value = timeValue;
	timerID = setTimeout("showtime()",1000);
	timerRunning = true;
  }
  
  function showdatahora(){
  	showdata();
	showtime();
  }
  
    
  function toggleLayer(layer,x)
{
    layer = (typeof layer == 'string') ? document.getElementById(layer) : layer;
	
	if (x == 1){
		layer.style.visibility = 'visible';
	}else{
		layer.style.visibility = 'hidden';	
	}

    //layer.style.visibility = (layer.style.visibility == 'hidden') ? 'visible' : 'hidden';
}
	
	function limpa_layer(nome){
		field = document.getElementById(nome);
		field.innerHTML = '0';
		window.document.atualiza_noticia.txt_titulo_noticia.value = "";
		}


var cd;
function confirma_delecao(cd)
      {
	 if (confirm ("Deseja apagar este registro?")) 
			{ 
			self.location.href=cd;
			} 
	  }