(function($) {
    $.fn.customFadeIn = function(speed, callback) {
        $(this).fadeIn(speed, function() {
                if(jQuery.browser.msie)
                        $(this).get(0).style.removeAttribute('filter');
                if(callback != undefined)
                        callback();
        });
    };
    $.fn.customFadeOut = function(speed, callback) {
        $(this).fadeOut(speed, function() {
                if(jQuery.browser.msie)
                        $(this).get(0).style.removeAttribute('filter');
                if(callback != undefined)
                        callback();
        });
    };
})(jQuery);

$(document).ready(function(){
	$('ul.xt_languages li:first').addClass('first');
	$('.pay-off-banner .gallery').cycle({pause:true});
	$('.sub-menu-wrapper').css({'opacity':0});
	
});

$(window).load(function(){
	var payOffHeight = $('div.pay-off').height();
	var subMenuHeight = $('ul.sub-menu').height();
	var bottomPadding = $('div.sub-menu-wrapper').css('padding-bottom');
	var bottomPaddingFloat = parseFloat(bottomPadding);
	
	var paddingForSubMenuWrapper = payOffHeight - (subMenuHeight + bottomPaddingFloat);
	$('div.sub-menu-wrapper').css('padding-top',paddingForSubMenuWrapper);
	$('.sub-menu-wrapper').hide();
	$('.sub-menu-wrapper').css({'opacity':100});
	//$('.sub-menu-wrapper').show();
	$('.sub-menu-wrapper').customFadeIn(2500,function(){});
	//$('.sub-menu-wrapper').animate({'opacity':100},2500);
});
