$(document).ready(function(){
	$("#menu li ul").fadeTo("normal", 0);
	$("#menu li").hover(
		function() { $("ul", this).fadeTo(350, 0.90); }, 
		function() { $("ul", this).fadeTo(1, 0); }
	);
	
	if (document.all) {
		$("#menu li").hoverClass ("hover");
	}
	
	$(".bpay-calculator .box .wrapper").vjustify();
	
	/*shadowbox*/
	if(document.getElementById("shadowbox-inline"))
	{
	    Shadowbox.init({
	        loadingImage: 'media/images/shadowbox/loading.gif'
	    });
	}
});

$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};

jQuery.fn.vjustify=function() {
    var maxHeight=0;
    this.each(function(){
        if (this.offsetHeight>maxHeight) {maxHeight=this.offsetHeight;}
    });
    this.each(function(){
        $(this).height(maxHeight + "px");
        if (this.offsetHeight>maxHeight) {
            $(this).height((maxHeight-(this.offsetHeight-maxHeight))+"px");
        }
    });
};