//Script de precarga de imagenes
function MM_preloadImages() 
{ //v3.0
	var d=document; 
	if(d.images)
	{  
		if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
		for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0)
		{ 
			d.MM_p[j]=new Image; 
			d.MM_p[j++].src=a[i];
		}
	}
}

$(document).ready(function init(){
	$('#adminbar > select').change(function() {
		$.ajax({url:'/CambioProveedor', async:false, type:'POST', data:({proveidor:this.value}),success:function(msg){ location.href = location.href } });
	});

	// Precarrega les imatges de la botonera
	var lang = $('HTML').attr('lang');
	MM_preloadImages('/imatges/eventosON.png',
			'/imatges/monumentosON.png',
			'/imatges/restaurantesON.png',
			'/imatges/miperfilON.png',
			'/imatges/domicilioON.png',
			'/imatges/domicilioON.gif',
			'/imatges/reservaON.gif',
			'/imatges/reservaON.png',
			'/imatges/takeawayON.gif',
	'/imatges/takeawayON.png');
  
  // LoginForm
  $('#loginform').load('/FormLogin');
  // Idiomes
  $.ajax({url:'/CarregaIdiomes', async:false, type:'GET', success:function(msg) { $('#LCapcalera').prepend(msg); } });

	// Agrega comportamiento de cambio de imagen a la botonera  
	$('img#menu1').hover(function() {
		$(this).attr("src","./imatges/monumentosON.png");
	}, function() {
		$(this).attr("src","./imatges/monumentosOFF.png");
	});
	$('img#menu2').hover(function() {
		$(this).attr("src","./imatges/eventosON.png");
	}, function() {
		$(this).attr("src","./imatges/eventosOFF.png");
	});
	$('img#menu3').hover(function() {
		$(this).attr("src","./imatges/discoON.png");
	}, function() {
		$(this).attr("src","./imatges/discoOFF.png");
	});
	$('img#menu4').hover(function() {
		$(this).attr("src","./imatges/restaurantesON.png");
	}, function() {
		$(this).attr("src","./imatges/restaurantesOFF.png");
	});
	$('img#menu5').hover(function() {
		$(this).attr("src","./imatges/miperfilON.png");
	}, function() {
		$(this).attr("src","./imatges/miperfilOFF.png");
	});

	$('div[class=facebox]').html("<iframe src='http://www.facebook.com/plugins/likebox.php?id=142234832458519&amp;width=402&amp;connections=14&amp;stream=false&amp;header=true&amp;height=287' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:402px; height:287px;'></iframe>");

});


