(function ($) {
    $.fn.crossMainMenu = 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)
                .attr('border', "0");
            // css for windows
            if ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) {
            	
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : 0
                });
            } else if ($.browser.msie && navigator.appVersion.indexOf("Win")!=-1) {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : 0
                });
            } else if ($.browser.opera && $.browser.version < 9.5 && navigator.appVersion.indexOf("Win")!=-1) {                
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : "0"
                });
            } else {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'top' : 0,
                    'background' : ''
                });
            }
            
            
            // css for mac
            if ($.browser.mozilla && navigator.appVersion.indexOf("Mac")!=-1) {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : 0
                });
            } else if ($.browser.msie && navigator.appVersion.indexOf("Mac")!=-1) {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : 0
                });
            } else if ($.browser.opera && $.browser.version < 9.5 && navigator.appVersion.indexOf("Mac")!=-1) {                
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : "0"
                });
            } else {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'top' : 0,
                    'background' : ''
                });
            }
            
            
            // css for linux
            if ($.browser.mozilla && navigator.appVersion.indexOf("Linux")!=-1) {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : 0
                });
            } else if ($.browser.msie && navigator.appVersion.indexOf("Linux")!=-1) {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : 0
                });
            } else if ($.browser.opera && $.browser.version < 9.5 && navigator.appVersion.indexOf("Linux")!=-1) {                
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : "0"
                });
            } else {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'top' : 0,
                    'background' : ''
                });
            }
            
            
            $$.hover(function () {
                $$.stop().animate({
                    opacity: 0
                }, 250);
            }, function () {
                $$.stop().animate({
                    opacity: 1
                }, 250);
            });
        });
    };
    
})(jQuery);



(function ($) {
    $.fn.crossSubMenu = 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)
                .attr('style', 'border: 0px solid black;')
                .attr('border', "0");
            
            
            
            //css for windows
            if(navigator.appVersion.indexOf("Win")!=-1) {
	            if ($.browser.mozilla) {
	                $$.css({
	                    'position' : 'absolute', 
	                    'left' : 0,
	                    'background' : '',
	                    'top' : -4
	                });
	            } else if ($.browser.msie) {
	                $$.css({
	                    'position' : 'absolute', 
	                    'left' : 0,
	                    'background' : '',
	                    'top' : -18
	                });
	            } else if ($.browser.opera && $.browser.version < 9.5) {                
	                $$.css({
	                    'position' : 'absolute', 
	                    'left' : 0,
	                    'background' : '',
	                    'top' : "-80"
	                });
	            } else {
	                $$.css({
	                    'position' : 'absolute', 
	                    'left' : 0,
	                    'top' : -4,
	                    'background' : ''
	                });
	            }
            }
            
            // css for mac
            if(navigator.appVersion.indexOf("Mac")!=-1) {
	            if ($.browser.mozilla) {
	                $$.css({
	                    'position' : 'absolute', 
	                    'left' : 0,
	                    'background' : '',
	                    'top' : -7
	                });
	            } else if ($.browser.opera) {              
	                $$.css({
	                    'position' : 'absolute', 
	                    'left' : 0,
	                    'background' : '',
	                    'top' : "0"
	                });
	            } else {
	                $$.css({
	                    'position' : 'absolute', 
	                    'left' : 0,
	                    'top' : -7,
	                    'border' : '0px',
	                    'border-bottom-style' : 'none',
	                    'outline' : 'none',
	                    'background' : ''
	                });
	            }
	        }
            
            
            // css for linux
            if ($.browser.mozilla && navigator.appVersion.indexOf("Linux")!=-1) {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : -4
                });
            } else if ($.browser.msie && navigator.appVersion.indexOf("Linux")!=-1) {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : -18
                });
            } else if ($.browser.opera && $.browser.version < 9.5 && navigator.appVersion.indexOf("Linux")!=-1) {                
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : "-80"
                });
            }
            
            
            $$.hover(function () {
                $$.stop().animate({
                    opacity: 0
                }, 200);
            }, function () {
                $$.stop().animate({
                    opacity: 1
                }, 200);
            });
        });
    };
    
})(jQuery);
