$(document).ready(function(){
    $("#header").prepend("<div id='shadow'></div>");
    var h = $("#menu li.selected a").height();
    var w = $("#menu li.selected a").width();
    var o = $("#menu li.selected a").position();
    var oc = $("#menu li.selected a").attr('class');
    if(o!=null){
        $("#shadow").css({
            'margin-left':o.left
            });
        $("#shadow").css({
            'margin-top':o.top
            });
    }
    $("#shadow").css({
        'width':w
    });
    $("#shadow").css({
        'height':h
    });
    
    $("#shadow").animate({
        //marginLeft: o.left,
        //marginTop: o.top,
        //width: w,
        //height: h,
        backgroundColor: '#' + oc
    }, {
        duration: 800,
        queue: false
    });
    
    
    $("#menu li a").hover(function(){
        var ww = $(this).width();
        var oo = $(this).position();
        var oc = $(this).attr('class');
        
		
		
			
        $("#shadow").animate({
            marginLeft: oo.left,
            width: ww,
            backgroundColor: '#' + oc
        }, {
            duration: 800,
            queue: false
        });
        $(this).animate({
            color:'#ffffff'
        }, {
            duration: 200,
            queue: false
        });
        
        
    }, function(){
		
        $(this).animate({
            color:'#8B8C8C'
        }, {
            duration: 500,
            queue: false
        });
        if ($("#shadow").attr('title') == '0') 
            $("#shadow").animate({
                opacity: 0.1,
                marginTop: "+=100px"
            }, {
                duration: 500,
                queue: true
            }, 500);
        $("#shadow").attr('title', '1');
        $(this).animate({
            opacity: 1
        }, {
            duration: 900
        });
        var w = $("#menu li.selected a").width();
        var o = $("#menu li.selected a").position();
        
        var oc = $("#menu li.selected a").attr('class');
        
        $("#shadow").animate({
            marginLeft: o.left,
            width: w,
            backgroundColor: '#' + oc
        }, {
            duration: 800,
            queue: false
        });
        
        
    });
    
    $("#menu li a").click(function(){
        $("#shadow").animate({
            backgroundColor:'#000000'
        }, {
            duration: 300,
            queue: true
        });
        $("#shadow").attr('title', '0');
        $(this).animate({
            opacity: 0.01
        }, {
            duration: 500,
            queue: true
        });
        
    });
    
    $("#ar2oor").hover(function(){
    
    
        $(this).animate({
            opacity: 0.7,
        }, {
            duration: 300,
            queue: false
        });
        
        
    }, function(){
        $(this).animate({
            opacity: 1,
        }, {
            duration: 800,
            queue: false
        });
        
    });
    
}, function(){
    });


