
/* PNG Hacks */
$(function() {
    // Supersleight
    try { $('#pageHome .contentRandom table td.text').supersleight(); } catch (e) { }
});

/* Popup Window */

// noConflict :: http://docs.jquery.com/Core/jQuery.noConflict
// jQuery.noConflict();
$(function() {
    // IE PNG Fix :: http://www.campbellsdigitalsoup.co.uk/about/png-fix
    //jQuery("img[@src$=png], #id, .class").pngfix();

    // PopupWindow :: http://plugins.jquery.com/project/PopupWindow
    var profiles = {
        popupToolsPrint: { height: 500, width: 600, center: 1, scrollbars: 1, status: 0, resizable: 1 },
        popupToolsEmail: { height: 400, width: 500, center: 1, scrollbars: 1, status: 0, resizable: 1 }
    };
    $(".tool").popupwindow(profiles);

    // jQuery Lightbox :: http://leandrovieira.com/projects/jquery/lightbox
    try {
        $('a[rel*=lightbox]').lightbox({
            overlayBgColor: '#FFF',
            overlayOpacity: 0.8,
            containerBorderSize: 10,
            containerResizeSpeed: 400,
            imageLoading: 'images/lightbox/loading.gif',
            imageBtnClose: 'images/lightbox/close.gif',
            imageBtnPrev: 'images/lightbox/prevlabel.gif',
            imageBtnNext: 'images/lightbox/nextlabel.gif'
        });
    } catch (e) { }

    // Your code goes here
    // $("table.table-mycart").empty();


});

function closeGBWindowFromPopup(noRefresh) {
    if (!noRefresh) {
        top.location.href = top.location.href;
    }
    top.GB_hide();
}


$(function() {
    $(".elementAccordion h3:last").css("border-bottom", "none");

    $(".elementAccordion h3:first").addClass("active");
    $(".elementAccordion .expContent:not(:first)").hide();

    $(".elementAccordion h3").click(function() {
        $(this).next("div").slideToggle("slow")
		.siblings("div:visible").slideUp("slow");
        $(this).toggleClass("active");
        $(this).siblings("h3").removeClass("active");
        return false;
    });

});

/* CaseStudy Scroll Text */
scrollText = function(event, element) {
    if (event === null) return;

    var $this = /li/i.test(event.target.nodeName) ? $(element).children('div') : $(element);
    var $span = $this.children('span');
    var spanHeight = $span.height();


    if (event.type == 'mouseenter' && spanHeight > 55) $span.stop().animate({ top: ($this.height() - ($this.height() * 2)) }, 1000);
    else {
        $span.stop().animate({ top: "1px" });
    }
};


$(function() {
    $('.Scrolltext').bind('mouseenter', function(event) {
        scrollText(event, this);
    }).bind('mouseleave', function(event) {
        scrollText(event, this);
    }).parent().bind('mouseenter', function(event) {
        scrollText(event, this);
    }).bind('mouseleave', function(event) {
        scrollText(event, this);
    });
});


/* Add extra class on Main menu item */
$(function() {
    var navItems = $("#nav-main ul li").nextAll();
    if (navItems.length > 0) {
        for (var i = 0; i < navItems.length; i++)
            $(navItems[i]).addClass("list" + (i + 1));
    }
});


/* Random Rotator HomePage */
$(function() {
    var newsTable = $("#pageHome .contentRandom > table");
    if (newsTable.length > 0) {
        for (var i = 0; i < newsTable.length; i++)
            $(newsTable[i]).attr("id", "table" + (i + 1));
    }
});

$(function() {
var homelink = $("#pageHome .contentRandom table td.text a.BigButton");
    $(homelink).wrap('<span class="btn btn-c-a" />');
    $(".moduleBreadcrumbs li.divider").html("/");
});



