function get_flash(arquivo, largura, altura, bgcolor, id, qualidade, alinhamento, transparente, pgphp) {
	obj = '<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="'+largura+'" height="'+altura+'" id="'+id+'" align="'+alinhamento+'">';
	obj+= '<param name="allowScriptAccess" value="sameDomain" />';
	obj+= '<param name="movie" value="'+arquivo+'" />';
	obj+= '<param name="quality" value="'+qualidade+'" />';
	if(transparente == true) {
		obj+= '<param name="wmode" value="transparent" />';
	}
	obj+= '<param name="bgcolor" value="'+bgcolor+'" />';
	obj+= '<param name="FlashVars" value="pais='+pgphp+'" />';
	obj+= '<embed src="'+arquivo+'" '+((transparente==true)?'wmode="transparent"':'')+'" quality="'+qualidade+'" bgcolor="'+bgcolor+'" FlashVars="pais='+pgphp+'" width="'+largura+'" height="'+altura+'" name="'+id+'" align="'+alinhamento+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	obj+= '</object>';
	document.write(obj);
}

function url(url){
	window.document.location.href=url;
}


function Popup(Url, Titulo, Width, Height, Scrollbar) 
{
    window.open(Url, Titulo, 'width='+Width+', height='+Height+', scrollbars='+Scrollbar+', status=no, resizable, top='+((screen.availHeight/2)-(Height/2))+', left='+((screen.availWidth/2)-(Width/2)))
}


function AbreMenu(id) {

	if(document.getElementById(id).className == "fechado") {
	
		document.getElementById(id).className = "aberto";
		document.getElementById("sub"+id).style.display = "";

	} else {
	
		document.getElementById(id).className = "fechado";
		document.getElementById("sub"+id).style.display = "none";
		
	}	
	
}

function validaform() {
    
	msg1 = "";
	
	if (window.document.FrmFale.ds_nome.value == "") {
    	msg1 = msg1 + "O \"NOME\" deve ser preenchido! \n";
		document.getElementById("ds_nome").style.border = "solid #F8A7A9 1px";
		document.getElementById("ds_nome").style.height = "18px";
		document.getElementById("ds_nome").style.width = "420px";
	}else{
		document.getElementById("ds_nome").style.border = "solid #0c4356 1px";
		document.getElementById("ds_nome").style.height = "18px";
		document.getElementById("ds_nome").style.width = "420px";
	}
 
	if (window.document.FrmFale.ds_email.value == "") {
    	msg1 = msg1 + "O \"E-MAIL\" deve ser preenchido! \n";
		document.getElementById("ds_email").style.border = "solid #F8A7A9 1px";	
		document.getElementById("ds_email").style.height = "18px";
		document.getElementById("ds_email").style.width = "420px";
	}else{
		document.getElementById("ds_email").style.border = "solid #0c4356 1px";
		document.getElementById("ds_email").style.height = "18px";
		document.getElementById("ds_email").style.width = "420px";
	}
 
	if (window.document.FrmFale.ds_tel.value == "") {
    	msg1 = msg1 + "O \"NUMERO TELEFONE\" deve ser preenchido! \n";
		document.getElementById("ds_tel").style.border = "solid #F8A7A9 1px";
		document.getElementById("ds_tel").style.height = "18px";
		document.getElementById("ds_tel").style.width = "152px";
	}else{
		document.getElementById("ds_tel").style.border = "solid #0c4356 1px";
		document.getElementById("ds_tel").style.height = "18px";
		document.getElementById("ds_tel").style.width = "152px";
	}
 
	
	if (window.document.FrmFale.ds_assunto.value == "") {
    	msg1 = msg1 + "O \"ASSUNTO\" deve ser preenchido! \n";
		document.getElementById("ds_assunto").style.border = "solid #F8A7A9 1px";
		document.getElementById("ds_assunto").style.height = "18px";
		document.getElementById("ds_assunto").style.width = "420px";
	}else{
		document.getElementById("ds_assunto").style.border = "solid #0c4356 1px";
		document.getElementById("ds_assunto").style.height = "18px";
		document.getElementById("ds_assunto").style.width = "420px";
	}
 
	
	if (window.document.FrmFale.ds_msg.value == "") {
    	msg1 = msg1 + "A \"MENSAGEM\" deve ser preenchida! \n";
		document.getElementById("ds_msg").style.border = "solid #F8A7A9 1px";
		document.getElementById("ds_msg").style.height = "92px";
		document.getElementById("ds_msg").style.width = "420px";
	}else{
		document.getElementById("ds_msg").style.border = "solid #0c4356 1px";
		document.getElementById("ds_msg").style.height = "92px";
		document.getElementById("ds_msg").style.width = "420px";
	}
 
	if (msg1 != "") {
		alert(msg1);
		return false;
	
	}else{
		window.document.FrmFale.submit();
	}

}

function voltacampo(campo) {
	
	if ((window.document.FrmFale.ds_nome.value == "") && (campo == "ds_nome")) {
		document.getElementById("ds_nome").style.border = "1px solid  #d3d3d4";	}
	
	if ((window.document.FrmFale.ds_email.value == "") && (campo == "ds_email")) {
		document.getElementById("ds_email").style.border = "1px solid  #d3d3d4";
	}
	
	if ((window.document.FrmFale.ds_ddd.value == "") && (campo == "ds_ddd")) {
		document.getElementById("ds_ddd").style.border = "1px solid  #d3d3d4";
	}
	
	if ((window.document.FrmFale.ds_tel.value == "") && (campo == "ds_tel")) {
		document.getElementById("ds_tel").style.border = "1px solid  #d3d3d4";
	}
	
	if ((window.document.FrmFale.ds_assunto.value == "") && (campo == "ds_assunto")) {
		document.getElementById("ds_assunto").style.border = "1px solid  #d3d3d4";
	}
	
	if ((window.document.FrmFale.ds_msg.value == "") && (campo == "ds_msg")) {
		document.getElementById("ds_msg").style.border = "1px solid  #d3d3d4";
	}
	}

