function openPopup(url, w, h) {
    width = w;
    height = h;
    x = parseInt(screen.width / 2.0) - (width / 2.0);
    y = parseInt(screen.height / 2.0) - (height / 2.0);

    var win = window.open(url, "editorPopup", "top=" + y + ",left=" + x + ",scrollbars=no,dialog=yes,minimizable=no,modal=yes,width=" + width + ",height=" + height + ",resizable=no");
}

function deleteZoneContent(ZoneArea, PageID) {

    ret = henderson.DeleteContent.DeleteZone(ZoneArea, PageID, OnComplete, OnTimeOut, OnError);
    return (true);

}

function OnComplete(args) {
    alert(args);
}

function OnTimeOut(args) {
    alert("ERROR : Service call timed out. Possbily content area has no content.");

}

function OnError(args) {
    alert("Error calling service method.");
}

function addVidLink() {
    if (window.location.href.match("http://www.vebra.com/phillipssmithdunn/property/20455836")) {

        // Get list object        
        var list = document.getElementById("s-dtbuttonlist");

        // Create list item instance
        var li = document.createElement("li");

        // Add HTML
        li.innerHTML = "<a href=\"http://www.phillipsland.com/virtual-tours\"><span style=\"color:Red;\">Exclusive</span> Video Tour</a>";

        // Add to ul
        list.appendChild(li);

    }

    $('ul#menu li:nth-child(3)').after('<li><a href="http://www.phillipsland.com/auctions">Auction Search</a></li>');

    if (document.location.href.indexOf("/property/search/results/") > 0) {
        if ($(".PropStatus").html() == "UNDER OFFER") {
            $(".PropStatus").parent().parent().next().next().append('<img src="http://www.phillipsland.com/graphics/under_offer.gif" class="offer"/>');
        }
        if ($(".PropStatus").html() == "Let Agreed") {
            $(".PropStatus").parent().parent().next().next().append('<img src="http://www.phillipsland.com/graphics/let_agreed.gif" class="offer"/>');
        }
    } else {
        if ($(".PropStatus").html() == "UNDER OFFER") {
            $(".PropStatus").parent().parent().next().find("#s-dtimg").append('<img src="http://www.phillipsland.com/graphics/under_offer.gif" class="offer"/>');
        }
        if ($(".PropStatus").html() == "Let Agreed") {
            $(".PropStatus").parent().parent().next().next().append('<img src="http://www.phillipsland.com/graphics/let_agreed.gif" class="offer"/>');
        }
    }

    $("#s-additional").append('<div id="rfdist"><label for="alo">Regions</label><select name="alo" id="alo"><option value="ALL">All</option><option value="Barnstaple">Barnstaple</option><option value="Bideford">Bideford</option><option value="Braunton">Braunton</option></select></div>');
    $("input[name]=='action'").val("search");

    $('ul#fade').innerfade({ speed: 1000, timeout: 5000, type: 'sequence', containerheight: '267px' });
    //$('#letting').hide();
    $('link[type=text/css]').attr("href", "http://www.phillipsland.com/css/vebra.css");
    elem = $("#results");
    if (elem.hasClass("db2")) {
        $("#menu").children().each(function () {
            $("#menu").children("li").removeClass("on");
            $("#letting").addClass("on");
        });
        $("#rightCol h1").text("Lettings Search");
    } else {
        $("#rightCol h1").text("Sales Search");
        $("#letting").removeClass("on");
    }

    if ($.cookie("alo") != null) {
        $("select#alo").val($.cookie("alo"));
    }

}

1.
jQuery(document).ready(function () {
    jQuery('#qs-rentals').change(function () {
        jQuery('#qs-regions').hide();
    });
    jQuery('#qs-sales').change(function () {
        jQuery('#qs-regions').show();
    });
    $("label[for='qs-rentals']").text("Lettings");
    $('select#alo').change(function () {
        $.cookie('alo', $(this).val());
    });
});

jQuery.cookie = function (name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
