/**
 * JS: Global Events
 * @author Darío Ruellan <druellan@ecimtech.com>
 * @copyright ecimTech 2011
 */

$(function()
{
	$("#quickcontact").validator({ lang: 'es' });
	// supply the language
	$.tools.validator.localize("es", {
		'*'			: 'Revise esta casilla',
		':email'  	: 'El email parece incorrecto',
		':number' 	: 'Sólo se aceptan números',
		':url' 		: 'La URL no parece correcta',
		'[max]'	 	: 'El valor debe ser menor que $1',
		'[min]'		: 'El valor debe ser mayor que $1',
		'[required]'	: 'Esta casilla es obligatoria'
	});
	
	if ( $.browser.msie && $.browser.version <= 8 )
	{
		$("form#quickcontact input[type=text]").each(function()
		{
			$(this).val( $(this).attr("placeholder") );
			$(this).focus(function(){
				if ( !$(this).hasClass("gotFocus") )
				{
					$(this).addClass("gotFocus");
					$(this).val("");
				}
			});
		});
		$("form#quickcontact button[type=submit]").click(function()
		{
			document.forms["quickcontact"].submit();
		});
	}

});