function formatar(src, mask) {
	var i = src.value.length;
	var saida = mask.substring(0,1);
	var texto = mask.substring(i)

	if (texto.substring(0,1) != saida) {
		src.value += texto.substring(0,1);
	}
}

function validaBusca() {
	if (window.document.Busca.ds_busca.value == "")	{
		alert("Digite uma palavra-chave para realizar a busca.");
		return false;
	} else {
		window.document.Busca.submit();
	}
}

function ChecaForm() {
	
	msg = "";
	
	if (window.document.frmEnviar.nomeremetente.value == "")	{
    	msg = msg + "O \"SEU NOME\" deve ser preenchido! \n";
		document.getElementById("nomeremetente").style.border = "solid #F8A7A9 1px";

	}else{
		document.getElementById("nomeremetente").style.border = "solid #d3d3d4 1px";
	}

	if (window.document.frmEnviar.emailremetente.value == "")	{
    	msg = msg + "O \"SEU E-MAIL\" deve ser preenchido! \n";
		document.getElementById("emailremetente").style.border = "solid #F8A7A9 1px";

	}else{
		document.getElementById("emailremetente").style.border = "solid #d3d3d4 1px";
	}
	
	if (window.document.frmEnviar.nomedestinatario.value == "")	{
    	msg = msg + "O \"NOME DO AMIGO\" deve ser preenchido! \n";
		document.getElementById("nomedestinatario").style.border = "solid #F8A7A9 1px";

	}else{
		document.getElementById("nomedestinatario").style.border = "solid #d3d3d4 1px";
	}
	
	if (window.document.frmEnviar.emaildestinatario.value == "")	{
    	msg = msg + "O \"E-MAIL DO DESTINATÁRIO\" deve ser preenchido! \n";
		document.getElementById("emaildestinatario").style.border = "solid #F8A7A9 1px";

	}else{
		document.getElementById("emaildestinatario").style.border = "solid #d3d3d4 1px";
	}
	if (window.document.frmEnviar.comentario.value == "")	{
    	msg = msg + "O \"COMENTÁRIO\" deve ser preenchido! \n";
		document.getElementById("comentario").style.border = "solid #F8A7A9 1px";

	}else{
		document.getElementById("comentario").style.border = "solid #d3d3d4 1px";
	}
		
	if (msg != "") {
		alert(msg);
		return false;
	
	}else{
		window.document.frmEnviar.submit();
	}
}


var req; 
function loadXMLDoc(url){ 
	req = null; 
	// Procura por um objeto nativo (Mozilla/Safari) 
	if (window.XMLHttpRequest){ 
		req = new XMLHttpRequest(); 
		req.onreadystatechange = processReqChange; 
		req.open("GET", url, true); 
		req.send(null); 
	// Procura por uma versão ActiveX (IE) 
	}else if (window.ActiveXObject){ 
		req = new ActiveXObject("Microsoft.XMLHTTP"); 
		if (req){ 
			req.onreadystatechange = processReqChange; 
			req.open("GET", url, true); 
			req.send(); 
		} 
	} 
} 

function processReqChange(tag){ 
	// apenas quando o estado for "completado" 
	if (req.readyState == 4) { 
		// apenas se o servidor retornar "OK" 
		if (req.status == 200) { 
			document.getElementById("galeria").innerHTML = req.responseText; 
		}else{ 
			alert("Houve um problema ao obter os dados:\n" + req.statusText); 
		} 
} 
} 

function Pag(Tipo, PaginaAtual, cd_matia) {

	if(Tipo=="P")
	PaginaAtual = (PaginaAtual + 1);
	if(Tipo=="A")
	PaginaAtual = (PaginaAtual - 1);
	
	loadXMLDoc('/includes/galeria.php?Tipo='+Tipo+'&pLngPaginaAtual='+PaginaAtual+'&cd_matia='+cd_matia);
	//document.getElementById("Conteudocentro").style.height = "100px";
}

function reading(){
	window.document.getElementById('reading').style.display = "none";
	window.document.getElementById('Divreading').style.display = "none";
}

function Atendimento() {
		
		var msg = "";
		
		if (window.document.FaleLateral.ds_nome.value == "") {
			msg = msg + "NOME em branco! \n";
		} 
	
		if (window.document.FaleLateral.ds_email.value == "") {
			msg = msg + "EMAIL em branco! \n";
		} 
	
		if (window.document.FaleLateral.ds_tel.value == "") {
			msg = msg + "TELEFONE em branco! \n";
		} 
	
		if (window.document.FaleLateral.ds_msg.value == "") {
			msg = msg + "MENSAGEM em branco! \n";
		} 
		
		if(msg == "") {
			return true;
		} else {
			msg = "CAMPO(S) EM BRANCO! \n\n" +msg;
			alert(msg);
			return false;
		}
		
}


function VerificaNews(a) {

		
		var msg = "";
		
		if (window.document.News.ds_nome.value == "Nome") {
			msg = msg + "Preencha o campo NOME! \n";
		} 
	
		if (window.document.News.ds_email.value == "E-mail") {
			msg = msg + "Preencha o campo E-MAIL! \n";
		} 
	

		if(msg == "") {

			return true;

		} else {
			msg = "CAMPO(S) EM BRANCO! \n\n" +msg;
			alert(msg);
			return false;
		}
		
}
