// <![CDATA[
	// opacity
	function opacity(element, value) {
		var value_noie = value / 100;
		$(element).css('filter', 'alpha(opacity=' + value + ')');
		$(element).css('-moz-opacity', value_noie);
		$(element).css('-khtml-opacity', value_noie);
		$(element).css('opacity',value_noie);
	}

	// center horizontally
	function centerHoriz(lo_que) {
		var x = parseFloat($(window).width()) / 2 - parseFloat($(lo_que).width()) / 2;
		var y = $(window).scrollTop() + $(window).height() / 2 - parseFloat($(lo_que).height()) / 2;
		x = x + 'px';
		y = y + 'px';
		$(lo_que).css({'left': x, 'top': y});
	}

	// center vertically
	function centerVert(lo_que) {
		var y = $(window).scrollTop() + $(window).height() / 2 - parseFloat($(lo_que).height()) / 2;
		$(lo_que).css({'top': y});
	}

	// image load
	function loadImg(sID, sURL) {
		$(sID).unbind("load");
		$(sID).bind("load", function() { $(this).fadeIn(); } )
		$(sID).stop(true, true).fadeOut("normal", function () { $(sID).attr('src', sURL); } );
	}
 
	$(document).ready(
		function() {
		//datepicker
		$( "#datepicker" ).datepicker();
		
		//pretty
		$("a[rel^='prettyPhoto']").prettyPhoto({
		 deeplinking: false
		});
	
		
		//mycarousel
    	$('#mycarousel').jcarousel();

		//menu
		$('#menu ul li.item').mouseenter(
				function() {
					$('ul.submenu').hide();
					$(this).find('ul.submenu').show();
				}
			);
			$('ul.submenu').hover(
				function() {},
				function() {
					$(this).hide();
		});	
			
		$('.input, .textarea').each(function(){
		 // tomamos el valor actual del input
		 var currentValue = $(this).val();
		 // en el focus() comparamos si es el mismo por defecto, y si es asi lo vaciamos
		 $(this).focus(function(){
				if( $(this).val() == currentValue ) {
					 $(this).val('');
				};
		 });
		 // en el blur, si el usuario dejo el value vacio, lo volvemos a restablecer
		 $(this).blur(function(){
				if( $(this).val() == '' ) {
					 $(this).val(currentValue);
				};
			 });
			});
			
		//last
		$("ul").find("li:last").addClass("last");
		$("ul").find("li:first").addClass("first");

		//messages
		$('.message.error .errorx, .message.success .successx, .message.notice .noticex').click(function() {
			$(this).parent().addClass('hide');
		});
		
		//When page loads...
		$(".tab_content").hide(); //Hide all content
		$("ul.tabs li:first").addClass("active").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
    
		// NO FUNCIONA CON IEXPLORER, por eso quedo comentada esta linea
		//$("ul.tabs li:active").show();
	
		//On Click Event
		$("ul.tabs li").click(function() {
	
			$("ul.tabs li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab
			$(".tab_content").hide(); //Hide all tab content
	
			var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
			$(activeTab).fadeIn(); //Fade in the active ID content
			return false;
		});
		
		// select
		/* styled selects */
		/* doesn't work in IE 6 */
		if (!($.browser.msie && $.browser.version == "6.0")) {
			$('.selectStyle').css('filter', 'alpha(opacity=0)');
			$('.selectStyle').css('opacity', '0');
			$('.selectStyle').change(function() {
				var the_option = $(this).children(":selected").text();
				$(this).parent().children('.spanStyle').text(the_option);
			});
			$('.spanStyle').each(
				function() {$(this).text($(this).parent().children('.selectStyle').children(':selected').text())}
			);
		}
		
		// END DEFAULT //
		}
	);
	
// ]]>
