<!--
function LYR_Show(OBJ)
{
	DOC = document.getElementById(OBJ);

	DOC.style.visibility	= (!DOC.style.visibility || DOC.style.visibility == "hidden")	? "visible" : "hidden";
	DOC.style.display		= (!DOC.style.display 	 || DOC.style.display	 == "none")		? "block" : "none";
}


function insertObject(str) {
	document.write(str);
}

function popup(url,janela,opts) {
	var lado = Math.ceil((screen.width / 2) - 250);
	var topo = 150; //Math.ceil((screen.height / 2)- 75);
	window.open(url,janela,opts+"width=400,height=150,top="+topo+",left="+lado);
};

function openWIN(url,nome,W,H,OPT) {
	HORZ = Math.ceil((screen.width - W) / 2);
	VERT = Math.ceil((screen.height - H) / 2);
	NOPT = (OPT==1) ? "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,"
	: "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,";
	window.open(url,nome,NOPT+"width="+W+",height="+H+",top="+VERT+",left="+HORZ);
};

function grandeM(url,janela,scroll){
	W = eval(screen.width)-10;
	H = eval(screen.height)-55;
	window.open(url,janela,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scroll+",resizable=no,copyhistory=no,width="+W+",height="+H+",top=0,left=0");
};

/* Função de link ... */
function goTO(URL) {
	window.location = URL;
}

/*	Função que redimenciona a janela	*/
function ch_size() {
	var eles = document.getElementsByName("box");
	WW = 0;
	HH = 0;
	for(i=0; i<eles.length; i++) {
		HH += eles[i].offsetHeight;
		WW += eles[i].offsetWidth;
	}
	
	NW = (Math.ceil(WW + 80) > screen.width)	? Math.ceil(WW + ((screen.width  - WW) / 2)) : WW + 80;	
	NH = (Math.ceil(HH + 40) > screen.height )	? Math.ceil(HH + ((screen.height - HH) / 2)) : HH + 40;
	window.resizeTo(NW, NH);

	var lado = (screen.width - WW - 50) / 2;
	var topo = (screen.height - HH - 50) / 2;
	window.moveTo(lado, topo);
}

/****************************************************************************************************************************************
													Funções de validação de formulários													
****************************************************************************************************************************************/
/* Validação da enquete */
function upEnq(HITS,ID,W,H) {
	HORZ = Math.ceil((screen.width - W) / 2);
	VERT = Math.ceil((screen.height - H) / 2);
	OPCOES = "'toolbar=no,location=no,status=no,menubar=no,directories=no,scrollbars=yes,resizable=no,width=400,height=320,top="+VERT+",left="+HORZ+"'";
	var DOC = document.form_enquete.respostas;
	if (HITS > 1){
		for(i=0; i<HITS; i++){
			if (DOC[i].checked) {
				window.open("enquete_show.php?opt="+DOC[i].value+"&id="+ID,"enquete",OPCOES);
				return false;
			}
		}
	} else {
		if (DOC.checked){
			window.open("enquete_show.php?opt="+DOC.value+"&id="+ID,"janela",OPCOES);
			return false;
		}
	}
	alert('Selecione uma resposta!');
}

/* Função simples para limpar campo on focus, e onblur inserir um texto se o campo estiver vazio */
function MaskCampo(OBJ, VALUE) {
	if (OBJ.value == "") {
		OBJ.value = VALUE;
	} else if (OBJ.value == VALUE){
		OBJ.value = "";
	}
};

function TestNome(field) {
	this.nome = field.value;
	var expReg = /\W+/g;
	this.nome = nome.search(expReg);
	if (this.nome == 0) {
		alert('Preencha o campo ' + field.name + ' com caractéres válidos');
		field.focus();
	}
}

function upLogon(FORM) {
	var doc = document.forms[FORM];
	var len = doc.elements.length-1;
	var nome;
	for (i=0; i < len; i++) {
		nome	= doc.elements[i].name;
		id		= doc.elements[i].id;
		valor	= doc.elements[i].value;
		if ((nome=='login' || nome=='passw') && (valor=='' || valor==' ' || valor=='login' || valor=='senha')) {
			alert('Preencha o campo '+id);
			doc.elements[i].focus();
			return false;
		}
	}
	doc.submit();
};

function upNews() {
	var doc = document.fm_news;
	var len = doc.elements.length-1;
	var nome;
	for (i=0; i < len; i++) {
		nome	= doc.elements[i].name;
		id		= doc.elements[i].id;
		valor	= doc.elements[i].value;
		if ((nome=='Nome' || nome=='Email') && (valor=='' || valor==' ' || valor=='seu@email.com.br')) {
			alert('Preencha o campo '+id);
			doc.elements[i].focus();
			return false;
		}
	}
	doc.action = 'news.php';
	doc.submit();
};

function upBSC() {
	var doc = document.tp_bsc;
	var VAL = doc.goTo.options[doc.goTo.selectedIndex].value;

	var itn = doc.BSC
	if (itn.value=='' || itn.value==' ' || itn.value=='Utilize este campo para fazer uma busca') {
		alert('Preencha o campo de texto ao lado');
		itn.focus();
		return false;
	}

	var act = new Array()
	act[1] = "cont_lista.php?m=3&ct=1";
	act[2] = "ass_lista.php?m=4&tipoStr=1";
	act[3] = "cont_lista.php?m=7&ct=4";
	act[4] = "down_lista.php?m=12";
	act[5] = "cont_lista.php?m=14&ct=6";
	doc.action = act[VAL];
	doc.submit();
};


