﻿
function GetDialogMsg(strTitle, strRemark, intSugMsg) {
    var param = new Array();

    param[0] = strTitle;
    param[1] = strRemark;
    param[2] = intSugMsg;
    var val = window.showModalDialog("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 MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
    }
}

function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0

    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}

function Mailing(action) {
    var Phone = document.frmData.Phone.value;
    var FName = document.frmData.FName.value;
    var LName = document.frmData.LName.value;
    var EMail = document.frmData.EMail.value;
    if (action == "subscribe") {
        if (FName == "") {
            alert("נא להזין שם פרטי");
            document.frmData.FName.focus();
            return false;
        }
        if (LName == "") {
            alert("נא להזין שם משפחה");
            document.frmData.LName.focus();
            return false;
        }
    }
    if (EMail == "") {
        alert("נא להזין כתובת דואר אלקטרוני");
        document.frmData.EMail.focus();
        return false;
    }
    var link = "MailingList/subscribe.asp?action=" + action + "&FName=" + FName + "&LName=" + LName + "&EMail=" + EMail + "&Phone=" + Phone;
    var SearchWin;
    window.open(link, "_blank", "width=400,height=220,left=50,top=0,status=no,scrollbars=1");
}
function showSE() {
    document.all.frmData.src = "se.aspx";
    //	alert('ok');

}
function chkSE_Change() {
    var link = "";
    var depID = document.frmData.Department.value;
    switch (depID) {
        //	case "package": 
        //		link = "package/?Dep=package";break; 
        //	case "flight": 
        //		link = "flight/?Dep=flight";break; 
        //	case "ORGANIZED TOURS": 
        //		link = "SE/?Dep=ORGANIZED%20TOURS";break; 
        //    case "FLY AND DRIVE":{ 
        //		link="http://www.ypaymore.co.il/SE/seFlyDrive.aspx" //?DES="+Des+"&Country="+Country+"&Dep="+Dep+"&depDate="+depDate+"&ReturnDate="+ReturnDate;break; 
        //		break;} 
        //	case "CRUISE": 
        //		link = "SE/?Dep=CRUISE";break; 
        case "RentCur":
            link = "Currental.asp"; break;
        //	case "DOMESTIC TRAVE": 
        //		link = "israel/";break; 
        case "holiday":
            link = "http://www.ypaymore.co.il/holiday/"; break;

        case "SKI":
            link = "SE/SESKI.aspx"; break;
        case "DOMESTIC TRAVEL": 
            {
                link = "http://www.ypaymore.co.il/israel/"    //?DES="+Des+"&Country=israel&Dep="+Dep+"&depDate="+depDate+"&ReturnDate="+ReturnDate;break;
                break;
            }
            //	case "ACTIVE HOLIDAYS":{
            //		link="http://www.ypaymore.co.il/SE/sesport.aspx"    //?DES="+Des+"&Country="+Country+"&Dep="+Dep+"&depDate="+depDate+"&ReturnDate="+ReturnDate;break;
            //	    break;}
        case "seIsrael":
            {
                link = "http://www.ypaymore.co.il/SE/Default.aspx?Country=ISRAEL";
                break;
            }
        case "Holiday-villages":
            {
                link = "http://www.ypaymore.co.il/Holiday-villages/";
                break;
            }
        case "ng":
            link = "SE/"; break;
    }
    if (link != "") {
        var SearchWin;
        window.open(link, "_self");
    }
}

function showCalendarWin() {
    var CalUrl
    var Department = document.getElementById("Department").value;
    var Des = document.getElementById("Destination").value;

    if (Department == "") {
        var par1 = "נא בחר קטגוריה"
        var par2 = "קטגוריה - שדה חובה"
        GetDialogMsg(par1, par2, 1);
        return false;
    }
    if (Des == "") {
        //document.frmSE.submit();
        var par1 = "נא הקלד יעד לנסיעה"
        var par2 = "יעד שדה חובה"
        GetDialogMsg(par1, par2, 1);
        document.frmData.Destination.focus()
        return false;
    }
    CalUrl = "lib/CalendarNet/CalendarNetW.aspx?Des=" + Des + "&flddepDate=frmData.depDate&CurDate=" + document.getElementById("depDate").value + "&fldReturnDate=frmData.ReturnDate&ReturnDate=" + document.getElementById("ReturnDate").value + "&Dep=" + Department;
    window.open(CalUrl, "CalWin", "width=550,height=470,resizable=yes,left=230,top=170");
}

function Search_Click() {
    var Dep = document.frmData.Department.value;
    var Country = document.frmData.Country.value;
    var Des = document.frmData.Destination.value;
    var depDate = document.frmData.depDate.value;
    var ReturnDate = document.frmData.ReturnDate.value;

    var link;
    if (Dep == "DOMESTIC TRAVEL") {
        link = "http://www.ypaymore.co.il/israel/";
        SearchWin = window.open(link, '_top');
    }

    if (Dep == "") {
        alert("נא בחר סוג נופש");
        document.getElementById("Department").focus();
        return false;
    }
    if (Des == "") {
        alert("נא בחר יעד נסיעה");
        document.frmData.Destination.focus();
        return false;
    }
    
    switch (Dep) {
        case "package": 
            {
                link = "http://www.ypaymore.co.il/package/sr.aspx?DES=" + Des + "&Country=" + Country + "&Dep=" + Dep + "&depDate=" + depDate + "&ReturnDate=" + ReturnDate; break;
            }
        case "spa": 
            {
                link = "http://www.ypaymore.co.il/package/spa.aspx?DES=" + Des + "&Country=" + Country + "&Dep=" + Dep + "&depDate=" + depDate + "&ReturnDate=" + ReturnDate; break;
            }
        case "flight": 
            {
                link = "http://www.ypaymore.co.il/flight/Flights-search.aspx?DES=" + Des + "&Country=" + Country + "&Dep=" + Dep + "&depDate=" + depDate + "&ReturnDate=" + ReturnDate; break;
            }
        case "FLY AND DRIVE": 
            {
                link = "http://www.ypaymore.co.il/SE/seFlyDrive.aspx?DES=" + Des + "&Country=" + Country + "&Dep=" + Dep + "&depDate=" + depDate + "&ReturnDate=" + ReturnDate; break;
            }
        case "ORGANIZED TOURS": 
            {
                link = "http://www.ypaymore.co.il/SE/?DES=" + Des + "&Country=" + Country + "&MainDep=" + Dep + "&depDate=" + depDate + "&ReturnDate=" + ReturnDate; break;
            }
        case "CRUISE": 
            {
                link = "http://www.ypaymore.co.il/SE/?DES=" + Des + "&Country=" + Country + "&MainDep=" + Dep + "&depDate=" + depDate + "&ReturnDate=" + ReturnDate; break;
            }
        case "DOMESTIC TRAVEL": 
            {
                link = "http://www.ypaymore.co.il/israel/"; break;
            }
        case "ACTIVE HOLIDAYS": 
            {
                link = "http://www.ypaymore.co.il/SE/sesport.aspx?DES=" + Des + "&Country=" + Country + "&Dep=" + Dep + "&depDate=" + depDate + "&ReturnDate=" + ReturnDate; break;
            }
        case "ng": 
            {
                link = "SE/?DES=" + Des + "&Country=" + Country + "&Dep=" + Dep + "&depDate=" + depDate + "&ReturnDate=" + ReturnDate; break;
            }
    }
    
    SearchWin = window.open(link, '_top');
}

