$(document).ready(function(){
	$("#section").css({opacity:0});
	$("#subsection").css({display:"none"});
	//$(".subsection-wrap").css({display:"none"});
	/*$(".cerrado").css({display:"none"});
	if (jQuery.support.opacity)
		$("#list").css({opacity:0});*/
		
	if (($('#content').offset().top)>=130)
		$('#content').css({top:'50%'});	
	if (($('#content').offset().top)<130)
		$('#content').css({top:'320px'});
	
	$('#content-wrap .mostrar').css({opacity:1,width:'350px'});
	$('#section .mostrar').css({width:'350px'});
	
	$('#section').animate({opacity:1},1000);
	$('#location a').css({display:'block'});
	$('.jScrollPaneContainer').css({display:'block'});
			
	$('#section-wrap').jScrollPane({showArrows:false, scrollbarWidth:10, scrollbarMargin:30, arrowSize:0});
	
	
	$(window).bind('resize', function() {
		if (($('#content').offset().top)>=130)
			$('#content').css({top:'50%'});	
		if (($('#content').offset().top)<130)
			$('#content').css({top:'320px'});
	});
	
	
	$('#menu li a, #logo a').each(function(i) {
		if ($(this).attr('rel').length == 0) {
			$(this).attr('rel', $(this).attr('href'));
			$(this).attr('href', 'javascript: void(0);');
			
			$(this).click(function() {
				$('#section').animate({opacity:0},500,function() {
					$('#location a').css({display:'none'});
					$('.jScrollPaneContainer').css({display:'none'});
				});	
				$('#subsection').hide('drop',{direction:'right'},500);
				setTimeout('window.location.href = \''+ $(this).attr('rel') +'\';',500);
			});
			
			$(this).hover(function() {
				if ($(this).parent().attr('class')!='activo')
					$(this).find('.menu').attr('src',$(this).find('.menu').attr('src').replace('1.png','2.png'));
			},function(){
				if ($(this).parent().attr('class')!='activo')
					$(this).find('.menu').attr('src',$(this).find('.menu').attr('src').replace('2.png','1.png'));
		    });
		}
	});
});
