function AbreJanela(link,x,y,s) {
	var t = (screen.height - y) / 2;
	var e = (screen.width - x) / 2;

	window.open(link,x+y,'width=' + x + ',height=' + y + ',scrollbars=' + s + ',toolbar=0,location=0,status=0,menubar=0,resizable=0,left=' + e + ',top=' + t + '');
}

var PopUp = null
function FocaJanela(){
	if (PopUp!=null && !PopUp.closed){
		PopUp.focus();
	}
}

function Fecha(Tipo){
	if(Tipo=='C'){
		if(confirm('Deseja cancelar esta operação?')){
			window.close()
			window.opener.location.reload();
		}else{
			return false;
		}
	}else if(Tipo=='F'){
		window.close()
		window.opener.location.reload();
	}else{
		window.close();
	}
}

function PageLoad(){
	window.opener.location.reload();
}

function Voltar(){
	history.back(0);
}

// ******************************************************
// *********** mostra determinada area ************
// ******************************************************
function ShowHide(IdObjeto){
	if (document.getElementById(IdObjeto).style.display == 'block'){
		document.getElementById(IdObjeto).style.display = 'none';
	} else {
		document.getElementById(IdObjeto).style.display = 'block';
	}
}
function Show(IdObjeto){
	document.getElementById(IdObjeto).style.display = '';
}
function Hide(IdObjeto){
	document.getElementById(IdObjeto).style.display = 'none';
}

function Confirma(Msg,Url){
	if(confirm(Msg)){
		location.href = Url
		return false;
	}else{
		return false;
	}
}


function ExibeImg(Valor,ObjDestino){
	document.getElementById(ObjDestino).src = Valor;
}
function FrmEnvia(Confirma,Msg,ObjId){
	if(Confirma==1){
		if(confirm(Msg)){
			document.getElementById(ObjId).submit();
		}
	}else{
		document.getElementById(ObjId).submit();
	}
	return false;
}

function GridFoto(NomeClass,IdObj,idCheck){
	var CheckBox = document.getElementById(idCheck).checked;
	if(CheckBox == false){
		document.getElementById(IdObj).className = NomeClass;
	}
}
function ClicaFoto(IdObj,idCheck){
	CheckBox = document.getElementById(idCheck).checked;
	if(CheckBox == false){
		document.getElementById(idCheck).checked = true;
		document.getElementById(IdObj).className = 'FotoC';
	}else{
		document.getElementById(idCheck).checked = false;
		document.getElementById(IdObj).className = 'FotoA';
	}
	//alert(document.getElementById(idCheck).checked);
}

function GridCategoria(NomeClass,IdObj,idCheck){
	var CheckBox = document.getElementById(idCheck).checked;
	if(CheckBox == false){
		document.getElementById(IdObj).className = NomeClass;
	}
}
function ClicaCategoria(IdObj,idCheck){
	CheckBox = document.getElementById(idCheck).checked;
	if(CheckBox == false){
		document.getElementById(idCheck).checked = true;
		document.getElementById(IdObj).className = 'CategoriaC';
	}else{
		document.getElementById(idCheck).checked = false;
		document.getElementById(IdObj).className = 'CategoriaA';
	}
	//alert(document.getElementById(idCheck).checked);
}

function GridSelecionar(){
	CheckBox = document.getElementsByTagName('input');
	for (var i=0;i<CheckBox.length;i++){
		if(CheckBox[i].type=='checkbox'){
			CheckBox[i].checked = true;
		}
	}
}

function Base(){
	document.getElementById('Base').style.bottom = '0px';
}
//window.onresize = Base;

function WSize(W,H){
	window.resizeTo(W,H)
	
	var t = (screen.height - H) / 2;
	var e = (screen.width - W) / 2;
	
	window.moveTo(e,t);
}


