var now = new Date();
var year = now.getYear();
year = (year < 1000) ? year + 1900 : year;

function load() {
    if (pageName != null) {
        setMenu(pageName);
    }
    if (document.getElementById('gallery')) {
        galleryLoad();
    }
    if (document.getElementById('preview')) {
        //previewLoad();
    }
}

function setMenu(id) {
    id = 'menu_' + pageName.toLowerCase();
    if (id && document.getElementById(id)) {
        document.getElementById(id).className = 'active';
    }
}

function search(imin) {
    document.getElementById('i').value = imin;
    document.getElementById('submit').click();
}

function propertyEmail(id, ref, address1) {
    var email = window.open('mailto:?subject=' + escape('Open Doors - ' + ref + ', ' + address1) + '&body=' + escape('http://www.open-doors.co.uk/?id=' + id));
    if (navigator.appVersion.indexOf("MSIE") == -1) {
        email.close();
    }
}