﻿
//
// ProductDetails.ascx.js
//

/// <reference path="../Edentity.Global.js" />
/// <reference path="../External/jquery-1.3.2-vsdoc2.js" />


Edentity.RegisterNamespace("Whiskas.Modules.ProductDetails");

(function(PD, $) {

    var prevImg = null;
    var popupTotalHealthSystem = null;

    PD.OnInit = function(popupTotalHealthSystemID) {

        var divMainContentArea = $("div.MainContentArea");
        divMainContentArea.addClass("ProductDetailsBackground");

        // Set the background to the left side area ..
        divMainContentArea.parent().parent().prev().addClass("ProductDetailsBackground");

        popupTotalHealthSystem = $('#' + popupTotalHealthSystemID);
    };

    PD.OnMouseOver = function(img) {

        if (prevImg != null) {
            $(prevImg).attr('src', $(prevImg).attr('ImageUrl'));
        }
        $(img).attr('src', $(img).attr('MouseOverImageUrl'));
        $(img).parent().next().html($(img).prev().html());

        // Saves prev selected img
        prevImg = img;
    };

    PD.ShowTHSPopup = function() {

        if (popupTotalHealthSystem != null) {

            //alert($("div.ProductTemplate").parent().prev().width());

            $.blockUI.defaults.fadeOut = 0;
            $.blockUI.defaults.fadeIn = 0;
            $.blockUI({
                message: popupTotalHealthSystem,
                css: {
                    border: 'none',
                    backgroundColor: 'transparent',
                    cursor: 'default',
                    top: '100px', left: '20%'
                }
            });
        }
    };

    PD.HideTHSPopup = function() {
        if (popupTotalHealthSystem != null) {
            $.unblockUI();
            popupTotalHealthSystem.hide();
        }
    };

})(Whiskas.Modules.ProductDetails, jQuery);