FonteI = 14
function Fonte(Tipo,idObj){
	if(Tipo=='Mais' && FonteI<24){
		FonteI++
	}else if(Tipo=='Menos' && FonteI>8){
		FonteI--
	}
	document.getElementById(idObj).style.fontSize = FonteI+"px";
	//alert(FonteI)
}

function IsEmail(pVal){
	var reTipo = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
	return reTipo.test(pVal);
}

function ConteudoFlash(swf,largura,altura,VSpace,HSpace){
	STRFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+largura+'" height="'+altura+'" vspace="'+VSpace+'" hspace="'+HSpace+'">'
	STRFlash += '<param name="movie" value="'+swf+'" />'
    STRFlash += '<param name="quality" value="high" />'
    STRFlash += '<param name="wmode" value="transparent" />'
	STRFlash += '<embed src="'+swf+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'" wmode="transparent" vspace="'+VSpace+'" hspace="'+HSpace+'"></embed>'
	STRFlash += '</object>'
	document.write(STRFlash);
}

/*TollType*/
var qTipTag = "a,label,div,img"; //Which tag do you want to qTip-ize? Keep it lowercase!//
var qTipX = 0; //This is qTip's X offset//
var qTipY = 15; //This is qTip's Y offset//

//There's No need to edit anything below this line//
tooltip = {
  name : "qTip",
  offsetX : qTipX,
  offsetY : qTipY,
  tip : null
}

tooltip.init = function () {
	var tipNameSpaceURI = "http://www.w3.org/1999/xhtml";
	if(!tipContainerID){ var tipContainerID = "qTip";}
	var tipContainer = document.getElementById(tipContainerID);

	if(!tipContainer) {
	  tipContainer = document.createElementNS ? document.createElementNS(tipNameSpaceURI, "div") : document.createElement("div");
		tipContainer.setAttribute("id", tipContainerID);
	  document.getElementsByTagName("body").item(0).appendChild(tipContainer);
	}

	if (!document.getElementById) return;
	this.tip = document.getElementById (this.name);
	if (this.tip) document.onmousemove = function (evt) {tooltip.move (evt)};
}

tooltip.move = function (evt) {
	var x=0, y=0;
	if (document.all) {//IE
		x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		x += window.event.clientX;
		y += window.event.clientY;
		
	} else {//Good Browsers
		x = evt.pageX;
		y = evt.pageY;
	}
	this.tip.style.left = (x + this.offsetX) + "px";
	this.tip.style.top = (y + this.offsetY) + "px";
}

tooltip.show = function (text) {
	if (!this.tip) return;
	this.tip.innerHTML = text;
	this.tip.style.display = "block";
}

tooltip.hide = function () {
	if (!this.tip) return;
	this.tip.innerHTML = "";
	this.tip.style.display = "none";
}

window.onload = function () {
	tooltip.init ();
}
/**/




