$.ajaxSetup({async:false});
$(document).ready(function() {
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	$('#mainMenu').load('scripts/load_menu.asp?page='+sPage, function() {
		var bkpos = 37;
		$(".mnuDx2").each(function (i) {
			bkpos = bkpos - 37;
			newValue = '0px '+bkpos+'px';
			$(this).css('backgroundPosition', newValue);
			$(this).css('cursor', 'pointer');
		});
		$(".mnuDx2").click(function(){
			submnu = 'sub'+$(this).attr('id');
			expanded = $(this).attr('exp');
			nh=$("#mnuFiller").height();
			if(expanded!='1')
			{
				$(".mnuDx2").each(function (i) {
					if($(this).attr('exp')=='1')
					{	
						submnuZ = 'sub'+$(this).attr('id');
						sbh=$("#"+submnuZ).height();
						nh=nh+sbh+3;
						$("#sub"+$(this).attr('id')).hide();
						$(this).attr('exp','');
						$("#mnuFiller").height(nh);
					}
				});					
				$("#"+submnu).show();
				var nh = nh-$("#"+submnu).height()-3;
				$("#mnuFiller").height(nh);
				$(this).attr('exp','1');
			}
			else
			{
				sbh=$("#"+submnu).height();
				nh=nh+sbh+3;
				$("#"+submnu).hide();
				$("#mnuFiller").height(nh);
				$(this).attr('exp','');
			}
		});			
	});	

	$.fn.cycle.defaults.speed   = 900;
	$.fn.cycle.defaults.timeout = 5000;			
    $('.Image').cycle();		
	
	$("#txtcerca").click(function(){
		$("#txtcerca").val('');
		$("#txtcerca").css('color','#000000');
	});
	$("#txtcerca").blur(function(){
		if($("#txtcerca").val()=='')
		{
			$("#txtcerca").css('color','#a9a9a9');
			$("#txtcerca").val('Search');
		}
	});
});