function upFale() {
	var doc = document.fm_fale;
	var len = doc.elements.length-1;
	var nome;
	for (i=0; i < len; i++) {
		nome	= doc.elements[i].name;
		id		= doc.elements[i].id;
		valor	= doc.elements[i].value;
		if (valor=='' || valor==' ') {
			alert('Preencha o campo '+id);
			doc.elements[i].focus();
			return false;
		}
	}
	doc.action = 'send_mail.php';
	doc.submit();
};

function upASS(ID) {
	var doc = document.fm_ASS;
	var list = doc.elements;
	var len	 = list.length-1;
	for (i=0; i<len; i++) {
		nome  = list[i].name;
		valor = list[i].value;
		id	  = list[i].id;
		if ((nome=='Nome' || nome=='Email' || nome=='Empresa' || nome=='CNPJ' || nome=='InscEst' || nome=='DDD' || nome=='Telefone'
		 || nome=='Endereco'  || nome=='Numero' || nome=='Bairro'  || nome=='Cidade'  || nome=='UF' || nome=='Login' || nome=='Senha') 
		&& valor=='') {
			alert('Preencha o campo '+ id);
			list[i].focus();
			return false;
		}
	};

	doc.action = "ass.php";
	var nid = (ID!='0') ? doc.Login.value+"&id="+ID : doc.Login.value;
	document.getElementById("Source").src = "ass_source.php?lg="+nid;
//	doc.submit();
}

function upCUR() {
	var doc = document.fm_CUR;
	var list = doc.elements;
	var len	 = list.length-1;
	for (i=0; i<len; i++) {
		nome  = list[i].name;
		valor = list[i].value;
		id	  = list[i].id;
		if ((nome=='Nome' || nome=='Email' || nome=='Civil' || nome=='Disponibilidade' || nome=='Salario' || nome=='Nivel') && valor=='') {
			alert('Preencha o campo '+ id);
			list[i].focus();
			return false;
		}
	};
	doc.submit();
}

function upForm(FORM, NOME, VALOR) {
//stringObj.split([separator[, limit]])
	var doc = document.forms[FORM];
	var len = doc.elements.length-1;
	
	for (i=0; i < len; i++) {
		nome	= doc.elements[i].name;
		id		= doc.elements[i].id;
		valor	= doc.elements[i].value;
		if ((nome=='login' || nome=='passw') && (valor=='' || valor==' ' || valor=='login' || valor=='senha')) {
			alert('Preencha o campo '+id);
			doc.elements[i].focus();
			return false;
		}
	}
	doc.action = 'login.php';
	doc.submit();
};


/*****************************************************************************************************************/

function upFaleMS() {
	var doc = document.fm_fale;
	var len = doc.elements.length-1;
	var nome;
	for (i=0; i < len; i++) {
		nome	= doc.elements[i].name;
		id		= doc.elements[i].id;
		valor	= doc.elements[i].value;
		if (valor=='' || valor==' ') {
			alert('Preencha o campo '+id);
			doc.elements[i].focus();
			return false;
		}
	}
	doc.action = 'fale.php';
	doc.submit();
};

function upCurMS() {
	var doc = document.fm_fale;
	var len = doc.elements.length-1;
	var nome;
	for (i=0; i < len; i++) {
		nome	= doc.elements[i].name;
		id		= doc.elements[i].id;
		valor	= doc.elements[i].value;
		if (valor=='' || valor==' ') {
			alert('Preencha o campo '+id);
			doc.elements[i].focus();
			return false;
		}
	}
	doc.action = 'curriculo.php';
	doc.submit();
};


/*****************************************************************************************************************/


function InsertFlash(url,trans,width,height,bgcolor,FlashVars) {
	document.write(GetFlashHtml(url,trans,width,height,bgcolor,FlashVars));
};

var Browser = {
	Detect:function () {
		var agent	= navigator.userAgent.toLowerCase();

		this.IE		= agent.indexOf("msie")!=-1;
		this.Gecko	= agent.indexOf("gecko")!=-1;
		this.Opera	= agent.indexOf("opera")!=-1;
		this.Safari	= agent.search(/(konqueror|safari|khtml)/i)>-1;
		this.Other	= !this.IE && !this.Gecko && !this.Safari;
	}
}
Browser.Detect();

function GetFlashHtml(url,trans,width,height,bgcolor,FlashVars) {
	var html = [];
	
					html.push('<object '+(Browser.IE ? ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ' : '')+' type="application/x-shockwave-flash" data="'+url+'" '+(width ? ' width="'+width+'"' : '')+' '+(height ? ' height="'+height+'"' : '')+' '+(trans ? ' wmode="transparent"' : '')+' '+(bgcolor ? ' bgcolor="'+bgcolor+'"' : '')+' '+(FlashVars ? ' FlashVars="'+FlashVars+'"' : '')+' menu="false">');
	if(trans) 		html.push('<param name="wmode" value="transparent" />');
					html.push('<param name="menu" value="false" />');
	if(width)		html.push('<param name="width" value="'+width+'" />');
	if(height)		html.push('<param name="height" value="'+height+'" />');
	if(bgcolor)		html.push('<param name="bgcolor" value="'+bgcolor+'" />');
	if(FlashVars)	html.push('<param name="FlashVars" value="'+FlashVars+'" />');
					html.push('<param name="movie" value="'+url+'" />');
					html.push('<param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" />');
					html.push('</object>');
	return html.join("");
};
// -->