$(document).ready(function(){
	//todos los enlaces a google maps se asocian a lightbox
	$('a[href^=http://maps.google.com]').fancybox({
		'imageScale'     	: false
	});
	// todos los enlaces hacia una imagen se asocian a lightbox
	$('a[href$=.jpg]').fancybox({
		'imageScale'     	: false
	});
	// configuramos el registro de newsletter
	var raiz = '/xtranet2008/';
	var ajaxIco = raiz+'media/img/ajax.activity.gif';
	var nlUrl = raiz+'suscribete.php';
	$('form[name=newsletter]').bind('submit',function(){
		$(this).find('input[type=submit]').after('<img src="'+ajaxIco+'" id="ajaxBusy" />')
		.parent().find('#ajaxBusy').css({position:'relative',top:'5px',left:'12px'});
		
		$.post(nlUrl,{'email':$(this).find('[name=email]').val()},function(data){
			$('form[name=newsletter]').find('.info').html('<p>'+data.status+'</p>');
			$('form[name=newsletter]').find('#ajaxBusy').fadeOut('slow',function(){$(this).remove()});
			$('form[name=newsletter]').find('input').removeAttr('disabled');
		},"json");
		$(this).find('input').attr('disabled','disabled');
		return false;
	})
})
$(document).unload(function(){
	GUnload();	
});


function clearInput(val, txt){
	if(val.value == txt) val.value = "";
}
function canviaPest(val){
	for (i=1;i<4;i++){
		var x=document.getElementById("pest"+i);
		x.className = "";
		var x=document.getElementById("txt"+i);
		x.style.display = "none";
	}
	var x=document.getElementById("pest"+val);
	x.className = "selected";
	var x=document.getElementById("txt"+val);
	x.style.display = "block";
	
		
}



