$(document).ready(function(){
	
				/*POSICIONAMIENTO CONTENIDOS*/
				var wz = $(window).width();
				var hz = $(window).height();

				var numLogos = wz/229;
				var numFilas = 14/numLogos;
				var alturaTotal = 95*numFilas;

				$('#content4_inner').css( { height : alturaTotal});

				var posmenu4 = (hz/2) - ($("#content4_inner").height()/2);
				$("#content4_inner").animate( { top : posmenu4/2}, 300 );
				
				var seleccionado;
				var texto;
				var textosel;
				var inicio;
	
				var windowH2 = $(window).height()-92;
				var windowW2  = $(window).width();
				
				$('#noticias ul'
				).css( { 
				height : windowH2,
				});

				$("#content1").hide();
				$("#content2").hide();	
				$("#content3").hide();
				$("#content4").hide();
				$("#content5").hide();
				$("#content6").hide();
				$("#catalogo").hide();
				
				$("#image2_select").hide();	
				$("#image3_select").hide();
				$("#image4_select").hide();
				$("#image5_select").hide();
				$("#image6_select").hide();
				
				$("#subimage1").show();
				$("#subimage2").show();
				$("#subimage1_select").hide();
				$("#subimage2_select").hide();	
				

			$("div.menu_inner ul li").each(function(){
				 		
					var num = $(this).attr("class").split("_")[1];
					var image = "div#image"+num;
					var boton = "li.boton_"+num;
					var content = "div#content"+num;					
					var image_select = "div#image"+num+"_select";
					
					$(this).append("<li id='magic-line'></li>");
   					 var $magicLine = $("#magic-line");
					 
					if(typeof inicio == "undefined"){
						
						$("#image1").hide();
						$("#image1_select").show();
						
						$.backstretch("images/inicio3.jpg",{speed: 300});	
												
						$magicLine.stop().animate({
						left: 0,
						width: 100
						});
						
						inicio = 1;
					} 

					$(image).click(function(){
	
						$(content).slideDown(900,"easeOutExpo");
					
						
						if(num == 1){
							
								$("#content5_inner").hide();
							
								$.backstretch("images/inicio3.jpg");											
								$magicLine.stop().animate({
								left: 0,
								width: 100
							});
							
						}else if(num==2){
							
								$("#content5_inner").hide();
							
								$.backstretch("images/inicio8.jpg");
								$magicLine.stop().animate({
								left: 92,
								width: 100
							});
						}else if(num==3){
								
								$("#content5_inner").hide();
								
								$magicLine.stop().animate({
								left: 192,
								width: 100
							});
						}else if(num==4){
							
								$("#content5_inner").hide();
								
								$.backstretch("images/inicio2.jpg");	
								$magicLine.stop().animate({
								left: 292,
								width: 100
							});
						}else if(num==5){
								
								$("#content5_inner").show();
								
								$.backstretch("images/inicio5.jpg");	
								
								$magicLine.stop().animate({
								left: 392,
								width: 100
							});
						
						}else if(num==6){
							
								$("#content5_inner").hide();
							
								$.backstretch("images/contacto.jpg");	
								
								$magicLine.stop().animate({
								left: 492,
								width: 100
							});
						
						}
						
					
							
						if(typeof seleccionado == "undefined"){
							
							if(inicio == 1){
								
							$("#image1").show();
							$("#image1_select").hide();
						   }
								
					
							
							if(num==3){
								
								$("#subimage1").click(function(){
									
										
										 
										$('#subcontent1').fadeIn(600,"easeOutExpo");
										$('#subcontent2').fadeOut(600,"easeOutExpo");
										$("#catalogo").show();
										
										$('#subcontent1'
										).css( { 
										height : windowH2,
										width : windowW2	
										});
										
										$("#subimage1").hide();
										$("#subimage1_select").show();
										$("#subimage2").show();
										$("#subimage2_select").hide();
								});
							
								$("#subimage2").click(function(){
									
										$('#subcontent1').fadeOut(600,"easeOutExpo");
										$('#subcontent2').fadeIn(600,"easeOutExpo");
										$("#catalogo").show();	
										
										$('#subcontent2'
										).css( { 
										height : windowH2,
										width : windowW2	
										});																	
									
										$("#subimage1").show();
										$("#subimage1_select").hide();
										$("#subimage2").hide();
										$("#subimage2_select").show();
								});
								
								
							
							}
							
							$(image).hide();
							$(image_select).show();	
							
							texto = image;
							textosel = image_select;
							seleccionado = content;	
										
							
						}else{
							
						
							
							if(num==3){
								
								$("#subimage1").click(function(){
									
										
										 
										$('#subcontent1').fadeIn(600,"easeOutExpo");
										$('#subcontent2').fadeOut(600,"easeOutExpo");
										$("#catalogo").show();
										
										$('#subcontent1'
										).css( { 
										height : windowH2,
										width : windowW2	
										});
										
										$("#subimage1").hide();
										$("#subimage1_select").show();
										$("#subimage2").show();
										$("#subimage2_select").hide();
								});
							
								$("#subimage2").click(function(){
									
										$('#subcontent1').fadeOut(600,"easeOutExpo");
										$('#subcontent2').fadeIn(600,"easeOutExpo");
										$("#catalogo").show();		
										
										$('#subcontent2'
										).css( { 
										height : windowH2,
										width : windowW2	
										});																
									
										$("#subimage1").show();
										$("#subimage1_select").hide();
										$("#subimage2").hide();
										$("#subimage2_select").show();
								});
								
								
							
							}
							
							$('#subcontent1').fadeOut(600,"easeOutExpo");
							$('#subcontent2').fadeOut(600,"easeOutExpo");
							$("#subimage1").show();
							$("#subimage1_select").hide();
							$("#subimage2").show();
							$("#subimage2_select").hide();
							$("#catalogo").hide();
							
							$(texto).show();
							$(image).hide();									
							$(textosel).hide();
							$(image_select).show();									
							texto = image;
							textosel = image_select;	
												
							$(seleccionado).slideUp(400,"easeOutExpo", function(){								
								$(content).slideDown(900,"easeOutExpo");
									seleccionado = content;
									
											
							});
						
						}
							
					});
					
				});


               /* $(queCatalogo+' > img').hover(function () {
                    var $this   = $(this);
                    $this.stop().animate({'opacity':'1.0'},200);
                },function () {
                    var $this   = $(this);
                    $this.stop().animate({'opacity':'0.4'},200);
                })*/
                
				/*ampliar imagen*/
				hs.graphicsDir = 'highslide/graphics/';
				hs.align = 'center';
				hs.transitions = ['expand', 'crossfade'];
				hs.wrapperClassName = 'dark borderless floating-caption';
				hs.fadeInOut = true;
				hs.dimmingOpacity = .75;
			
				// Add the controlbar
				if (hs.addSlideshow) hs.addSlideshow({
					//slideshowGroup: 'group1',
					interval: 5000,
					repeat: false,
					useControls: true,
					fixedControls: 'fit',
					overlayOptions: {
						opacity: .6,
						position: 'bottom center',
						hideOnMouseOut: true
					}
				});
               
            
			
				
});// JavaScript Document
