var seccion = "";
document.write('<style type="text/css">body{display:none}</style>');
jQuery(function($) {
	$('body').css('display','block');
});

if(!explorer6)
{
	// ACORDEON ENLACES
	$(document).ready(function(){		
		$("#acordeon .header a").click(function(){
			if(seccion != $(this).attr("id"))
			{
				$("#acordeon .bloque:visible").slideUp("slow");
				$(this).parent().next().slideDown("slow");
			}
			seccion = $(this).attr("id");
			return false;
		});	
		
		jQuery('#acordeon').accordion({
			header: 'div.header',
			active: false,
			event: 'click',
			autoHeight: false
		});
		
		$.fn.y = function(n) {
			var result = null;
			this.each(function() {
				var o = this;
				if (n === undefined) {
					var y = 0;
					if (o.offsetParent) {
						while (o.offsetParent) {
							y += o.offsetTop;
							o = o.offsetParent;
						}
					}
					if (result === null) {
						result = y;
					} else {
						result = Math.min(result, y);
					}
				} else {
					o.style.top = n + 'px';
				}
			});
			return result;
		};
		
		//alert(explorer6);
		
		
			var posBloque = $("#contenido #izquierda #accesoRapido").y()+450;
			//alert("Posicion: "+posBloque);
			var screenHeight = screen.availHeight;
			if(screenHeight > posBloque)
				$("#contenido #izquierda #accesoRapido").css({position: "fixed"});		
			//else
			//{
				//$(window).scroll(function () { 
					//var HeightTotal = $(window).scrollTop() + screen.availHeight;
					//alert(HeightTotal);
					//if(HeightTotal  > posBloque)
						//$("#contenido #izquierda #accesoRapido").css({position: "fixed"});		
					  
				//});
			//}
		
		
		var screenWidth = document.body.clientWidth;
		//var marginLeft = screenWidth/2;
		var customWidth = screenWidth + (1980 - screenWidth)/2
		//alert(screen.width);
		//alert($("#cabecera #contCabecera #rotating-images .img-rotate").css("width"));
		$("#cabecera #contCabecera #rotating-images .img-rotate").css({ width: customWidth });
		//$("#cabecera #contCabecera #rotating-images .img-rotate").css({"margin-left" : "-"+marginLeft+"px" });
		//$("#cabecera #contCabecera .img-rotate").attr("width","800px");
	});
	
	
	// CARRUSEL CABECERA
	var image_count;
	var current_image=0;
	
	
	$(document).ready(function(){			
	  image_count = $("div.img-rotate").hide().size();
	  $("div.img-rotate:eq("+current_image+")").show();
	  setInterval(feature_rotate,5000); //time in milliseconds
	});
	
	function feature_rotate() {
	  old_image = current_image%image_count;
	  new_image = ++current_image%image_count;
	  $("div.img-rotate:eq(" + new_image + ")").fadeIn("slow", function() {
		$("div.img-rotate:eq(" + old_image + ")").fadeOut("slow");
	  });
	}
	
	
	// ANCLAS
	$(document).ready(function() {
		anchor.init()
	});
		
	anchor = {
		init : function() {
		$("a.anclas").click(function () {
			elementClick = $(this).attr("href")
			destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100 );
			$(elementClick).click();
			return false;
		})
	}
	}
}
else
{

	// ACORDEON ENLACES
	$(document).ready(function(){				
		$("#acordeon .header a").click(function(){
			if(seccion != $(this).attr("id"))
			{
				$("#acordeon .bloque:visible").slideUp("slow");
				$(this).parent().next().slideDown("slow");
			}
			seccion = $(this).attr("id");
			return false;
		});	
		
		jQuery('#acordeon').accordion({
			header: 'div.header',
			active: false,
			event: 'click',
			autoHeight: false
		
		});
		
				
		var screenWidth = document.body.clientWidth;
		//var marginLeft = screenWidth/2;
		var customWidth = screenWidth + (1980 - screenWidth)/2
		//alert(screen.width);
		//alert($("#cabecera #contCabecera #rotating-images .img-rotate").css("width"));
		$("#cabecera #contCabecera #rotating-images .img-rotate").css({ width: customWidth });

	});		
	// CARRUSEL CABECERA
	var image_count;
	var current_image=0;
	
	
	$(document).ready(function(){			
	  image_count = $("div.img-rotate").hide().size();
	  $("div.img-rotate:eq("+current_image+")").show();
	  setInterval(feature_rotate,5000); //time in milliseconds
	});
	
	function feature_rotate() {
	  old_image = current_image%image_count;
	  new_image = ++current_image%image_count;
	  $("div.img-rotate:eq(" + new_image + ")").fadeIn("slow", function() {
		$("div.img-rotate:eq(" + old_image + ")").fadeOut("slow");
	  });
	}
	
	// ANCLAS
	$(document).ready(function() {
		anchor.init()
	});
		
	anchor = {
		init : function() {
		$("a.anclas").click(function () {
			elementClick = $(this).attr("href")
			destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100 );
			$(elementClick).click();
			return false;
		})
	}
	}
}
