
/* Copyright © Website Engineers Limited */

// Email
var email = {
    load:
    function (email) {
        $("span#Email").html("<a href=mailto:" + email + ">" + email + "</a>");
    }
}

// Website
var website = {
    open:
    function (url) {
        if (url.indexOf("www.") != -1)
            window.open(url);
    }, 
    highlightThumb:
    function (li) {
        $("div.Websites ul.Thumbs li.Thumb").each(
            function () {
                $(this).removeClass("True");
            }
        );
        $(li).addClass("True");
    },
    loadWebsite:
    function (id) {
        $("div#Website").fadeOut("fast",
            function () {
                $("div#Website").html('<img src="/images/websites/backgrounds/' + id + '.jpg" />');
                $("div#Website").fadeIn("fast");
            }
        );
    },
    load:
    function () {
        $("div.Websites ul.Thumbs").jcarousel({ scroll: 1 });
        $("div.Websites ul.Thumbs li.Thumb").mouseenter(
            function () {
                website.highlightThumb(this);
                website.loadWebsite(this.id);
            }
        );
        $("li.Thumb").each(
            function () {
                $(this).attr("rel", "#site_" + this.id);
            }
        );
        $("li.Thumb[rel]").overlay({ effect: "apple", top: 0 });
        $("div.Site p.URL").click(
            function () {
                website.open($(this).html());
            }
        );
        $("div.Site img").click(
            function () {
                website.open($(this).parent().find("p.URL").html());
            }
        );
        website.loadWebsite("prestige_car_leasing");
    }
}

// Page Load
$(document).ready(
    function () {
        // Email
        email.load("info@websiteengineers.co.uk");
        // Website
        website.load();
    }
);

/* End */

