﻿function showCalendarWin() {
    var CalUrl
    var chkSE = "orgtours";
    var Des = document.all.Destination.value;
    if (Des != "0") {
        //document.frmSE.submit();
    } else {
        var par1 = "נא בחר יעד לנסיעה"
        var par2 = "יעד שדה חובה"
        alert("נא בחר יעד לנסיעה");
        return false;
    }
    CalUrl = "../../lib/calendarNet/CalendarNetW.aspx?Des=" + Des + "&flddepDate=frmSE.tbFromDate&CurDate=&fldReturnDate=frmSE.tbReturnDate&ReturnDate=&Dep=" + chkSE;
    window.open(CalUrl, "CalWin", "width=550,height=300,resizable=yes,left=230,top=170");

}
function CheckData() {
    if ((document.getElementById("Destination").value == "") || (document.getElementById("Destination").value == "0")) {

        alert("אנא בחר יעד");
        document.getElementById("Destination").focus();
        return false;
    }
    var Dep = "";
    var link = "../../SE/?Des=" + document.getElementById("Destination").value + "&Country=" + document.getElementById("Country").value + "&Dep=" + Dep
    link = link + "&MainDep=ORGANIZED%20TOURS&depDate=" + document.getElementById("tbFromDate").value + "&ReturnDate=" + document.getElementById("tbReturnDate").value;

    SearchWin = window.open(link, "_self");
}

var obj;

function GetDataViaAJAX() {
    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        obj = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        // code for IE6, IE5
        obj = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else {
        alert("Your browser does not support XMLHTTP!");
    }
    if (obj != null) {
        obj.onreadystatechange = ProcessResponseXML;

        var url = "../../NetServices/seOrganizedToursDes.aspx";
        url = url + "?country=" + document.getElementById("Country").value;
        obj.open("GET", url, true);
        obj.send(null);
    }
    return false;
}

function ProcessResponseXML() {
    //process xml returned from AJAX request
    if (obj.readyState == 4) {
        if (obj.status == 200) {
            document.all.divDes.innerHTML = obj.responseText; //html;
            if (document.all.grdTable != null && document.all.grdTable.rows.length > 0) {
                fnResizeTPPReport();
            }
        }
        else {
            alert("Error retrieving data!");
        }
    }
}
