﻿/// <reference path="../../Javascript/JQuery/jquery-1.3.1.js" />

$(document).ready(function() {
    
    //Add alphaImage on images with .png filename or ashx since they can be png in ie6 only
    if ($.browser.msie && $.browser.version < 7) {
        $("img").each(function() {
            if (this.src.indexOf(".png") > -1 || (this.src.indexOf(".ashx") > -1)) $(this).addClass("alphaImage");
        });
    }
    //Enable expandable content
    $(".expand, .fold").each(function() {
        $(this).click(function() {
            if ($(this).hasClass("fold"))
                $(".expandableContent", $(this).parent()).slideUp(50);
            else
                $(".expandableContent", $(this).parent()).slideDown(50);
            $(this).toggleClass("fold");
            $(this).toggleClass("expand");
        });
    });

    $(".expandableContent, .nonExpandableContent").each(function() {
        $(this).click(function() {
            $(this).prev(".expand, .fold").click();
        });
    });

    //Enable hover buttons
    $(".button").each(function() {
        $(this).hover(function() { $(this).toggleClass("hoverEffect"); }, function() { $(this).toggleClass("hoverEffect"); });
    });

    //Add hovereffects on product items
    $(".productItem").each(function() {
        $(this).mouseover(function() { $(this).addClass("details"); $(this).mouseout(function() { $(this).removeClass("details"); }); });
    });

    //Enable foldable menus
/*    $("#productMenu .level2").each(function() {
        $(this).find(".selected").each(function() { $(this).parent().css("display", "block"); });
    });
    $("#productMenu .level1.selected").each(function() {
        $(this).next("ul.level2").each(function() { $(this).css("display", "block"); });
    });
    $("#productMenu").find(".level1.hasChildren a").each(function() {
        $(this).click(function(e) {
            if (!$(this).parent().hasClass("level2")) e.preventDefault();

            $(this).parent().toggleClass("selected");
            if ($(this).parent().hasClass("selected")) {
                $(this).next(".submenu").each(function() { $(this).css("display", "block"); });
            }
            else {
                $(this).next(".submenu").each(function() { $(this).css("display", "none"); });
            }
        });
    });*/

    //showDialogue("/Ajax/Controlviewer.aspx?control=ShowEpiProperty&pageID=26&propertyname=mainbody");
});