﻿//          Default.js
//------------------------------------------------------------------------------------------------------//
var myRtr = new Array(5)
myRtr[0] = "hpRtrPackage"
myRtr[1] = "hpRtrFlight"
myRtr[2] = "hpRtrOrg"
myRtr[3] = "hpRtrSki"
myRtr[4] = "hpRtrLockal"
var nsecn = 0;
var sRot = 5;
var rtPage = 1;
var falgrt = true;

function RotatorSetCssHover(idLink) {
    document.getElementById("hpRtrPackage").className = "butt_gry";
    document.getElementById("hpRtrFlight").className = "butt_gry";
    document.getElementById("hpRtrOrg").className = "butt_gry";
    document.getElementById("hpRtrSki").className = "butt_gry";
    //document.getElementById("hpRtrSportCruise").className="mumlatzTitle";
    document.getElementById("hpRtrLockal").className = "butt_gry";
    switch (idLink) {
        case "hpRtrPackage":
            document.getElementById("hpRtrPackage").className = "butt_gry_select"; break;
        case "hpRtrFlight":
            document.getElementById("hpRtrFlight").className = "butt_gry_select"; break;
        case "hpRtrOrg":
            document.getElementById("hpRtrOrg").className = "butt_gry_select"; break;
        case "hpRtrSki":
            document.getElementById("hpRtrSki").className = "butt_gry_select"; break;
        case "hpRtrSportCruise":
            document.getElementById("hpRtrSportCruise").className = "butt_gry_select"; break;
        case "hpRtrLockal":
            document.getElementById("hpRtrLockal").className = "butt_gry_select"; break;
    }
}

function setCssHover(idLink) {
    document.getElementById("hpRtrPackage").className = "butt_gry";
    document.getElementById("hpRtrFlight").className = "butt_gry";
    document.getElementById("hpRtrOrg").className = "butt_gry";
    document.getElementById("hpRtrSki").className = "butt_gry";
    //document.getElementById("hpRtrSportCruise").className="mumlatzTitle";
    document.getElementById("hpRtrLockal").className = "butt_gry";
    switch (idLink) {
        case "hpRtrPackage":
            document.getElementById("hpRtrPackage").className = "butt_gry_select"; break;
        case "hpRtrFlight":
            document.getElementById("hpRtrFlight").className = "butt_gry_select"; break;
        case "hpRtrOrg":
            document.getElementById("hpRtrOrg").className = "butt_gry_select"; break;
        case "hpRtrSki":
            document.getElementById("hpRtrSki").className = "butt_gry_select"; break;
        case "hpRtrSportCruise":
            document.getElementById("hpRtrSportCruise").className = "butt_gry_select"; break;
        case "hpRtrLockal":
            document.getElementById("hpRtrLockal").className = "butt_gry_select"; break;
    }
}
function startclock() {
    nsecn += 1;
    if (nsecn == sRot) {
        nsecn = 0;
        setRotator(myRtr[rtPage]);
        rtPage += 1;
        if (rtPage == 5) rtPage = 0;
    }
    if (falgrt == true) setTimeout('startclock()', 1000);
}
var objRtr = null;
function setRotator_old(file) {
    nsecn = 0;
    setCssHover(file);
    if (window.XMLHttpRequest) {
        objRtr = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        objRtr = new ActiveXObject("Microsoft.XMLHTTP");
    } else {
        objRtr = null;
    }
    if (objRtr != null) {
        objRtr.onreadystatechange = RotatorResponse;
        objRtr.open("GET", "NetServices/hpRotator.aspx?file=" + file, true);
        objRtr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        objRtr.send(null);
    }
    return false;
}

