function IniciaAjax()
{
        var ajax;
        if(window.XMLHttpRequest)
        {          // Mozilla, Safari,...
                ajax = new XMLHttpRequest();
        }
        else if (window.ActiveXObject)
        {        // IE
                ajax = new ActiveXObject("Msxml2.XMLHTTP");
                if (!ajax)
                {
                  ajax = new ActiveXObject("Microsoft.XMLHTTP");
                }
        }
        else
        {
           alert("Seu navegador não possui suporte a essa aplicação!");
        }
        return ajax;
}

function Fechar()
{
        document.getElementById("Banners").innerHTML= "<img src='b1.jpg' border='0' />";
}

function buscaVideo()
{
        var so = new SWFObject("flash/exibe_video.swf", "Teste", "616", "354", "9", "#000000");
        var indice = document.getElementById('ID_Video').selectedIndex;
        if(indice ==0)
        {
            so.addVariable("flashVarText", "erro.flv");
            so.write("Video");
            document.getElementById("SobreVideo").innerHTML= "";
        }
        else
        {
              document.getElementById("SobreVideo").innerHTML= "<div align='center'><br><img src='images/carregando.gif' border='0' /></div>";
              var valor = document.getElementById('ID_Video').options[indice].getAttribute('value');
              so.addVariable("flashVarText", valor);
              so.write("Video");
              ajax = IniciaAjax();
              if(ajax)
              {
                       ajax.onreadystatechange = function()
                       {
                               if(ajax.readyState == 4)
                               {
                                       if(ajax.status == 200)
                                       {
                                           document.getElementById("SobreVideo").innerHTML=ajax.responseText;
                                       }
                                       else
                                       {
                                           alert(ajax.statusText);
                                       }
                               }
                       }
                       dados = 'ID='+valor;
                       ajax.open('POST', 'buscavideo.php', true);
                       ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                       ajax.send(dados);
              }
        }
}