﻿jQuery.noConflict();

function openWindow(url, x, y) {
    l = Math.round((screen.width - x) / 2);
    t = Math.round((screen.height - y) / 2);
    w = window.open(url, 'popup', 'scrollbars=yes,status=no,top=' + t + ',left=' + l + ',width=' + x + ',height=' + y + ',toolbar=no,resizable=yes');
    w.focus();
}

function swapImage(id, img) {
    jQuery('#' + id).attr('src', img);
}

function enlargeImage() {
    var img = "";
    var imgObj;
    if (jQuery('#promotionDetails').find('img').length > 0) {
        imgObj = jQuery('#promotionDetails').find('img')[0];
    } else {
        imgObj = jQuery('#thumbnailImage').find('img')[0];
    }
    img = jQuery(imgObj).attr('src');

    openWindow(img, 400, 400);
}

jQuery(document).ready(function ($) {
    // start the carousel
    $('#divCarousel').nivoSlider({ effect: 'fade', pauseTime: 3000 });

    $(".goArticleDetail").hover(
        function () {
            $(this).attr("src", "/images/Retail/SG/Parkway Parade/listing_arrow_f2.jpg");
        },
        function () {
            $(this).attr("src", "/images/Retail/SG/Parkway Parade/listing_arrow.jpg");
        }
    );

    $("a#bookmark").click(function (event) {
        event.preventDefault();

        var bookmarkUrl = this.href;
        var bookmarkTitle = "Parkway Parade";

        if ($.browser.msie || $.browser.webkit) // For IE Favorite
        {
            window.external.AddFavorite(bookmarkUrl, bookmarkTitle);
        }
        
        return false;
    });
});
