// JavaScript Document

$(document).ready(function() {
						  

	$('.link a').css({
        "opacity": 0
    });	
	
	$('.selected-top a').css({
        "opacity": 1
    });
	
	$('.selected-top .imagesm img').css({
        "opacity": 0.2
    });

	$('.link').mouseenter(function () {
		var condition = $(this).parent().hasClass('selected-top');
		if(!condition){
		var imageID = $("a", this).attr('rel');
		var number = imageID.replace('image0',"");
		
		
        $('.'+ imageID).stop().animate({
            "opacity": .20
        }, 'fast');
		$("a", this).stop().css({
            "opacity": 1
        });
		var selector ="bottom-"+number;
		selector ="#nav-bottom a."+selector;
	
		Cufon(selector, {color: '#8c7d59', fontFamily: 'HelveticaNeue100'});
		}
    
    });
	
	$('.link').mouseleave(function () {
		var condition = $(this).parent().hasClass('selected-top');
		if(!condition){
		var imageID = $("a", this).attr('rel');
		var number = imageID.replace('image0',"");
		
        $('.'+ imageID).stop().animate({
            "opacity": 1
        }, 'fast');
		$("a", this).stop().animate({
            "opacity": 0
        }, 'fast');
		
		var selector ="bottom-"+number;
		selector ="#nav-bottom a."+selector;
	
		Cufon(selector, {color: '#26443c', fontFamily: 'HelveticaNeue100'});
		}

    
    });
	
	$('#nav-bottom a').mouseenter(function () {
		var condition = $(this).hasClass('selected');
		if(!condition){
		var fadeid = $(this).attr('rel');
		
		var imageID = $('.'+fadeid+' a').attr('rel');

		
        $('.'+ imageID).stop().animate({
            "opacity": .20
        }, 'fast');
		$('.'+fadeid+' a').stop().css({
            "opacity": 1
        });
		}
		
	});
	
	$('#nav-bottom a').mouseleave(function () {
		var condition = $(this).hasClass('selected');
		if(!condition){
		var fadeid = $(this).attr('rel');
		
		var imageID = $('.'+fadeid+' a').attr('rel');

		
        $('.'+ imageID).stop().animate({
            "opacity": 1
        }, 'fast');
		$('.'+fadeid+' a').stop().animate({
            "opacity": 0
        }, 'fast');
		}
		
	});

});