/*Distrito*/
function ValidaContato(){
	Nome = document.getElementById('Nome');
	Email = document.getElementById('Email');
	Assunto = document.getElementById('Assunto');
	Mensagem = document.getElementById('Mensagem');
	
	if(Nome.value==''){
		alert('Informe seu nome.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Nome.focus();
		return false;
	}
	
	if(Email.value==''){
		alert('Informe seu E-mail.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Email.focus();
		return false;
	}

	if(IsEmail(Email.value)==false){
		alert('Seu E-mail é inválido.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Email.focus();
		return false;
	}

	if(Assunto.value==''){
		alert('Informe o assunto.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Assunto.focus();
		return false;
	}
	
	if(Mensagem.value==''){
		alert('Informe a mensagem.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Mensagem.focus();
		return false;
	}
	return true;
}

function ValidaContato2(){
	NomeAmigo = document.getElementById('NomeAmigo');
	EmailAmigo = document.getElementById('EmailAmigo');
	Nome = document.getElementById('Nome');
	Email = document.getElementById('Email');
	//Comentario = document.getElementById('Comentario');
	
	if(NomeAmigo.value==''){
		alert('Informe o nome do amigo.');
		//NomeAmigo.style.backgroundColor = '#FFE6E6';
		NomeAmigo.focus();
		return false;
	}
	
	if(EmailAmigo.value==''){
		alert('Informe o e-mail do amigo.');
		//EmailAmigo.style.backgroundColor = '#FFE6E6';
		EmailAmigo.focus();
		return false;
	}
	
	if(IsEmail(EmailAmigo.value)==false){
	alert('Seu E-mail é inválido.');
	//EmailAmigo.style.backgroundColor = '#FFE6E6';
	EmailAmigo.focus();
	return false;
	}
	
	if(Nome.value==''){
		alert('Informe seu nome.');
		//Nome.style.backgroundColor = '#FFE6E6';
		Nome.focus();
		return false;
	}
	
	if(Email.value==''){
		alert('Informe seu E-mail.');
		//Email.style.backgroundColor = '#FFE6E6';
		Email.focus();
		return false;
	}

	if(IsEmail(Email.value)==false){
		alert('Seu E-mail é inválido.');
		//Email.style.backgroundColor = '#FFE6E6';
		Email.focus();
		return false;
	}
	
	//if(Comentario.value==''){
		//alert('Insira um Comentario.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		//Comentario.focus();
		//return false;
	//}
	return true;
}

function ValidaOrcamento(){
	Nome = document.getElementById('Nome');
	Email = document.getElementById('Email');
	Assunto = document.getElementById('Assunto');
	Mensagem = document.getElementById('Mensagem');
	EnderecoRua	= document.getElementById('EnderecoRua');
	EnderecoNumero	= document.getElementById('EnderecoNumero');
	EnderecoBairro	= document.getElementById('EnderecoBairro');
	EnderecoCidade	= document.getElementById('EnderecoCidade');
	EnderecoEstado	= document.getElementById('EnderecoEstado');
	
	if(Nome.value==''){
		alert('Informe seu nome.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Nome.focus();
		return false;
	}
	
	if(Email.value==''){
		alert('Informe seu E-mail.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Email.focus();
		return false;
	}

	if(IsEmail(Email.value)==false){
		alert('Seu E-mail é inválido.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Email.focus();
		return false;
	}
	if(EnderecoRua.value==''){
		alert('Informe sua Rua.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		EnderecoRua.focus();
		return false;
	}
	if(EnderecoNumero.value==''){
		alert('Informe seu Número.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		EnderecoNumero.focus();
		return false;
	}
	if(EnderecoBairro.value==''){
		alert('Informe seu Bairro.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		EnderecoBairro.focus();
		return false;
	}
	if(EnderecoCidade.value==''){
		alert('Informe sua Cidade.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		EnderecoCidade.focus();
		return false;
	}
	if(EnderecoEstado.value=='UF'){
		alert('Informe seu Estado.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		EnderecoEstado.focus();
		return false;
	}	
	if(Assunto.value==''){
		alert('Informe o assunto.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Assunto.focus();
		return false;
	}
	
	if(Mensagem.value==''){
		alert('Informe a mensagem.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Mensagem.focus();
		return false;
	}
	return true;
}

function ValidaBusca(){
	Busca = document.getElementById('Busca');
	
	if(Busca.value==''){
		alert('Informe sua busca.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Busca.focus();
		return false;
	}
	return true;
}

function AgendaContato(){
	Nome = document.getElementById('Nome');
	Assunto = document.getElementById('Assunto');
	Mensagem = document.getElementById('Mensagem');
	Telefone = document.getElementById('Telefone');
	Dia  = document.getElementById('Dia');
	Mes  = document.getElementById('Mes');
	Ano  = document.getElementById('Ano');
	Hora = document.getElementById('Hora');
	Min  = document.getElementById('Min');
	
	
	if(Nome.value==''){
		alert('Informe seu nome.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Nome.focus();
		return false;
	}

	if(Assunto.value==''){
		alert('Informe o assunto.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Assunto.focus();
		return false;
	}
	
	if(Mensagem.value==''){
		alert('Informe a mensagem.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Mensagem.focus();
		return false;
	}

	if(Telefone.value==''){
		alert('Informe o telefone.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Telefone.focus();
		return false;
	}
	if(Dia.value==''){
		alert('Informe o Dia.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Dia.focus();
		return false;
	}
	if(Mes.value==''){
		alert('Informe o Mes.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Mes.focus();
		return false;
	}
	if(Ano.value==''){
		alert('Informe o Ano.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Ano.focus();
		return false;
	}
	if(Hora.value==''){
		alert('Informe o Hora.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Hora.focus();
		return false;
	}
	if(Min.value==''){
		alert('Informe o Min.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Min.focus();
		return false;
	}	
	return true;
}
function ValidaTrabalheConosco(){
	nome = document.getElementById('nome');
	dtnascimento = document.getElementById('dtnascimento');
	endereco = document.getElementById('endereco');
	no = document.getElementById('no');
	bairro  = document.getElementById('bairro');
	cidade  = document.getElementById('cidade');
	CEP1  = document.getElementById('CEP1');
	CEP2 = document.getElementById('CEP2');
	telefone  = document.getElementById('telefone');
	email  = document.getElementById('email');
	escola1  = document.getElementById('escola1');
	curso1  = document.getElementById('curso1');
	pretensaosalarial  = document.getElementById('pretensaosalarial');	
	
	if(nome.value==''){
		alert('Informe seu nome.');
		nome.style.backgroundColor = '#D5E7FB';
		nome.focus();
		return false;
	}
	if(dtnascimento.value==''){
		alert('Informe a data de nascimento.');
		dtnascimento.style.backgroundColor = '#D5E7FB';
		dtnascimento.focus();
		return false;
	}
	if(endereco.value==''){
		alert('Informe o endereco.');
		endereco.style.backgroundColor = '#D5E7FB';
		endereco.focus();
		return false;
	}
	if(no.value==''){
		alert('Informe o Número de seu endereço.');
		no.style.backgroundColor = '#D5E7FB';
		no.focus();
		return false;
	}
	if(bairro.value==''){
		alert('Informe o bairro.');
		bairro.style.backgroundColor = '#D5E7FB';
		bairro.focus();
		return false;
	}
	if(cidade.value==''){
		alert('Informe a cidade.');
		cidade.style.backgroundColor = '#D5E7FB';
		cidade.focus();
		return false;
	}
	if(CEP1.value==''){
		alert('Informe o CEP.');
		CEP1.style.backgroundColor = '#D5E7FB';
		CEP1.focus();
		return false;
	}
	if(CEP2.value==''){
		alert('Informe o CEP.');
		CEP2.style.backgroundColor = '#D5E7FB';
		CEP1.focus();
		return false;
	}
	if(telefone.value==''){
		alert('Informe o Telefone.');
		telefone.style.backgroundColor = '#D5E7FB';
		telefone.focus();
		return false;
	}
	if(email.value==''){
		alert('Informe seu E-mail.');
		email.style.backgroundColor = '#D5E7FB';
		email.focus();
		return false;
	}
	if(IsEmail(email.value)==false){
		alert('Seu E-mail é inválido.');
		email.style.backgroundColor = '#D5E7FB';
		email.focus();
		return false;
	}	
	if(escola1.value==''){
		alert('Informe o Escola.');
		escola1.style.backgroundColor = '#D5E7FB';
		escola1.focus();
		return false;
	}
	if(curso1.value==''){
		alert('Informe o Curso.');
		curso1.style.backgroundColor = '#D5E7FB';
		curso1.focus();
		return false;
	}
	if(pretensaosalarial.value==''){
		alert('Informe Quanto Pretende Ganhar.');
		pretensaosalarial.style.backgroundColor = '#D5E7FB';
		pretensaosalarial.focus();
		return false;
	}	
	return true;
}
