function GerarSWF(arquivo,altura,largura,ide){
document.writeln('<object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + largura + '" height="' + altura + '" id="' + ide + '" name="' + ide + '">');
document.writeln('<param name="movie" value="' + arquivo + '" />');
document.writeln('<param name="FlashVars" value="loc=en_US&htmlApp=false&gatewayURL=gwurl" />');
document.writeln('<param name="bgcolor" value="" />');
document.writeln('<param name="menu" value="false" />');
document.writeln('<param name="quality" value="high" />');
document.writeln('<param name="wmode" value="" />');
document.writeln('<embed id="globalnav-embed" src="' + arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl" bgcolor="" menu="false" quality="high" salign="tl" scale="noscale" id="' + ide + '" width="' + largura + '" height="' + altura + '"></embed>');
document.writeln('</object>');
}


function ajaxInit() {
var req;
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(ex) {
try {
req = new XMLHttpRequest();
} catch(exc) {
alert("Esse browser não tem recursos para uso do Ajax");
req = null;
}
}
}

return req;
}


function vai_form(idper){
qto=document.getElementsByName("opcao");
qtd=qto.length
ovalor=0
for(oo=0; oo < qtd; oo++){
if(qto[oo].checked==true){
ovalor=qto[oo].value
}
}
if(ovalor==0){
alert("Tem que seleccionar uma opção.")
}
else{
ajax = ajaxInit(); 
oendereco="inquerito.asp?idper="+idper+"&idres="+ovalor+"&tipo=votar"
ajax.open("GET", oendereco, true);
ajax.onreadystatechange=function() {
if(ajax.readyState==4){
document.getElementById('osconteudos').innerHTML = ajax.responseText;
olink="<a class='tipo1' style='font-size:11px;' href='javascript:inicio();'>Voltar</a>"
document.getElementById('aaccao').innerHTML = olink;
}
}
ajax.send(null);
}
}

function resultados(idper){
ajax = ajaxInit(); 
oendereco="inquerito.asp?idper="+idper+"&tipo=ver"
ajax.open("GET", oendereco, true);
ajax.onreadystatechange=function() {
if(ajax.readyState==4){
document.getElementById('osconteudos').innerHTML = ajax.responseText;
olink="<a class='tipo1' style='font-size:11px;' href='javascript:inicio();'>Voltar</a>"
document.getElementById('aaccao').innerHTML = olink;
}
}
ajax.send(null);
}

function resultados2(idper){
ajax = ajaxInit(); 
oendereco="inquerito.asp?idper="+idper+"&tipo=ver2"
ajax.open("GET", oendereco, true);
ajax.onreadystatechange=function() {
if(ajax.readyState==4){
document.getElementById('oinicio').innerHTML = ajax.responseText;
}
}
ajax.send(null);
}

function inicio(){
ajax = ajaxInit(); 
oendereco="formulario.asp"
ajax.open("GET", oendereco, true);
ajax.onreadystatechange=function() {
if(ajax.readyState==4){
document.getElementById('oinicio').innerHTML = ajax.responseText;
}
}
ajax.send(null);
}

function anteriores(){
ajax = ajaxInit(); 
oendereco="anteriores.asp"
ajax.open("GET", oendereco, true);
ajax.onreadystatechange=function() {
if(ajax.readyState==4){
document.getElementById('oinicio').innerHTML = ajax.responseText;
}
}
ajax.send(null);
}

function iframeAutoHeight(quem){
    //by Micox - elmicox.blogspot.com - elmicox.com - webly.com.br  
    if(navigator.appName.indexOf("Internet Explorer")>-1){ //ie sucks
        var func_temp = function(){
            var val_temp = quem.contentWindow.document.body.scrollHeight + 1
            quem.style.height = val_temp + "px";
        }
        setTimeout(function() { func_temp() },100) //ie sucks
    }else{
        var val = quem.contentWindow.document.body.parentNode.offsetHeight + 1
        quem.style.height= val + "px";
    }    
}