/* payPerView.php
 * AJAX, manda llamar mostrarHorario.php
 */

var xmlHttp = createXmlHttpRequestObject();

function mostrarHorario(dia, mes, anio, pelicula){
    
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
        
        var url = "jsAjax/payPerViewXML.php?";
        url = url + "dia=" + dia;
        url = url + "&mes=" + mes;
        url = url + "&anio=" + anio;
        url = url + "&movie=" + pelicula;

        xmlHttp.open("GET", url, true);
        xmlHttp.onreadystatechange = handleServerResponse;
        xmlHttp.send(null);
    }
}

function handleServerResponse(){
    if (xmlHttp.readyState == 4){
        if (xmlHttp.status == 200){
			
            var div = document.getElementById("divHoras");
            div.innerHTML = xmlHttp.responseText;
        }else{
            alert("Hubo problema accesando al server: " + xmlhttp.statusText);
        }
    }
}

function createXmlHttpRequestObject(){
    var xmlHttp;
    if (window.ActiveXObject){
        try{
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch (e){
            xmlHttp = false;
        }

    }else{
        try{
            xmlHttp = new XMLHttpRequest();
        }catch(e){
            xmlHttp = false;
        }
    }

    if (!xmlHttp){
        alert("Error al crear xmlHttpObject");
    }else{
        return xmlHttp;
    }
}




