// index.js

//=======FADING TOUTS=======================================
(function ($) {
	$.fn.cross = function (options) {
    	return this.each(function (i) { 
	        var $$ = $(this);
	        var target = $$.css('backgroundImage').replace(/^url|[\(\)'"]/g, '');
	        $$.wrap('<span style="position: relative;"></span>')
	            .parent()                    
	            .prepend('<img>')
	            .find(':first-child')
	            .attr('src', target);
	        if ($.browser.msie && $.browser.version < 8) {
	            $$.css({
	                'position' : 'absolute', 
	                'left' : 0,
	                'background' : '',
	                'top' : '0'
	            });
            } else if ($.browser.msie && $.browser.version == 8) {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : '-111px'
                });
            } else if ($.browser.mozilla || $.browser.msie) {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : this.offsetTop
                });
            } else { // Safari
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : ''
                });
            }
            $$.hover(function () {
                $$.stop().animate({
                    opacity: 0
                }, 250);
            }, function () {
                $$.stop().animate({
                    opacity: 1
                }, 250);
            });
        });
	};        
})(jQuery);
    
JQ(window).bind('load', function () {
	JQ('img.fade').cross();
});
