function ajax(url,variaveis,divconteudo) {
    var http = false;
    if(navigator.appName == "Microsoft Internet Explorer") {
      http = new ActiveXObject("Microsoft.XMLHTTP");
    } else {
      http = new XMLHttpRequest();
    }
    http.onreadystatechange=function stateChanged() { 
    if (http.readyState==4 || http.readyState=="complete"){ 
           document.getElementById(divconteudo).innerHTML=http.responseText
        }else
           document.getElementById(divconteudo).innerHTML="<p class='style23'><center>Aguarde...</center></p>";
    };
    http.open("GET",url+'?'+variaveis,true);
    http.send(null);
}

function abrir_janela_01(){
	 janela=window.open("teoria/teoria.htm","","width=670,height=500,menubar=no,scrollbars=no,status=no,toolbar=no");
}
function abrir_janela_02(){
	 janela=window.open("Teoria\teoria.htm","","menubar=no,scrollbars=no,status=no,toolbar=no");
	 //interceptacao de erro na abertura da janela
	 text = "Se a janela não está abrindo\ntalvez seja porque voce tenha um\nprograma bloqueador de pop-up!\nObservacao » O windows XP service pack 2\nbloqueia pop-ups!";
	 if(janela == null) { alert(text); return; }
	 //fim
	 janela.resizeTo(670,500);
	 janela.moveTo(0,0);
	 animar();
}

function abrejanela(URL){
   window.open(URL,"","width=785,height=550,scrollbars=YES");
}

function abrejanela2(URL){
   window.open(URL,"VIDEO","width=370,top=200, left=200, height=345,scrollbars=NO");
}
function abrejanela3(URL){
   window.open(URL,"","width=785,height=550,scrollbars=YES");
}

function envia_email(){
	 var nome2  = document.getElementById("nome").value;
	 var telefone2 = document.getElementById("telefone").value;
	 var email2 = document.getElementById("email").value;
	 var assunto2 = document.getElementById("assunto").value;
	 var mensagem2 = document.getElementById("mensagem").value;
	 var tipo_atendimento2 = document.getElementById("tipo_atendimento").value;
	
	if (nome2 =='' || telefone2 == '' || email2 == '' || assunto2 == '' || mensagem2 == '') {
		window.alert("Dados em branco! Por favor, preencha todos os campos!");
	}
	else {
	
		var poststr2 = "nome=" + encodeURI(nome2) + "&telefone=" + encodeURI(telefone2) + "&email=" + encodeURI(email2) +
				      "&assunto=" + encodeURI(assunto2) + "&mensagem=" + encodeURI(mensagem2) + "&tipo_atendimento=" + encodeURI(tipo_atendimento2);
	
		ajax('contato_social.php',poststr2,'conteudo');
	}
}

function limpa_email(){
	 document.getElementById("nome").value = "";
	 document.getElementById("telefone").value = "";
	 document.getElementById("email").value = "";
	 document.getElementById("assunto").value = "";
	 document.getElementById("mensagem").value = "";
	 document.getElementById("tipo_atendimento").value = "";
	 document.getElementById("nome").focus();
}

function flash(file, width, height){
	document.write("<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='" + width + "' height='" + height + "'> \n");
    document.write("<param name='movie' value='" + file + "'>\n");
    document.write("<param name='quality' value='high'> \n");
    document.write("<param name='wmode' value='transparent'> \n");
    document.write("<embed src='" + file + "' quality='high' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "'></embed> ");
    document.write("</object>");
}
