function borrar(campo) {
document.getElementById(campo).value="";
}
function updateClock ( )
 	{
 	var hact = new Date ( );
  	var hora = hact.getHours ( );
  	var minuto = hact.getMinutes ( );
  	var segundo = hact.getSeconds ( );

  	// Pad the minutes and seconds with leading zeros, if required
  	minuto = ( minuto < 10 ? "0" : "" ) + minuto;
  	segundo = ( segundo < 10 ? "0" : "" ) + segundo;


  	// Compose the string for display
  	var hactString =  hora + ":" + minuto + ":" + segundo;

   	$("#cron").html(hactString);

 }

function actual(obj) {
   var linkList = document.getElementById("n").getElementsByTagName("a");
   for (i = 0; i < linkList.length; i++) {
      linkList[i].className = "";
   }
   obj.className = "actual";
}

function ver(obj) {
   var objetos = document.getElementById("c").getElementsByTagName("div");
   for (i = 0; i < objetos.length; i++) {
      objetos[i].className = "";
   }
   obj.className = "hidden";
}
	// Grayscale w canvas method
	function grayscale(src){
        var canvas = document.createElement('canvas');
	var ctx = canvas.getContext('2d');
        var imgObj = new Image();
		imgObj.src = src;
		canvas.width = imgObj.width;
		canvas.height = imgObj.height; 
		ctx.drawImage(imgObj, 0, 0); 
		var imgPixels = ctx.getImageData(0, 0, canvas.width, canvas.height);
		for(var y = 0; y < imgPixels.height; y++){
			for(var x = 0; x < imgPixels.width; x++){
				var i = (y * 4) * imgPixels.width + x * 4;
				var avg = (imgPixels.data[i] + imgPixels.data[i + 1] + imgPixels.data[i + 2]) / 3;
				imgPixels.data[i] = avg; 
				imgPixels.data[i + 1] = avg; 
				imgPixels.data[i + 2] = avg;
			}
		}
		ctx.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
		return canvas.toDataURL();
    }


	$(document).ready(function(){
		setInterval('updateClock()', 1000);
		$("#h > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 9000, true);
	});

		$(window).load(function(){
			
			//set and get some variables
			var thumbnail = {
				imgIncrease : 10, /* the image increase in pixels (for zoom) */
				effectDuration : 200, /* the duration of the effect (zoom and ca) */
				/* 
				get the width and height of the images. Going to use those
				for 2 things:
					make the list items same size
					get the images back to normal after the zoom 
				*/
				imgWidth : $('.tw ul li').find('img').width(), 
				imgHeight : $('.tw ul li').find('img').height() 
				
			};
			
			//make the list items same size as the images
			$('.tw ul li').css({ 
				
				'width' : thumbnail.imgWidth, 
				'height' : thumbnail.imgHeight 
				
			});
			
			//when mouse over the list item...
			$('.tw ul li').hover(function(){
				
				$(this).find('img').stop().animate({
					
					/* increase the image width for the zoom effect*/
					width: parseInt(thumbnail.imgWidth) + thumbnail.imgIncrease,
					/* we need to change the left and top position in order to 
					have the zoom effect, so we are moving them to a negative
					position of the half of the imgIncrease */
					left: thumbnail.imgIncrease/2*(-1),
					top: thumbnail.imgIncrease/2*(-1)
					
				},{ 
					
					"duration": thumbnail.effectDuration,
					"queue": false
					
				});
				
				//show the ca using slideDown event
				$(this).find('.ca:not(:animated)').slideDown(thumbnail.effectDuration);
				
			//when mouse leave...
			}, function(){
				
				//find the image and animate it...
				$(this).find('img').animate({
					
					/* get it back to original size (zoom out) */
					width: thumbnail.imgWidth,
					/* get left and top positions back to normal */
					left: 0,
					top: 0
					
				}, thumbnail.effectDuration);
				
				//hide the ca using slideUp event
				$(this).find('.ca').slideUp(thumbnail.effectDuration);
				
			});
});


jQuery(document).ready(function() {
    jQuery('#hcarousel').jcarousel({
        vertical: true,
        scroll: 1
    });
});
	
	// $(".ui-tabs-nav-item img").css({"display":"none");
	
	// On window load. This waits until images have loaded which is essential
$(window).load(function(){
		// Fade in images so there isn't a color "pop" document load and then on window load
		$(".ui-tabs-nav-item img").animate({opacity:1},500);
		
		
		// clone image
		// clone image
		$('.ui-tabs-nav-item img').each(function(){
			var el = $(this);
			el.css({"position":"absolute"}).wrap("<div class='img_wrapper' style='display: inline-block'>").clone().addClass('img_grayscale').css({"position":"absolute","z-index":"9001","opacity":"0"}).insertBefore(el).queue(function(){
				var el = $(this);
				el.parent().css({"width":this.width,"height":this.height});
				el.dequeue();
			});
			if($.browser.msie){
				this.style.filter = 'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)';
			} else {
				this.src = grayscale(this.src);
			}
		});
		
		// Fade image 
		$('.ui-tabs-nav-item img').mouseover(function(){
			$(this).parent().find('img:first').stop().animate({opacity:1}, 1000);
		})
		$('.img_grayscale').mouseout(function(){
			$(this).stop().animate({opacity:0}, 1000);
		});		
	});

$(document).ready(function() {
			/*
			*   Examples - images
			*/

			$("a#example1").fancybox();

			$("a#example2").fancybox({
				'overlayShow'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});

			$("a#example3").fancybox({
				'transitionIn'	: 'none',
				'transitionOut'	: 'none'	
			});

			$("a#example4").fancybox({
				'opacity'		: true,
				'overlayShow'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'none'
			});
			$("#oHtmlTabla a.n").fancybox({
				'width'				: '75%',
				'height'			: '75%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});

			$("a#example5").fancybox();

			$("a#example6").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity': 0.9
			});

			$("a#example7").fancybox({
				'titlePosition'	: 'inside'
			});

			$("a.example8").fancybox({
				'titlePosition'	: 'over'
			});
			$("a.gw").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity': 0.9
			});
			$("a.feu").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : 800,
				'height'        : 400
			});
			$("a.leu").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : 800,
				'height'        : 400
			});
			$("a.lot").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : 800,
				'height'        : 400
			});
			$("a.feu11").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : 800,
				'height'        : 800
			});
			$("a.brf").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : 800,
				'height'        : 800
			});
			$("a.esf").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : 800,
				'height'        : 800
			});
			$("a.esv").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : '100%',
				'height'        : '100%'
			});
			$("a.brv").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : '100%',
				'height'        : '100%'
			});
			$("a#n5").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : 220,
				'height'        : 90
			});
			$("a#n6").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : 800,
				'height'        : '100%'
			});
			$("a.lifb").fancybox({
				'titlePosition'	: 'over',
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : '100%',
				'height'        : '100%'
			});
			$("a.sn").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : 700,
				'height'        : '100%'
			});
			$("a.vir").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : '100%',
				'height'        : '100%'
			});
			$("a.con").fancybox({
				'titlePosition' :  'outside',
				'overlayColor'  :  '#000',
				'overlayOpacity':  0.9 ,
				'type'		: 'iframe',
				'autoScale'	: true,
				'width'         : 420,
				'height'        : 320
			});
			$("a[rel=os]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

			/*
			*   Examples - various
			*/

			$("#various1").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});

			$("#various2").fancybox();

			$("#various3").fancybox({
				'width'				: '75%',
				'height'			: '75%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});

			$("#various4").fancybox({
				'padding'			: 0,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
		}); 
/**/
$(document).ready(function(){
	$("#h").fadeToggle("slow", "linear").toggleClass("visible");
	$("#logo").fadeToggle("slow", "linear").toggleClass("visible");
	$("#oHtmlTabla a.nl").fancybox().trigger('click');
	$("#c").fadeToggle("slow", "linear").toggleClass("visible");
	$("#bd").fadeToggle("slow", "linear").toggleClass("visible");
	$("a#n3").click(function(){
		$(this).toggleClass("actual");
		$("#de").toggle("slide", {}, 100).toggleClass("hidden");
	});
	$("#sig a.pasar").click(function(){
		$("#oHtmlTabla").effect("slide", {}, 100);
	});
	$("#ant a.pasar").click(function(){
		$("#oHtmlTabla").effect("slide", {}, 100);
	});
	$("#yfv a.once").click(function(){
		$("#on").effect("slide", {}, 100);
		$("#do").toggleClass("hidden");
		$("#di").toggleClass("hidden");
	});
		$("a.tab").click(function () {
			
			// slide all content up
			$(".cont").slideUp();
			
			// slide this content up
			var content_show = $(this).attr("title");
			$("#"+content_show).slideDown();
		  
		});
        $('.fz').mouseenter(function(e) {
            $(this).children('a').children('img').animate({ height: '200', left: '0', top: '0', width: '144'}, 100);
            $(this).children('a').children('span').fadeIn(200);
        }).mouseleave(function(e) {
            $(this).children('a').children('img').animate({ height: '250', left: '-20', top: '-20', width: '180'}, 100);
            $(this).children('a').children('span').fadeOut(200);
        });
        $('.lim').mouseenter(function(e) {
            $(this).children('a').children('img').animate({ height: '150', left: '0', top: '0', width: '150'}, 100);
            $(this).children('a').children('span').fadeIn(200);
        }).mouseleave(function(e) {
            $(this).children('a').children('img').animate({ height: '350', left: '-20', top: '-20', width: '350'}, 100);
            $(this).children('a').children('span').fadeOut(200);
        });
        $('.lims').mouseenter(function(e) {
            $(this).children('a').children('img').animate({ height: '120', left: '0', top: '0', width: '120'}, 100);
            $(this).children('a').children('span').fadeIn(200);
        }).mouseleave(function(e) {
            $(this).children('a').children('img').animate({ height: '220', left: '-20', top: '-20', width: '220'}, 100);
            $(this).children('a').children('span').fadeOut(200);
        });
        $('.fli').mouseenter(function(e) {
            $(this).children('a').children('img').animate({ height: '160', left: '0', top: '0', width: '115'}, 100);
            $(this).children('a').children('span').fadeIn(200);
        }).mouseleave(function(e) {
            $(this).children('a').children('img').animate({ height: '278', left: '-20', top: '-20', width: '200'}, 100);
            $(this).children('a').children('span').fadeOut(200);
        });
});



