﻿//show map, access field for array propids and availability
function showmap(id) {
    var text = GetObj('srchResultPropIDs', '0').value
    var combo = GetObj('cbSrchArrivalDate', '0');
    var dtselect = combo.options[combo.selectedIndex].value;
    var comboArrive = GetObj('cbSrchArrivalDay', '1');
    var dtArrive = comboArrive.get_value();
    if (text != "") {
        var oWnd = radopen("/maps.aspx?id=" + id + '&props=' + text + '&dtselect=' + dtselect + '&dtarrive=' + dtArrive, "mapsWindow");
        oWnd.center();
    }
}

function onClientClose(oWnd, args) {
    var arg = args.get_argument();
    if (arg) {
        location.replace('/vacation-rentals/' + arg + '.aspx');
    }
}

function savesearch() {
    //var text = document.getElementById("<%= szSA.ClientID %>").value;
    var oWnd = radopen("/savesearch.aspx", "mapsWindow");
    oWnd.center();
}

function emailResults() {
    //var text = document.getElementById("<%= szSA.ClientID %>").value;
    var oWnd = radopen("/tellfriend.aspx?id=1", "mapsWindow");
    oWnd.center();
}

function OnClientBeforeValueChange(sender, args) {
    var tooltip = GetObj('ttBed', '1');
    ResetToolTipLocation(tooltip);
    tooltip.set_text(args.get_newValue());
}

function OnClientSlideStart(sender, args) {
    var tooltip = GetObj('ttBed', '1');
    ShowRadToolTip(tooltip, sender);
}

function OnClientSlideEnd(sender, args) {
    var tooltip = GetObj('ttBed', '1');
    tooltip.hide();
}

function slBedChange(sender, eventArgs) {
    var mydiv = document.getElementById("BedStart1");
    var mydiv2 = document.getElementById("BedEnd1");
    mydiv.innerHTML = sender.get_selectionStart();
    mydiv2.innerHTML = sender.get_selectionEnd();
}

function ShowRadToolTip(tooltip, slider) {
    var activeHandle = slider.get_activeHandle();
    if (!activeHandle) return;

    tooltip.set_targetControl(activeHandle);
    ResetToolTipLocation(tooltip);
}

