jQuery(document).ready(function() 
{	
	var valor1,valor2;
	var palres = new Array('nombres','apellidos','telefono','mail','comentario');
	$('input,textarea').focusin(function()
	{
		$(this).css('background-color','#ffffcc');
		valor1 = trim($(this).attr('value'));
		/*alert(valor1);
		for(x=0;x<palres.length;x++)
		{
			if('Ingrese '+palres[x]==valor1){ b = true; break; }
		}*/
		//if(b==true) $(this).attr('value','');
		$(this).attr('value','');
	}).focusout(function()
	{
		$(this).css('background-color','#ffffff');	
		valor2 = trim($(this).attr('value'));
		if(valor2=='') $(this).attr('value',valor1); else $(this).attr('value',valor2);
	});
		
	$('#btnenviar').click(function()
	{
		if($('#nombres').val()=='Ingrese nombres')
		{
			alert("Debe ingresar nombres");
			$(this).focus();
			return;
		}
		else if($('#comentario').val()=='Comentario')
		{
			alert("Debe ingresar comentario");
			$(this).focus();
			return;
		}
		$('#form1').submit();
	});
	
	$('#btnlimpiar').click(function()
	{
		$('#nombres').attr('value','Ingrese nombres');
		$('#apellidos').attr('value','Ingrese apellidos');
		$('#telefono').attr('value','Ingrese telefono');
		$('#mail').attr('value','Ingrese mail');
		$('#comentario').attr('value','Ingrese comentario');
	});
});

function slideSwitch() 
{
	var $active = $('#slideshow IMG.active');
	if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
	var $next =  $active.next().length ? $active.next()
	: $('#slideshow IMG:first');
	$active.addClass('last-active');
	
	$next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 1000, function() {
			$active.removeClass('active last-active');
	});
}

$(function()
{
	setInterval( "slideSwitch()", 3000 );
});
