/*!
* jQuery estudio crealia
*/

/* eliminar marco de enlaces */
jQuery(function($) {
	$('a').focus(function() {
		$(this).trigger('blur');
	});
	$('.display').focus(function() {
		$(this).trigger('blur');
	});
	
	$(window).resize(function() {
		// on hover
		$("#vintra").css(  
		{
			position: 'fixed',  
			left: ($(window).width() - 504) / 2 + 'px',  
			top: ($(window).height() -  244) / 2 + 'px'   
		});
		// ubicar fondo de ventana intranet
		$("#fintra").css(  
		{
			position: 'fixed',
			width: $(window).width() + 'px',
			height: $(window).height() + 'px'    
		});
	});
	
	$(window).resize();

});

// efectos menu
jQuery(function($) {
	// nos aseguramos de no aplicar el efecto a versiones de ie que no soporten este código
	if ($.browser.msie && $.browser.version < 7) return;

	$('#nav')
		.removeClass('efecto')
		.find('a')
		.append('<span class="hover" />').each(function () {
			var $span = $('> span.hover', this).css('opacity', 0);
	});

	$('#nav li').hover(function () {
		// on hover
		$(this).find('span.hover:first').stop().fadeTo('fast', 1);
	}, function () {
		// off hover
		$(this).find('span.hover:first').stop().fadeTo('fast', 0);
	});

});

// efectos menu redes
jQuery(function($) {
	// nos aseguramos de no aplicar el efecto a versiones de ie que no soporten este código
	if ($.browser.msie && $.browser.version < 7) return;
		
	$('#red')
		.removeClass('efecto')
		.find('a')
		.append('<span class="hover" />').each(function () {
			var $span = $('> span.hover', this).css('opacity', 0);
	});
		
	$('#red li').hover(function () {
		// on hover
		$(this).find('span.hover:first').stop().fadeTo('fast', 1);
	}, function () {
		// off hover
		$(this).find('span.hover:first').stop().fadeTo('fast', 0);
	});
	
});

// efectos menu opinión
jQuery(function($) {
	// nos aseguramos de no aplicar el efecto a versiones de ie que no soporten este código
	if ($.browser.msie && $.browser.version < 7) return;
		
	$('#opinion')
		.removeClass('efecto')
		.find('a')
		.append('<span class="hover" />').each(function () {
			var $span = $('> span.hover', this).css('opacity', 0);
	});
		
	$('#opinion li').hover(function () {
		// on hover
		$(this).find('span.hover:first').stop().fadeTo('fast', 1);
	}, function () {
		// off hover
		$(this).find('span.hover:first').stop().fadeTo('fast', 0);
	});
	
});

/* formulario buscador */
jQuery(function($) {

	var $buscador = $('#formbuscador li').addClass('sublabel');
	var $buscadorLabel = $buscador.find('label');
	$buscadorLabel.show();

	$('#buscar').focus(function() {
		if ($(this).val() == $(this).attr('defaultValue')) {
			//$(this).val('');
			//$(this).addClass('imputactivo');
			$buscadorLabel.fadeTo('fast', 0.3);
		}
	});

	$('#buscar').keyup(function() {
		if ($(this).val() != '') {
			//$(this).val('');
			//$(this).addClass('imputactivo');
			$buscadorLabel.fadeTo('fast', 0);
		} else {
			$buscadorLabel.fadeTo('fast', 0.3);
		}
	});

	$('#buscar').blur(function() {
		if ($(this).val() == '') {
			//$(this).removeClass('imputactivo');
			//$def = $(this).attr('defaultValue');
			//$(this).val($def);
			$buscadorLabel.fadeTo('fast', 1);
		}
	});

	$('#formbuscador').submit(function () {
		//if ($('#usuario').val() == $('#usuario').attr('defaultValue') || $('#password').val() == $('#password').attr('defaultValue')) {
		if ($('#buscar').val() == '') {
			return false;				   
		} else {
				
		}
	});

});
