jQuery(document).ready(function(){
  
  //  jQuery('#cerrarPopUp').click(function(){
  //    jQuery("#PopUpContenido").fadeToggle(800, function(){
  //      jQuery("#PopUpFondo").slideToggle(1000);
  //    });
  //  });
  
  jQuery('#bannerControl').jcarousel({
    start: 1,
    scroll: 1,
    wrap: 'circular',
    auto: 7,
    animation: 2500,
    vertical: false,
    buttonNextHTML: null,
    buttonPrevHTML: null,
    itemVisibleInCallback: banner_itemVisibleInCallback,
    initCallback: banner_initCallback
  });
  
  initializeMap();

  jQuery("a[rel^='prettyPhoto']").prettyPhoto();
  

})

//BANNER PRINCIPAL
var banner;

function banner_clickItem(instance,anchor){
  //instance.stopAuto();
  instance.options.animation = 1;
  instance.scroll(jQuery.jcarousel.intval(anchor.text()));
  instance.options.animation = 2500;
}

function banner_initCallback(instance,state){
  banner = instance;
  jQuery('.bannerControl a').bind('click',function(){
    banner_clickItem(instance,jQuery(this));
    return false;
  });
}

function banner_itemVisibleInCallback(carousel,item,position,state){
  var anchors = jQuery('.bannerControl a');
  var index = (position - 1) % anchors.length;
  anchors.removeClass('selected').eq(index).addClass('selected');
}