function setRotator(file) {
    nsecn = 0;
    setCssHover(file);
    try {
        // Firefox, Opera 8.0+, Safari
        objRtr = new XMLHttpRequest();
    }
    catch (e) {
        // Internet Explorer
        try {
            objRtr = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            objRtr = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    
    if (objRtr != null) {
        objRtr.onreadystatechange = RotatorResponse;
        objRtr.open("GET", "NetServices/hpRotator.aspx?file=" + file, true);
        objRtr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        objRtr.send(null);
    }
    return false;
}

function RotatorResponse() {
    if (objRtr.readyState == 4) {
        if (objRtr.status == 200 || objRtr.status == 0) {
            document.getElementById("DivRotator").innerHTML = objRtr.responseText;
        }
        else { alert("Error retrieving data!"); }
    }
}
//          TopTen.js
//------------------------------------------------------------------------------------------------------//
var objTopTen = null;
function setTopTen(Des, DesHe) {
    document.getElementById("TopTenDes").innerHTML = DesHe;
    try {
        objTopTen = new XMLHttpRequest();
    }
    catch (e) {
        try {
            objTopTen = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            objTopTen = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    if (objTopTen != null) {
        objTopTen.onreadystatechange = TopTenResponse;
        objTopTen.open("GET", "NetServices/hpTopten.aspx?Des=" + Des, true);
        objTopTen.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        objTopTen.send(null);
    }
    document.getElementById("topTenArrow_PRAGUE").innerHTML = "";
    document.getElementById("topTenArrow_EILAT").innerHTML = "";
    document.getElementById("topTenArrow_BANGKOK").innerHTML = "";
    document.getElementById("topTenArrow_NEW-YORK").innerHTML = "";
    document.getElementById("topTenArrow_PARIS").innerHTML = "";
    document.getElementById("topTenArrow_AMSTERDAM").innerHTML = "";
    document.getElementById("topTenArrow_BARCELONA").innerHTML = "";
    document.getElementById("topTenArrow_ANTALYA").innerHTML = "";
    document.getElementById("topTenArrow_BUDAPEST").innerHTML = "";
    document.getElementById("topTenArrow_LONDON").innerHTML = "";
    document.getElementById("lnkTopTen_PRAGUE").className = "menu_link";
    document.getElementById("lnkTopTen_EILAT").className = "menu_link";
    document.getElementById("lnkTopTen_BANGKOK").className = "menu_link";
    document.getElementById("lnkTopTen_NEW-YORK").className = "menu_link";
    document.getElementById("lnkTopTen_PARIS").className = "menu_link";
    document.getElementById("lnkTopTen_AMSTERDAM").className = "menu_link";
    document.getElementById("lnkTopTen_BARCELONA").className = "menu_link";
    document.getElementById("lnkTopTen_ANTALYA").className = "menu_link";
    document.getElementById("lnkTopTen_BUDAPEST").className = "menu_link";
    document.getElementById("lnkTopTen_LONDON").className = "menu_link";
    
    var tmp =""
    tmp= "topTenArrow_" + Des;
    document.getElementById(tmp).innerHTML = "<img alt='" + DesHe + "' src='images/2_arrow.png' style='width:12px;height:6px;' />";
    tmp = "lnkTopTen_" + Des;
    document.getElementById(tmp).className = "menu_link_select";
    return false;
}
function TopTenResponse() {
    if (objTopTen.readyState == 4) {
        if (objTopTen.status == 200 || objTopTen.status == 0) {
            document.getElementById("DivTopTen").innerHTML = objTopTen.responseText;
        }
        else { alert("Error retrieving data!"); }
    }
}
//          lib/Mailing/Mailing.js
//------------------------------------------------------------------------------------------------------//
function setMailing(doit) {
    document.getElementById('mailingAnsv').style.display = 'none';
    var sEmail = document.getElementById("email").value;
    if (sEmail == "") {
        alert("נא הקש מייל");
        document.getElementById("email").focus();
    } else {
        setMailingSend(sEmail, doit);
    }
}
var objMailing = null;
function setMailingSend(sEmail, sDoit) {
    if (window.XMLHttpRequest) {
        objMailing = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        objMailing = new ActiveXObject("Microsoft.XMLHTTP");
    } else {
        objMailing = null;
    }
    if (objMailing != null) {
        objMailing.onreadystatechange = MailingResponse;
        objMailing.open("GET", "lib/Mailing/Mailing.aspx?email=" + sEmail + "&doit=" + sDoit, true);
        objMailing.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        objMailing.send(null);
    }
    return false;
}
function MailingResponse() {
    if (objMailing.readyState == 4) {
        if (objMailing.status == 200 || objMailing.status == 0) {
            var response = objMailing.responseText.split("|");
            document.getElementById('mailingAnsv').style.display = 'inline';
            document.getElementById("mailingAnsv").innerHTML = "<br/><b>" + response[1] + "</b>";
        }
        else { alert("Error retrieving data!"); }
    }
}
//function popUp(URL) {
//    day = new Date();
//    id = day.getTime();
//    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=200,left = 262,top = 284');");
//}

function chkSE_Change() {
    if (document.frmSE.chkSE.value == "") {
        document.frmSE.method = "post";
        document.frmSE.target = "_self";
        document.frmSE.action = "Default.asp";
    }
    if (document.frmSE.chkSE.value == "RentCur") {
        //CalUrl = "http://www.ofran.co.il/site/main.asp?SSource=NETRAVEL";
        //window.open(CalUrl,"RentCur","width=770,height=600,left=30,top=30,status=no,scrollbars=1");
        CalUrl = "http://www.netravel.co.il/basic/transport/";
        window.open(CalUrl, '_self');
    }
    if (document.frmSE.chkSE.value == "diving") {
        CalUrl = "http://www.netravel.co.il/se/Default.aspx?tac=sclub";
        window.open(CalUrl, '_self');
    }
    if (document.frmSE.chkSE.value == "local") {
        CalUrl = "http://www.netravelfly.co.il/israel/";
        window.open(CalUrl, '_self');
    }
    if (document.frmSE.chkSE.value == "SKI") {
        CalUrl = "http://www.netravel.co.il/basic/ski/";
        window.open(CalUrl, '_self');
    }
    //	if(document.frmSE.chkSE.value=="cruise"){
    //		CalUrl = "http://www.netravel.co.il/basic/cruise/";
    //		window.open(CalUrl,'_self');
    //	}
    if (document.frmSE.chkSE.value == "RELIGEOUS") {
        CalUrl = "http://www.netravel.co.il/se/Default.aspx?MainDep=RELIGEOUS";
        window.open(CalUrl, '_self');
    }
    if (document.frmSE.chkSE.value == "ng") {
        CalUrl = "http://www.netravel.co.il/se/";
        window.open(CalUrl, '_self');
    }
    if (document.frmSE.chkSE.value == "families") {
        CalUrl = "http://www.netravel.co.il/basic/families/";
        window.open(CalUrl, '_self');
    }
    if (document.frmSE.chkSE.value == "FitTraveler") {
        CalUrl = "http://www.netravel.co.il/basic/FitTraveler/";
        window.open(CalUrl, '_self');
    }
    if (document.frmSE.chkSE.value == "YOUTH") {
        CalUrl = "http://www.netravel.co.il/basic/youth/";
        window.open(CalUrl, '_self');
    }
    if (document.frmSE.chkSE.value == "sport") {
        CalUrl = "http://www.netravel.co.il/basic/sport/";
        window.open(CalUrl, '_self');
    }
    if (document.frmSE.chkSE.value == "hotel") {
        CalUrl = "http://www.netravelfly.co.il/hotels/?ref=NT";
        window.open(CalUrl, '_self');
    }
    if (document.frmSE.chkSE.value == "AIG") {
        CalUrl = "http://media.next-in.com/AIG/travel_0306/redir.asp?src=netravel";
        window.open(CalUrl, '_self');
    }
}
function GetDialogMsg(strTitle, strRemark, intSugMsg) {
    var param = new Array();
    param[0] = strTitle;
    param[1] = strRemark;
    param[2] = intSugMsg;
    var val = window.showModalDialog("http://www.netravel.co.il/lib/msgDialog/addItemDialog.htm", param, "dialogWidth:300px;dialogHeight:170px;help:no;resizable:no;status:no;scroll:no;");
}
function gt(link) {
    SearchWin = window.open(link, '_self');
}
function btnSearch_Submit() {
    var SearchWinLink
    var link
    var Des = document.getElementById("Destination").value;
    var country = document.getElementById("Country").value;
    var depDate = document.getElementById("depDate").value;
    var ReturnDate = document.getElementById("ReturnDate").value;
    if (document.frmSE.chkSE.value == "") {
        alert("נא בחר קטגוריה \n קטגוריה - שדה חובה");
        return false;
    }
    if (Des == "") {
        alert("נא הקלד יעד לנסיעה \n יעד שדה חובה");
        document.getElementById("Destination").focus()
        return false;
    }
    //	switch (document.getElementById("chkSE").value){
    //        case "package":
    //            link = "http://www.netravel.co.il/package/?Des="+Des+"&Country="+country+"&depDate="+depDate+"&ReturnDate="+ReturnDate;
    //            break; 
    //       case "AIG":
    //            link="http://media.next-in.com/AIG/travel_0306/redir.asp?src=netravel";
    //            break;
    //    }
    link = "http://www.netravel.co.il/wait.aspx?dep=" + document.getElementById("chkSE").value + "&Des=" + Des + "&Country=" + country + "&depDate=" + depDate + "&ReturnDate=" + ReturnDate;
    SearchWin = window.open(link, '_self');
}
function showCalendarWin() {
    var CalUrl
    var chkSE = document.getElementById("chkSE").value;
    var Des = document.getElementById("Destination").value;
    if (chkSE == "") {
        alert("נא בחר קטגוריה \n קטגוריה - שדה חובה");
        return false;
    }
    if (Des == "") {
        alert("נא הקלד יעד לנסיעה \n יעד שדה חובה");
        return false;
    }
    CalUrl = "http://www.netravel.co.il/lib/calendarNet/Calendar.aspx?Des=" + Des + "&flddepDate=frmSE.depDate&CurDate=" + document.getElementById("depDate").value + "&fldReturnDate=frmSE.ReturnDate&ReturnDate=" + document.getElementById("ReturnDate").value + "&Dep=" + chkSE;
    window.open(CalUrl, "CalWin", "width=500,height=300,resizable=yes,left=230,top=170");
}