// <![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() {
	
			//slideshow
			$('.slideshow').cycle({ 
					fx:'fade', 
					speed: 2500 
			 });
			
			//opacity
			opacity('#carousel .panel a img', 60);
			$('#carousel .panel').mouseenter(
					function() {
						$(this).css({'border' : '3px solid #FFFFFF'});
						$(this).find('img').css({'opacity' : 1.0});
					}
				);
			$('#carousel .panel').mouseleave(
					function() {
						$(this).css({'border' : '3px solid #F3F6DB'});
						$(this).find('img').css({'opacity' : 0.6});
					}
				);

			$('#carousel .panel a').click(
				function() {
					$('#carousel .panel').removeClass('active');
					$(this).parent().addClass('active');					
					return false;
				}
			);
			
			//Click Image
			$('#carousel .panel a').click(
				function() {
					var urlProdFicha = $(this).attr('href');
					//loadImg('ID'.'URL')
					loadImg('#imgPrinc', urlProdFicha);
					return false;
				}
			);
			
			//tooltips
			$('#socialnetwork ul li').mouseenter(
					function() {
						$('ul.submenu').hide();
						$(this).find('span.tooltips').show();
					}
				);
			$('#socialnetwork ul li').mouseleave(
					function() {
						$(this).find('span.tooltips').hide();
					}
				);
			
			// onmouseover
			$('#mainmenu ul li.item').mouseenter(
					function() {
						$('ul.submenu').hide();
						$(this).find('ul.submenu').show();
					}
				);
			$('#mainmenu ul li.item').mouseleave(
					function() {
						$(this).find('ul.submenu').hide();
					}
				);
						
			/* 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).find("option:selected").text();
					$(this).parent().children('.spanStyle').text(the_option);
				});
				$('.spanStyle').each(
					function() {$(this).text($(this).parent().children('.selectStyle').children(':selected').text())}
				);
			}
			
			 $('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);
					};
				 });
				});

			// no dotted outline for IE in As
			if ($.browser.msie) {
				$('a').focus(
					function() {
						$(this).blur()
					}
				);
			}
			
		// END DEFAULT //
		}
	);
	
// ]]>
