﻿
window.onload = function() {

    setTimeout(function() {
        var context = $("#engine");
        $(':checked', context).each(function(i, elem) {
            $("[id^='" + this.id + "div']").css("background-color", "#ffff99");
        })
    }, 500);

}

$("input[type='checkbox'][name='add']").live("click", function() {

    var cbox = $("input[type='checkbox'][id='" + this.id + "']");
    if (cbox.attr('checked')) {
        cbox.attr('checked', true);
        $("[id^='" + this.id + "div']").css("background-color", "#ffff99");
    } else {
        cbox.attr('checked', false);
        $("[id^='" + this.id + "div']").css("background-color", "#fff");
    }

});

function findlistmap(address) {

    var qString = '';
    var qString2 = '';
    var pCheck = '';

    qString = location.search;
    array = qString.split('&');
    qString = '';

    for (var i = 0; i < array.length; i++) {
        pCheck = array[i].substr(0, 3);
        if (pCheck == '?ft' | pCheck == 'fc=' | pCheck == 'fp=') {
            qString += array[i] + '&';
        }
        else if (pCheck == 'ml=') {
            qString2 += array[i] + '&';
        }
    }

    address = 'fa=' + encodeURI(address) + '&';
    window.location.href = "map.php" + qString + address + qString2 + "pt=0&pp=0&pv=8&ps=1&pn=0&pw=0&pl=1";

}

