var allUIMenus=[];$.fn.menu=function(options){var caller=this;var options=options;var m=new Menu(caller,options);allUIMenus.push(m);$(this).mousedown(function(){if(!m.menuOpen){m.showLoading();};}).click(function(){if(m.menuOpen==false){m.showMenu();}
else{m.kill();};return false;});};function Menu(caller,options){var menu=this;var caller=$(caller);var container=$('
');this.menuOpen=false;this.menuExists=false;var options=jQuery.extend({content:null,width:180,maxHeight:180,positionOpts:{posX:'left',posY:'bottom',offsetX:0,offsetY:0,directionH:'right',directionV:'down',detectH:true,detectV:true,linkToFront:false},showSpeed:200,callerOnState:'ui-state-active',loadingState:'ui-state-loading',linkHover:'ui-state-hover',linkHoverSecondary:'li-hover',crossSpeed:200,crumbDefaultText:'Choose an option:',backLink:true,backLinkText:'Back',flyOut:false,flyOutOnState:'ui-state-default',nextMenuLink:'ui-icon-triangle-1-e',topLinkText:'All',nextCrumbLink:'ui-icon-carat-1-e'},options);var killAllMenus=function(){$.each(allUIMenus,function(i){if(allUIMenus[i].menuOpen){allUIMenus[i].kill();};});};this.kill=function(){caller.removeClass(options.loadingState).removeClass('fg-menu-open').removeClass(options.callerOnState);container.find('li').removeClass(options.linkHoverSecondary).find('a').removeClass(options.linkHover);if(options.flyOutOnState){container.find('li a').removeClass(options.flyOutOnState);};if(options.callerOnState){caller.removeClass(options.callerOnState);};if(container.is('.fg-menu-ipod')){menu.resetDrilldownMenu();};if(container.is('.fg-menu-flyout')){menu.resetFlyoutMenu();};container.parent().hide();menu.menuOpen=false;$(document).unbind('click',killAllMenus);$(document).unbind('keypress');};this.showLoading=function(){caller.addClass(options.loadingState);};this.showMenu=function(){killAllMenus();if(!menu.menuExists){menu.create()};caller.addClass('fg-menu-open').addClass(options.callerOnState);container.parent().show().click(function(){menu.kill();return false;});container.hide().slideDown(options.showSpeed).find('.fg-menu:eq(0)');menu.menuOpen=true;caller.removeClass(options.loadingState);$(document).click(killAllMenus);$(document).keypress(function(event){switch(event.keyCode){case 37:if(container.is('.fg-menu-flyout')){$(event.target).trigger('mouseout');if($('.'+options.flyOutOnState).size()>0){$('.'+options.flyOutOnState).trigger('mouseover');};};if(container.is('.fg-menu-ipod')){$(event.target).trigger('mouseout');if($('.fg-menu-footer').find('a').size()>0){$('.fg-menu-footer').find('a').trigger('click');};if($('.fg-menu-header').find('a').size()>0){$('.fg-menu-current-crumb').prev().find('a').trigger('click');};if($('.fg-menu-current').prev().is('.fg-menu-indicator')){$('.fg-menu-current').prev().trigger('mouseover');};};return false;break;case 38:if($(event.target).is('.'+options.linkHover)){var prevLink=$(event.target).parent().prev().find('a:eq(0)');if(prevLink.size()>0){$(event.target).trigger('mouseout');prevLink.trigger('mouseover');};}
else{container.find('a:eq(0)').trigger('mouseover');}
return false;break;case 39:if($(event.target).is('.fg-menu-indicator')){if(container.is('.fg-menu-flyout')){$(event.target).next().find('a:eq(0)').trigger('mouseover');};if(container.is('.fg-menu-ipod')){$(event.target).trigger('click');setTimeout(function(){$(event.target).next().find('a:eq(0)').trigger('mouseover');},options.crossSpeed);};};return false;break;case 40:if($(event.target).is('.'+options.linkHover)){var nextLink=$(event.target).parent().next().find('a:eq(0)');if(nextLink.size()>0){$(event.target).trigger('mouseout');nextLink.trigger('mouseover');};}
else{container.find('a:eq(0)').trigger('mouseover');}
return false;break;case 27:killAllMenus();break;case 13:if(container.is('.fg-menu-ipod')&&$(event.target).is('.fg-menu-indicator')){$(event.target).trigger('click');setTimeout(function(){$(event.target).next().find('a:eq(0)').trigger('mouseover');},options.crossSpeed);};break;};});};this.create=function(){container.css({width:options.width}).appendTo('body').find('ul:first').not('.fg-menu-breadcrumb').addClass('fg-menu');container.find('ul, li a').addClass('ui-corner-all');container.find('ul').attr('role','menu').eq(0).attr('aria-activedescendant','active-menuitem').attr('aria-labelledby',caller.attr('id'));container.find('li').attr('role','menuitem');container.find('li:has(ul)').attr('aria-haspopup','true').find('ul').attr('aria-expanded','false');container.find('a').attr('tabindex','-1');if(container.find('ul').size()>1){if(options.flyOut){menu.flyout(container,options);}
else{menu.drilldown(container,options);}}
else{container.find('a').click(function(){menu.chooseItem(this);return false;});};if(options.linkHover){var allLinks=container.find('.fg-menu li a');allLinks.hover(function(){var menuitem=$(this);$('.'+options.linkHover).removeClass(options.linkHover).blur().parent().removeAttr('id');$(this).addClass(options.linkHover).focus().parent().attr('id','active-menuitem');},function(){$(this).removeClass(options.linkHover).blur().parent().removeAttr('id');});};if(options.linkHoverSecondary){container.find('.fg-menu li').hover(function(){$(this).siblings('li').removeClass(options.linkHoverSecondary);if(options.flyOutOnState){$(this).siblings('li').find('a').removeClass(options.flyOutOnState);}
$(this).addClass(options.linkHoverSecondary);},function(){$(this).removeClass(options.linkHoverSecondary);});};menu.setPosition(container,caller,options);menu.menuExists=true;};this.chooseItem=function(item){menu.kill();$('#menuSelection').text($(item).text());};};Menu.prototype.flyout=function(container,options){var menu=this;this.resetFlyoutMenu=function(){var allLists=container.find('ul ul');allLists.removeClass('ui-widget-content').hide();};container.addClass('fg-menu-flyout').find('li:has(ul)').each(function(){var linkWidth=container.width();var showTimer,hideTimer;var allSubLists=$(this).find('ul');allSubLists.css({left:linkWidth,width:linkWidth}).hide();$(this).find('a:eq(0)').addClass('fg-menu-indicator').html(''+$(this).find('a:eq(0)').text()+'').hover(function(){clearTimeout(hideTimer);var subList=$(this).next();if(!fitVertical(subList,$(this).offset().top)){subList.css({top:'auto',bottom:0});};if(!fitHorizontal(subList,$(this).offset().left+100)){subList.css({left:'auto',right:linkWidth,'z-index':999});};showTimer=setTimeout(function(){subList.addClass('ui-widget-content').show(options.showSpeed).attr('aria-expanded','true');},300);},function(){clearTimeout(showTimer);var subList=$(this).next();hideTimer=setTimeout(function(){subList.removeClass('ui-widget-content').hide(options.showSpeed).attr('aria-expanded','false');},400);});$(this).find('ul a').hover(function(){clearTimeout(hideTimer);if($(this).parents('ul').prev().is('a.fg-menu-indicator')){$(this).parents('ul').prev().addClass(options.flyOutOnState);}},function(){hideTimer=setTimeout(function(){allSubLists.hide(options.showSpeed);container.find(options.flyOutOnState).removeClass(options.flyOutOnState);},500);});});container.find('a').click(function(){menu.chooseItem(this);return false;});};Menu.prototype.drilldown=function(container,options){var menu=this;var topList=container.find('.fg-menu');var breadcrumb=$('');var crumbDefaultHeader=$('');var firstCrumbText=(options.backLink)?options.backLinkText:options.topLinkText;var firstCrumbClass=(options.backLink)?'fg-menu-prev-list':'fg-menu-all-lists';var firstCrumbLinkClass=(options.backLink)?'ui-state-default ui-corner-all':'';var firstCrumbIcon=(options.backLink)?'':'';var firstCrumb=$(''+firstCrumbIcon+firstCrumbText+'');container.addClass('fg-menu-ipod');if(options.backLink){breadcrumb.addClass('fg-menu-footer').appendTo(container).hide();}
else{breadcrumb.addClass('fg-menu-header').prependTo(container);};breadcrumb.append(crumbDefaultHeader);var checkMenuHeight=function(el){if(el.height()>options.maxHeight){el.addClass('fg-menu-scroll')};el.css({height:options.maxHeight});};var resetChildMenu=function(el){el.removeClass('fg-menu-scroll').removeClass('fg-menu-current').height('auto');};this.resetDrilldownMenu=function(){$('.fg-menu-current').removeClass('fg-menu-current');topList.animate({left:0},options.crossSpeed,function(){$(this).find('ul').each(function(){$(this).hide();resetChildMenu($(this));});topList.addClass('fg-menu-current');});$('.fg-menu-all-lists').find('span').remove();breadcrumb.empty().append(crumbDefaultHeader);$('.fg-menu-footer').empty().hide();checkMenuHeight(topList);};topList.addClass('fg-menu-content fg-menu-current ui-widget-content ui-helper-clearfix').css({width:container.width()}).find('ul').css({width:container.width(),left:container.width()}).addClass('ui-widget-content').hide();checkMenuHeight(topList);topList.find('a').each(function(){if($(this).next().is('ul')){$(this).addClass('fg-menu-indicator').each(function(){$(this).html(''+$(this).text()+'');}).click(function(){var nextList=$(this).next();var parentUl=$(this).parents('ul:eq(0)');var parentLeft=(parentUl.is('.fg-menu-content'))?0:parseFloat(topList.css('left'));var nextLeftVal=Math.round(parentLeft-parseFloat(container.width()));var footer=$('.fg-menu-footer');resetChildMenu(parentUl);checkMenuHeight(nextList);topList.animate({left:nextLeftVal},options.crossSpeed);nextList.show().addClass('fg-menu-current').attr('aria-expanded','true');var setPrevMenu=function(backlink){var b=backlink;var c=$('.fg-menu-current');var prevList=c.parents('ul:eq(0)');c.hide().attr('aria-expanded','false');resetChildMenu(c);checkMenuHeight(prevList);prevList.addClass('fg-menu-current').attr('aria-expanded','true');if(prevList.hasClass('fg-menu-content')){b.remove();footer.hide();};};if(options.backLink){if(footer.find('a').size()==0){footer.show();$(' Back').appendTo(footer).click(function(){var b=$(this);var prevLeftVal=parseFloat(topList.css('left'))+container.width();topList.animate({left:prevLeftVal},options.crossSpeed,function(){setPrevMenu(b);});return false;});}}
else{if(breadcrumb.find('li').size()==1){breadcrumb.empty().append(firstCrumb);firstCrumb.find('a').click(function(){menu.resetDrilldownMenu();return false;});}
$('.fg-menu-current-crumb').removeClass('fg-menu-current-crumb');var crumbText=$(this).find('span:eq(0)').text();var newCrumb=$('');newCrumb.appendTo(breadcrumb).find('a').click(function(){if($(this).parent().is('.fg-menu-current-crumb')){menu.chooseItem(this);}
else{var newLeftVal=-($('.fg-menu-current').parents('ul').size()-1)*180;topList.animate({left:newLeftVal},options.crossSpeed,function(){setPrevMenu();});$(this).parent().addClass('fg-menu-current-crumb').find('span').remove();$(this).parent().nextAll().remove();};return false;});newCrumb.prev().append(' ');};return false;});}
else{$(this).click(function(){menu.chooseItem(this);return false;});};});};Menu.prototype.setPosition=function(widget,caller,options){var el=widget;var referrer=caller;var dims={refX:referrer.offset().left,refY:referrer.offset().top,refW:referrer.getTotalWidth(),refH:referrer.getTotalHeight()};var options=options;var xVal,yVal;var helper=$('');helper.css({position:'absolute',left:dims.refX,top:dims.refY,width:dims.refW,height:dims.refH});el.wrap(helper);switch(options.positionOpts.posX){case'left':xVal=0;break;case'center':xVal=dims.refW/2;break;case'right':xVal=dims.refW;break;};switch(options.positionOpts.posY){case'top':yVal=0;break;case'center':yVal=dims.refH/2;break;case'bottom':yVal=dims.refH;break;};xVal+=options.positionOpts.offsetX;yVal+=options.positionOpts.offsetY;if(options.positionOpts.directionV=='up'){el.css({top:'auto',bottom:yVal});if(options.positionOpts.detectV&&!fitVertical(el)){el.css({bottom:'auto',top:yVal});}}
else{el.css({bottom:'auto',top:yVal});if(options.positionOpts.detectV&&!fitVertical(el)){el.css({top:'auto',bottom:yVal});}};if(options.positionOpts.directionH=='left'){el.css({left:'auto',right:xVal});if(options.positionOpts.detectH&&!fitHorizontal(el)){el.css({right:'auto',left:xVal});}}
else{el.css({right:'auto',left:xVal});if(options.positionOpts.detectH&&!fitHorizontal(el)){el.css({left:'auto',right:xVal});}};if(options.positionOpts.linkToFront){referrer.clone().addClass('linkClone').css({position:'absolute',top:0,right:'auto',bottom:'auto',left:0,width:referrer.width(),height:referrer.height()}).insertAfter(el);};};function sortBigToSmall(a,b){return b-a;};jQuery.fn.getTotalWidth=function(){return $(this).width()+parseInt($(this).css('paddingRight'))+parseInt($(this).css('paddingLeft'))+parseInt($(this).css('borderRightWidth'))+parseInt($(this).css('borderLeftWidth'));};jQuery.fn.getTotalHeight=function(){return $(this).height()+parseInt($(this).css('paddingTop'))+parseInt($(this).css('paddingBottom'))+parseInt($(this).css('borderTopWidth'))+parseInt($(this).css('borderBottomWidth'));};function getScrollTop(){return self.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop;};function getScrollLeft(){return self.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft;};function getWindowHeight(){var de=document.documentElement;return self.innerHeight||(de&&de.clientHeight)||document.body.clientHeight;};function getWindowWidth(){var de=document.documentElement;return self.innerWidth||(de&&de.clientWidth)||document.body.clientWidth;};function fitHorizontal(el,leftOffset){var leftVal=parseInt(leftOffset)||$(el).offset().left;return(leftVal+$(el).width()<=getWindowWidth()+getScrollLeft()&&leftVal-getScrollLeft()>=0);};function fitVertical(el,topOffset){var topVal=parseInt(topOffset)||$(el).offset().top;return(topVal+$(el).height()<=getWindowHeight()+getScrollTop()&&topVal-getScrollTop()>=0);};Number.prototype.pxToEm=String.prototype.pxToEm=function(settings){settings=jQuery.extend({scope:'body',reverse:false},settings);var pxVal=(this=='')?0:parseFloat(this);var scopeVal;var getWindowWidth=function(){var de=document.documentElement;return self.innerWidth||(de&&de.clientWidth)||document.body.clientWidth;};if(settings.scope=='body'&&$.browser.msie&&(parseFloat($('body').css('font-size'))/getWindowWidth()).toFixed(1)>0.0){var calcFontSize=function(){return(parseFloat($('body').css('font-size'))/getWindowWidth()).toFixed(3)*16;};scopeVal=calcFontSize();}
else{scopeVal=parseFloat(jQuery(settings.scope).css("font-size"));};var result=(settings.reverse==true)?(pxVal*scopeVal).toFixed(2)+'px':(pxVal/scopeVal).toFixed(2)+'em';return result;};
$(document).ready(function(){var mapContainer=$("#map")[0];var markers=[];var descs=[];if(GBrowserIsCompatible()){if(mapContainer){var map=new GMap2(mapContainer);$('#map').css({background:'#afe3ff'});var centro=new GLatLng(-34.90437530937564,-56.16039276123047);map.setCenter(centro,13);map.addControl(new GMapTypeControl);}
function clickMarcador(marker,i){GEvent.addListener(marker,"click",function(){marker.showMapBlowup(17);$('.click').css({cursor:'pointer',background:'#e7f1ff'});$('#id'+i).css({cursor:'default',background:'#FFEE53'});$('.clickDesc').slideUp(500);$('#id'+i).children(".clickDesc").slideDown(500);});}
function procesaMarcadores(data){var bounds=new GLatLngBounds();var navi='';var xml;if(ActiveXObject){xml=new ActiveXObject('Microsoft.XMLDOM');xml.async=false;xml.loadXML(data);}else{xml=data;}
$(xml).find('marker').each(function(){var lat=$(this).attr('lat');var lng=$(this).attr('lng');var link=$(this).attr('link');var desc=$(this).attr('desc');var cat=$(this).attr('cat');var barrio=$(this).attr('barrio');var point=new GLatLng(lat,lng);var icono=new GIcon();var marker=new GMarker(point,icono);clickMarcador(marker,i);var imagIcono='imagenes/'+cat+'.png';icono.image=imagIcono;icono.shadow='imagenes/museosS.png';icono.iconSize=new GSize(23,23);icono.shadowSize=new GSize(34,26);icono.iconAnchor=new GPoint(12,23);icono.infoWindowAnchor=new GPoint(11,1);icono.infoShadowAnchor=new GPoint(12,23);icono.printImage=imagIcono;icono.mozPrintImage=imagIcono;markers[i]=marker;descs[i]=desc;navi+='
'+link+'
';navi+=''+desc+'
';map.addOverlay(marker,navi);bounds.extend(point);i++;});navi+="
";map.setZoom(map.getBoundsZoomLevel(bounds));map.setCenter(bounds.getCenter());$('#navi').html(navi);$('.lista .clickDesc').hide();$('.click').click(function(){var id=$(this).attr('id');id=id.substr(2);markers[id].showMapBlowup(17);$('.click').css({cursor:'pointer',background:'#e7f1ff'});$(this).css({cursor:'default',background:'#FFEE53'});$('.clickDesc').hide();$(this).children(".clickDesc").slideDown(500);});}
var i=0;ActiveXObject=window.ActiveXObject?window.ActiveXObject:false;$.ajax({url:"xmlInicial.php",type:"GET",success:function(data){procesaMarcadores(data);$('#map').show();}});$("#selectBar").change(function(){map.clearOverlays();var i=0;var cat=$('#selectCat').val();var bar=$('#selectBar').val();var mostrando='Mostrando '+cat+' en '+bar+'';$('#extra').html(mostrando);$.ajax({url:"xml.php",type:"GET",data:"cat="+cat+"&bar="+bar,success:function(data2){procesaMarcadores(data2)}});});$("#selectCat").change(function(){var catSel=$("#selectCat").val();$.ajax({url:'getBarrios.php',type:'GET',data:"cat="+catSel,beforeSend:function(){$("#selectBar").fadeOut()},success:function(barrios){$('#selectBar').html(barrios).fadeIn()}});});}});
(function($){$.fn.selectChain=function(options){var defaults={key:"id",value:"label"};var settings=$.extend({},defaults,options);if(!(settings.target instanceof $))settings.target=$(settings.target);return this.each(function(){var $$=$(this);$$.change(function(){var data=null;if(typeof settings.data=='string'){data=settings.data+'&'+this.name+'='+$$.val();}else if(typeof settings.data=='object'){data=settings.data;data[this.name]=$$.val();}
settings.target.empty();$.ajax({url:settings.url,data:data,type:(settings.type||'get'),dataType:'json',success:function(j){var options=[],i=0,o=null;for(i=0;i