var xmlHttp;

function sendResponse()
{
    var url= "includes/contactoxml_asp.asp?" + "dp_nombre="+document.getElementById('dp_nombre').value + "&dp_email="+document.getElementById('dp_email').value + "&dp_tel1="+document.getElementById('dp_tel1').value + "&dp_observaciones="+document.getElementById('dp_observaciones').value + "&language=CAST&form_action=" + document.getElementById('form_action').value;
    document.getElementById("errorBox").style.display = 'block';
    document.getElementById('errorBox').innerHTML= "Enviando tus datos de contacto..."
    xmlHttp=GetXmlHttpObject(stateChanged)
    xmlHttp.open("POST", url , true)
    xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
    xmlHttp.send(null)
}

function stateChanged()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        //document.getElementById("errorBox").innerHTML=xmlHttp.responseText
        document.getElementById("formcontent").style.height="312px"
        document.getElementById("formcontent").innerHTML="<img src='images/bn_contacto.jpg' />"
    }
}

function GetXmlHttpObject(handler)
{
    var objXmlHttp=null

    if (navigator.userAgent.indexOf("Opera")>=0)
    {
        alert("Error: Opera not supported...")
        return;
    }
    if (navigator.userAgent.indexOf("MSIE")>=0)
    {
        var strName="Msxml2.XMLHTTP"
        if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
        {
            strName="Microsoft.XMLHTTP"
        }
        try
        {
            objXmlHttp=new ActiveXObject(strName)
            objXmlHttp.onreadystatechange=handler
            return objXmlHttp
        }
        catch(e)
        {
            alert("Error: Scripting for ActiveX might be disabled...")
            return
        }
    }
    if (navigator.userAgent.indexOf("Mozilla")>=0)
    {
        objXmlHttp=new XMLHttpRequest()
        objXmlHttp.onload=handler
        objXmlHttp.onerror=handler
        return objXmlHttp
    }
} 

