//var flash = new String();
//flash = "<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='581' height='130' id='destaque' align='middle'>"
//flash += "<param name='allowScriptAccess' value='sameDomain' />"
//flash += "<param name='movie' value='img/destaque.swf' />"
//flash += "<param name='menu' value='false' />"
//flash += "<param name='quality' value='high' />"
//flash += "<embed src='img/destaque.swf' menu='false' quality='high' width='581' height='130' name='destaque' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>"
//document.write(flash)

// abre em janela separada
/*function abreNova(loc,janela,largura,altura,scrolling)  {

   if (largura == 0) {largura = 1}
   if (altura == 0) {altura = 1}
   var window_left = (screen.width - largura)/2;
   var window_top = (screen.height - altura)/2;
   if (window_left < 0) {window_left = 0}
   if (window_top < 0) {window_top = 1}
   remote = null

remote = window.open(loc, '' + janela + '','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scrolling + ',resizable=no,menubar=no,width=' + largura + ',height='+ altura + ',top=' + window_top + ',left=' + window_left + '');

if (remote != null) {
remote.location.href = loc;
remote.focus(); }
}

function abrePagina(botao) {
	if (botao == "botao01") {
		abreNova('identificacaocurriculo.aspx','pg','560','400','yes');
	}
		if (botao == "botao02") {
		abreNova('faleconosco.aspx','pg','580','400','yes');
	}
}*/
try{
	ajax = new XMLHttpRequest();
}
catch(ee){
	try{
		ajax = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e){
		try{
			ajax = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(E){
			ajax = false;
		}
	}
}

function fncAJAX(url){

	div = document.getElementById('divMain');
	document.getElementById("carregando").style.visibility = "visible";
	
	ajax.open("GET", url, true);
	ajax.onreadystatechange = function(){
		if (ajax.readyState == 4){
			var texto = ajax.responseText;
			texto = texto.replace(/\+/g," ");
			texto = unescape(texto);
			div.innerHTML = texto;
			//location.href="#";
			document.getElementById("carregando").style.visibility = "hidden";
		}
	}
	ajax.send(null)
}

function fncLoadAba(){
	if(td_num > 0){
		for(i=1; i <= td_num; i++){
			document.getElementById("td_pai_"+i).className = "menu_aba_out";
			document.getElementById("url_pai_"+i).className = "url_aba_out";
		}
		document.getElementById("td_pai_1").className = "menu_aba_over";
		document.getElementById("url_pai_1").className = "url_aba_over";
	}
}

function fncChildren(url,indice){

	div = document.getElementById('menu_horizontal_filho');
	div.innerHTML = "carregando...";
	
	for(i=1; i <= td_num; i++){
		document.getElementById("td_pai_"+i).className = "menu_aba_out";
		document.getElementById("url_pai_"+i).className = "url_aba_out";
	}
	document.getElementById("td_pai_"+ indice).className = "menu_aba_over"
	document.getElementById("url_pai_"+ indice).className = "url_aba_over";

	ajax.open("GET", url, true);
	ajax.onreadystatechange = function(){
		if (ajax.readyState == 4){
			var texto = ajax.responseText;
			texto = texto.replace(/\+/g," ");
			texto = unescape(texto);
			div.innerHTML = texto;
		}
	}
	ajax.send(null)
}

function fncTxtPesquisa(){
	inputTxt = document.frm.txtPesquisa.value;
	if(inputTxt == "pesquisa..."){
		document.frm.txtPesquisa.value="";
	}
}

function fncPesquisa(){
	if(document.frm.txtPesquisa.value=="" || document.frm.txtPesquisa.value=="pesquisa..."){
		alert("Informe um nome para a pesquisa!");
		document.frm.txtPesquisa.value="";
		document.frm.txtPesquisa.focus();		
		return;
	}
	var url = "_ajax.asp?pesquisa="+ document.frm.txtPesquisa.value;
	var div = document.getElementById("divPesquisa");
	document.getElementById("carregando").style.visibility = "visible";
	ajax.open("GET", url, true);
	ajax.onreadystatechange = function(){
		if (ajax.readyState == 4){
			var texto = ajax.responseText;
			texto = texto.replace(/\+/g," ");
			texto = unescape(texto);
			div.innerHTML = texto;
			document.getElementById("carregando").style.visibility = "hidden";
		}
	}
	ajax.send(null)
}

function fncPesquisaFechar(){
	document.getElementById("divPesquisa").innerHTML = "";
	document.frm.txtPesquisa.value = "";
}

function fncTamanhoTexto(num){
	document.getElementById("main_td").style.fontSize = num+"px";
	if(num==15){
		document.getElementById("txt_maior").href = "javascript:fncTamanhoTexto(15)";
		document.getElementById("txt_menor").href = "javascript:fncTamanhoTexto(14)";
	}
	else if(num==14){
		document.getElementById("txt_maior").href = "javascript:fncTamanhoTexto(15)";
		document.getElementById("txt_menor").href = "javascript:fncTamanhoTexto(13)";
	}
	else if(num==13){
		document.getElementById("txt_maior").href = "javascript:fncTamanhoTexto(14)";
		document.getElementById("txt_menor").href = "javascript:fncTamanhoTexto(12)";
	}
	else if(num==12){
		document.getElementById("txt_maior").href = "javascript:fncTamanhoTexto(13)";
		document.getElementById("txt_menor").href = "javascript:fncTamanhoTexto(11)";
	}
	else if(num==11){
		document.getElementById("txt_maior").href = "javascript:fncTamanhoTexto(12)";
		document.getElementById("txt_menor").href = "javascript:fncTamanhoTexto(10)";
	}
	else{
		document.getElementById("txt_maior").href = "javascript:fncTamanhoTexto(11)";
		document.getElementById("txt_menor").href = "javascript:fncTamanhoTexto(10)";
	}
}

function fncImprimir(id){
	var x = screen.availWidth;
	var	y = screen.availHeight;
	var titulo = document.getElementById("main_titulo_"+ id).innerHTML;
	var data = document.getElementById("main_data_"+ id).innerHTML;
	var resumo = document.getElementById("main_resumo_"+ id).innerHTML;
	var texto = document.getElementById("main_texto_"+ id).innerHTML;
	
	if(!janela){
		var janela = window.open("","janela","width="+ eval(x-10) +",height="+ eval(y-140) +",left=0,top=0,status,scrollbars,toolbar,menubar");
		janela.document.write("<html>\n");
		janela.document.write("<head>\n");
		janela.document.write("<link href='css/impressao.css' rel='stylesheet' type='text/css' />\n");
		
//		janela.document.write("<script>\n")
//		janela.document.write("function fncImprimir(n){\n")
//		janela.document.write("document.getElementById('url_imprimir').innerHTML = "";\n")
//		janela.document.write("var OLECMDID = n;\n")
//			OLECMDID values:
//			* 6 - print
//			* 7 - print preview
//			* 1 - open window
//			* 4 - Save As
//		janela.document.write("var PROMPT = 11;\n")
//		janela.document.write("var WebBrowser = '<OBJECT ID='WebBrowser1' WIDTH='0' HEIGHT='0' CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></OBJECT>';\n")
//		janela.document.write("document.body.insertAdjacentHTML('beforeEnd', WebBrowser);\n")
//		janela.document.write("WebBrowser1.ExecWB(OLECMDID, PROMPT);\n")
//		janela.document.write("}\n")
//		janela.document.write("</"+"script>\n");
		
		janela.document.write("</head>\n");
		janela.document.write("<body>\n");
		janela.document.write("<div style='padding:20px'>\n");
		janela.document.write("<table width='700' border='0' align='center'>\n");
		janela.document.write("<tr>\n");
		janela.document.write("<td>\n");
		janela.document.write("<hr size='1' color='DFDFDF'>\n");
		janela.document.write("<br>\n");
		janela.document.write("<span id='titulo'>" + titulo +"</span>\n");
		janela.document.write("<br><br>");
		janela.document.write("<span id='data'>"+ data +"</span>\n");
		janela.document.write("<br><br>\n");
		janela.document.write("<span id='resumo'>"+ resumo +"</span>\n");
		janela.document.write("<br><br>");
		janela.document.write("<span id='texto'>"+ texto +"</span>\n");
		janela.document.write("<br><br><br>");
		janela.document.write("<hr size='1' color='DFDFDF'>\n");
		janela.document.write("<span style='font-size:10;'><strong>URL:&nbsp;</strong>");
		janela.document.write("<font style='color:#666666;'>"+ window.location +"</font></span>\n");
		janela.document.write("</td>\n");
		janela.document.write("</tr>\n");
		janela.document.write("</table>\n");
		janela.document.write("</div>\n");
		janela.document.write("</body>\n");
		janela.document.write("</html>\n");
	}
}

//function fncImprimir(n){
//	document.getElementById("url_imprimir").innerHTML = "";
//	var OLECMDID = n;
//	OLECMDID values:
//	* 6 - print
//	* 7 - print preview
//	* 1 - open window
//	* 4 - Save As
//	var PROMPT = 11;
//	var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
//	document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
//	WebBrowser1.ExecWB(OLECMDID, PROMPT);
//}

function fncComentario(x,id){
	//location.href="#painel_"+ x;
	iframe = "<table width='525' align='center' border='0' cellspacing='0' cellpadding='0'>";
	iframe +="<tr>";
	iframe +="<td align='right' width='5%' height='25'>";
	iframe +="<a class='a2' href='javascript:fncComentarioFechar("+ x +")'>[FECHAR]</a>";
	iframe +="</td>";
	iframe +="</tr>";
	iframe +="<tr>";
	iframe +="<td width='95%'>";
	iframe +="<div id='menu_pai_titulo' style='width:530; height:25; padding:5px'>:: COMENTÁRIOS</div><BR>";
	iframe +="</td>";
	iframe +="</tr>";
	iframe +="<tr>";
	iframe +="<td width='95%'>";
	iframe +="<iframe src='_comentario.asp?id="+ id +"' width='525' height='215' frameborder='0'></iframe>";	iframe +="</td>";
	iframe +="</tr>";
	iframe +="</table>";

	document.getElementById("main_comentario_"+ x).className = "main_comentario";
	document.getElementById("main_comentario_"+ x).innerHTML = iframe;
}

function fncComentarioFechar(x){
	document.getElementById("main_comentario_"+ x).innerHTML = "";
	document.getElementById("main_comentario_"+ x).className = "";
}

function fncContatos(){
	if(document.frm.txtNome.value==""){
		alert("Por favor, informe seu nome!");
		document.frm.txtNome.focus();
		return;
	}
	if(document.frm.txtEmail.value==""){
		alert("Por favor, informe seu e-mail!");
		document.frm.txtEmail.focus();
		return;
	}
	if(document.frm.txtAssunto.value==""){
		alert("Por favor, informe o assunto!");
		document.frm.txtEmail.focus();
		return;
	}
	if(document.frm.txtMensagem.value==""){
		alert("Por favor, digite a mensagem!");
		document.frm.txtMensagem.focus();
		return;
	}
	document.frm.btnEnviar.disabled=true;
	document.frm.hddAcao.value="sendmail";
	document.frm.submit()
}

function fncNewsletter(){

	if(document.frm.txtNome.value==""){
		alert("Por favor, informe seu nome!")
		document.frm.txtNome.focus()
		return;
	}
	if(document.frm.txtEmail.value==""){
		alert("Por favor, informe seu e-mail!")
		document.frm.txtEmail.focus()
		return;
	}
	
	var url = "_ajax.asp?newsletter=insert&txtNome="+ document.frm.txtNome.value +"&txtEmail="+ document.frm.txtEmail.value;

	var div = document.getElementById('divNewsletter');
	div.innerHTML = "<img src='img/icon_loader.gif' border='0'>";
	ajax.open("GET", url, true);
	ajax.onreadystatechange = function(){
		if (ajax.readyState == 4){
			var texto = ajax.responseText;
			texto = texto.replace(/\+/g," ");
			texto = unescape(texto);
			div.innerHTML = texto;
		}
	}
	ajax.send(null)
	
}

function fncCarregarGaleria(id){
	if(!id){
		alert("SELECIONE UMA OPÇÃO!")
	}
	else{
		var url = "_ajax.asp?id="+ id +"&df1uq8df12ap=5s22ap6wh2ap5dh"
		fncAJAX(url)
	}
}

function fncSendForm(){
	var c=0;
	var erro;
	var campo;
	for (var i=2; i < document.frm.elements.length-4; i++){
		if(document.frm.elements[i].value==""){
			campo = document.frm.elements[i].name;
			document.getElementById(campo).style.backgroundColor="FFFFCC";
			erro += "    - "+ campo +"\n";
			c++;
		}
		else{
			campo = document.frm.elements[i].name;
			document.getElementById(campo).style.backgroundColor="F4F4F4";
		}
	}
	if(c > 0){
		erro = erro.replace("undefined","");
		alert("ATENÇÃO!\nTodos os campos são obrigatórios.\n\n("+ c +") campos em branco.\n----------------------------------------------------\n"+ erro +"----------------------------------------------------");
		return;
	}
	else{
		document.frm.hddAcao.value="sendForm";
		document.frm.submit();
	}
}	

function fncPlayer(mp3,label){
	document.getElementById("player").innerHTML = '<embed id="player" src="http://www.jojobaiano.com/arquivos/audio/mp3.asx" width="320" height="40" autostart="true" loop="False" type="video/x-msvideo" controls="true" showdisplay="false" showcontrols="true">';
	while(label.search("_") != -1){
		label = label.replace("_"," ");
	}
	document.getElementById("label").innerHTML = label;
}

function fncCloseErro(){
	document.getElementById("divErro").innerHTML="";
	window.location.href="index.asp";
}