function ResetToolTipLocation(tooltip) {
    if (!tooltip.isVisible())
        tooltip.show();
    else
        tooltip.updateLocation();
}
function RequestStart() {
    var s = GetObj('srchSearchtype', '0').value;
    var c = GetObj('srchCriteria', '0').value;
    //alert(srch);
    if (s < 25 || s > 37) {
        if (c < 25 || c > 37) {
            GetObj('ckCorolla', '0').disabled = true;
            GetObj('ckSouthernShores', '0').disabled = true;
            GetObj('ckDuck', '0').disabled = true;
            GetObj('ckKittyHawk', '0').disabled = true;
            GetObj('ckKillDevilHills', '0').disabled = true;
            GetObj('ckNagsHead', '0').disabled = true;
        }
    }
    if (s != 3 && s != 6 && s != 9 && s != 10 && s != 22 && s != 26 && s != 27 && s != 28 && s != 29 && s != 30 && s != 31) {
        if (c != 3 && c != 6 && c != 9 && c != 10 && c != 22 && c != 26 && c != 27 && c != 28 && c != 29 && c != 30 && c != 31) {
            GetObj('cklo0', '0').disabled = true; 
            GetObj('cklo1', '0').disabled = true;
            GetObj('cklo2', '0').disabled = true;
            GetObj('cklo4', '0').disabled = true;
            GetObj('cklo8', '0').disabled = true;
            GetObj('cklo16', '0').disabled = true;
            GetObj('cklo32', '0').disabled = true;
        }
    }
    if (s == 1 ||c==1) {
        GetObj('ckam2', '0').disabled = true;
        GetObj('ckam4', '0').disabled = true;
        GetObj('ckam8', '0').disabled = true;
        GetObj('ckam16', '0').disabled = true;
        GetObj('ckam64', '0').disabled = true;
        GetObj('ckam256', '0').disabled = true;
        GetObj('ckam512', '0').disabled = true;
        GetObj('ckam1024', '0').disabled = true;
    }
    else if (s == 2 || s == 48 || c == 2 || c == 48) {
        GetObj('ckam4', '0').disabled = true;
        GetObj('ckam8', '0').disabled = true;
        GetObj('ckam16', '0').disabled = true;
        GetObj('ckam64', '0').disabled = true;
        GetObj('ckam256', '0').disabled = true;
        GetObj('ckam512', '0').disabled = true;
        GetObj('ckam1024', '0').disabled = true;
    }
    else if (s == 4 || c == 4) {
        GetObj('ckam1', '0').disabled = true;
        GetObj('ckam2', '0').disabled = true;
        GetObj('ckam4', '0').disabled = true;
        GetObj('ckam16', '0').disabled = true;
        GetObj('ckam64', '0').disabled = true;
        GetObj('ckam256', '0').disabled = true;
        GetObj('ckam512', '0').disabled = true;
        GetObj('ckam1024', '0').disabled = true;
    }
    else if (s == 5 || c == 5) {
        GetObj('ckam1', '0').disabled = true;
        GetObj('ckam2', '0').disabled = true;
        GetObj('ckam4', '0').disabled = true;
        GetObj('ckam8', '0').disabled = true;
        GetObj('ckam64', '0').disabled = true;
        GetObj('ckam256', '0').disabled = true;
        GetObj('ckam512', '0').disabled = true;
        GetObj('ckam1024', '0').disabled = true;
    }
    else if (s == 11 || c == 11) {
        GetObj('ckam1', '0').disabled = true;
        GetObj('ckam2', '0').disabled = true;
        GetObj('ckam4', '0').disabled = true;
        GetObj('ckam8', '0').disabled = true;
        GetObj('ckam16', '0').disabled = true;
        GetObj('ckam256', '0').disabled = true;
        GetObj('ckam512', '0').disabled = true;
        GetObj('ckam1024', '0').disabled = true;
    }
    else if (s == 12 || c == 12) {
        GetObj('ckam1', '0').disabled = true;
        GetObj('ckam2', '0').disabled = true;
        GetObj('ckam8', '0').disabled = true;
        GetObj('ckam16', '0').disabled = true;
        GetObj('ckam64', '0').disabled = true;
        GetObj('ckam256', '0').disabled = true;
        GetObj('ckam512', '0').disabled = true;
        GetObj('ckam1024', '0').disabled = true;
    }
    else if (s == 40 || c == 40) {
        GetObj('ckam1', '0').disabled = true;
        GetObj('ckam2', '0').disabled = true;
        GetObj('ckam4', '0').disabled = true;
        GetObj('ckam8', '0').disabled = true;
        GetObj('ckam16', '0').disabled = true;
        GetObj('ckam64', '0').disabled = true;
        GetObj('ckam256', '0').disabled = true;
        GetObj('ckam1024', '0').disabled = true;
    }
    else if (s == 41 || c == 41) {
        GetObj('ckam1', '0').disabled = true;
        GetObj('ckam2', '0').disabled = true;
        GetObj('ckam4', '0').disabled = true;
        GetObj('ckam8', '0').disabled = true;
        GetObj('ckam16', '0').disabled = true;
        GetObj('ckam64', '0').disabled = true;
        GetObj('ckam256', '0').disabled = true;
        GetObj('ckam512', '0').disabled = true;
    }
    else {
        GetObj('ckam1', '0').disabled = true;
        GetObj('ckam2', '0').disabled = true;
        GetObj('ckam4', '0').disabled = true;
        GetObj('ckam8', '0').disabled = true;
        GetObj('ckam16', '0').disabled = true;
        GetObj('ckam64', '0').disabled = true;
        GetObj('ckam256', '0').disabled = true;
        GetObj('ckam512', '0').disabled = true;
        GetObj('ckam1024', '0').disabled = true;
    }
}
// && is AND  || is OR  != is NOT EQUALS  == is EQUALS
function ResponseEnd() {
    var s = GetObj('srchSearchtype', '0').value;
    var c = GetObj('srchCriteria', '0').value;
    if (s < 25 || s > 37) {
        if (c < 25 || c > 37) {
            GetObj('ckCorolla', '0').disabled = false;
            GetObj('ckSouthernShores', '0').disabled = false;
            GetObj('ckDuck', '0').disabled = false;
            GetObj('ckKittyHawk', '0').disabled = false;
            GetObj('ckKillDevilHills', '0').disabled = false;
            GetObj('ckNagsHead', '0').disabled = false;
        }
    }
    if (s != 3 && s != 6 && s != 9 && s != 10 && s != 22 && s != 26 && s != 27 && s != 28 && s != 29 && s != 30 && s != 31) {
        if (c != 3 && c != 6 && c != 9 && c != 10 && c != 22 && c != 26 && c != 27 && c != 28 && c != 29 && c != 30 && c != 31) {
            GetObj('cklo0', '0').disabled = false;
            GetObj('cklo1', '0').disabled = false;
            GetObj('cklo2', '0').disabled = false;
            GetObj('cklo4', '0').disabled = false;
            GetObj('cklo8', '0').disabled = false;
            GetObj('cklo16', '0').disabled = false;
            GetObj('cklo32', '0').disabled = false;
        }
    }
    if (s == 1 || c == 1) {
        GetObj('ckam2', '0').disabled = false;
        GetObj('ckam4', '0').disabled = false;
        GetObj('ckam8', '0').disabled = false;
        GetObj('ckam16', '0').disabled = false;
        GetObj('ckam64', '0').disabled = false;
        GetObj('ckam256', '0').disabled = false;
        GetObj('ckam512', '0').disabled = false;
        GetObj('ckam1024', '0').disabled = false;
    }
    else if (s == 2 || s == 48 || c == 2 || c == 48) {
        GetObj('ckam4', '0').disabled = false;
        GetObj('ckam8', '0').disabled = false;
        GetObj('ckam16', '0').disabled = false;
        GetObj('ckam64', '0').disabled = false;
        GetObj('ckam256', '0').disabled = false;
        GetObj('ckam512', '0').disabled = false;
        GetObj('ckam1024', '0').disabled = false;
    }
    else if (s == 4 || c == 4) {
        GetObj('ckam1', '0').disabled = false;
        GetObj('ckam2', '0').disabled = false;
        GetObj('ckam4', '0').disabled = false;
        GetObj('ckam16', '0').disabled = false;
        GetObj('ckam64', '0').disabled = false;
        GetObj('ckam256', '0').disabled = false;
        GetObj('ckam512', '0').disabled = false;
        GetObj('ckam1024', '0').disabled = false;
    }
    else if (s == 5 || c == 5) {
        GetObj('ckam1', '0').disabled = false;
        GetObj('ckam2', '0').disabled = false;
        GetObj('ckam4', '0').disabled = false;
        GetObj('ckam8', '0').disabled = false;
        GetObj('ckam64', '0').disabled = false;
        GetObj('ckam256', '0').disabled = false;
        GetObj('ckam512', '0').disabled = false;
        GetObj('ckam1024', '0').disabled = false;
    }
    else if (s == 11 || c == 11) {
        GetObj('ckam1', '0').disabled = false;
        GetObj('ckam2', '0').disabled = false;
        GetObj('ckam4', '0').disabled = false;
        GetObj('ckam8', '0').disabled = false;
        GetObj('ckam16', '0').disabled = false;
        GetObj('ckam256', '0').disabled = false;
        GetObj('ckam512', '0').disabled = false;
        GetObj('ckam1024', '0').disabled = false;
    }
    else if (s == 12 || c == 12) {
        GetObj('ckam1', '0').disabled = false;
        GetObj('ckam2', '0').disabled = false;
        GetObj('ckam8', '0').disabled = false;
        GetObj('ckam16', '0').disabled = false;
        GetObj('ckam64', '0').disabled = false;
        GetObj('ckam256', '0').disabled = false;
        GetObj('ckam512', '0').disabled = false;
        GetObj('ckam1024', '0').disabled = false;
    }
    else if (s == 40 || c == 40) {
        GetObj('ckam1', '0').disabled = false;
        GetObj('ckam2', '0').disabled = false;
        GetObj('ckam4', '0').disabled = false;
        GetObj('ckam8', '0').disabled = false;
        GetObj('ckam16', '0').disabled = false;
        GetObj('ckam64', '0').disabled = false;
        GetObj('ckam256', '0').disabled = false;
        GetObj('ckam1024', '0').disabled = false;
    }
    else if (s == 41 || c == 41) {
        GetObj('ckam1', '0').disabled = false;
        GetObj('ckam2', '0').disabled = false;
        GetObj('ckam4', '0').disabled = false;
        GetObj('ckam8', '0').disabled = false;
        GetObj('ckam16', '0').disabled = false;
        GetObj('ckam64', '0').disabled = false;
        GetObj('ckam256', '0').disabled = false;
        GetObj('ckam512', '0').disabled = false;
    }
    else {
        GetObj('ckam1', '0').disabled = false;
        GetObj('ckam2', '0').disabled = false;
        GetObj('ckam4', '0').disabled = false;
        GetObj('ckam8', '0').disabled = false;
        GetObj('ckam16', '0').disabled = false;
        GetObj('ckam64', '0').disabled = false;
        GetObj('ckam256', '0').disabled = false;
        GetObj('ckam512', '0').disabled = false;
        GetObj('ckam1024', '0').disabled = false;
    }
    var scnt = GetObj('UpdateCount', '0').value;
    //alert(scnt);
    if (scnt == 0) {
        GetObj('btnUpdateSearch', '0').disabled = true;
        GetObj('lblResults', '0').disabled = true;
    }
    else {
        GetObj('btnUpdateSearch', '0').disabled = false;
        GetObj('lblResults', '0').disabled = false;
    }

}
