// JavaScript Document
// LIBRERIA JAVASCRIPT PARA IBERESTUDIOS
// FUNCIONA CON JQUERY 1.4
// 04/01/2010 Fernando Alou
if(urlCSS == undefined ){
var urlCSS = 'http://dev.areainteractiva.net/tickets/iber4/media/';
}

/**********************************
  FUNCION DETECTAR_NAVEGADORES
***********************************/
var userAgent = navigator.userAgent.toLowerCase();
 
// Figure out what browser is being used
jQuery.browser = {
	version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/ ) || [])[1],
	chrome: /chrome/.test( userAgent ),
	safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ),
	opera: /opera/.test( userAgent ),
	msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
	mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};
/**********************************
  FUNCION DETECTAR_NAVEGADORES_END
***********************************/

/**********************************
    FUNCION OCULTARFILTROS
***********************************/
jQuery.ocultarFiltros = function(opciones_fn){
    if( opciones_fn == undefined ){
        var opciones = {
            opt_contenedor_filtros : "#filtros",//Elemento a contraer
            opt_contenedor_principal : "#contenido",//Elemento a expandir
			opt_contenedor_ocultar : "#filtros_cont",//Elemento a ocultar al contraer
			opt_tamanyo_filtros : {
				"contraido" : "25px",
				"expandido" : "200px"
			},
			opt_tamanyo_principal : {
				contraido : "740px",
				expandido : "915px"
			},
			opt_velocidad : 500,
			opt_margenes : {
				contraido : "20px",
				expandido : "25px"
			}
        };
    }else{
       var opciones = opciones_fn;
    }
	//cacheamos elementos
	var contenedor_filtros = jQuery(opciones.opt_contenedor_filtros);
	var contenedor_principal = jQuery(opciones.opt_contenedor_principal);
	var contenedor_ocultar = jQuery(opciones.opt_contenedor_ocultar);
	
	jQuery("#oculta_filtros").toggle(function(){
		contenedor_filtros.animate({width: opciones.opt_tamanyo_filtros.contraido}, opciones.opt_velocidad );
		contenedor_principal.css('margin-left',opciones.opt_margenes.contraido).animate({width: opciones.opt_tamanyo_principal.expandido}, opciones.opt_velocidad,'swing',function(){contenedor_ocultar.css('visibility','hidden');});
		jQuery(this).addClass('oculta_filtros_activo');
	
	}, function () {
		contenedor_filtros.animate({width: opciones.opt_tamanyo_filtros.expandido}, opciones.opt_velocidad );
		contenedor_principal.animate({width: opciones.opt_tamanyo_principal.contraido}, opciones.opt_velocidad,'swing',function(){contenedor_principal.css('margin-left',opciones.opt_margenes.expandido);});
		jQuery(this).removeClass('oculta_filtros_activo');
		contenedor_ocultar.css('visibility','visible');
	});
	
	if(contenedor_filtros.height() < contenedor_principal.height()){
		contenedor_filtros.css('height',contenedor_principal.height()+'px');
	}
}
/**********************************
    FUNCION OCULTARFILTROS_END
***********************************/

/**********************************
    FUNCION MOUSEOVERADDCLASS
***********************************/
jQuery.mOverClass = function(opciones_fn){
	var opciones = opciones_fn;
	//cacheamos elementos
	jQuery(opciones.elemento).each(function(){
		var ElementoCache = jQuery(this);
		
		ElementoCache.mouseover(function(){
			if(opciones.outClass != undefined){
				ElementoCache.removeClass(opciones.outClass)
			}
			if(opciones.acitveClass != undefined){
				ElementoCache.removeClass(opciones.acitveClass)
			}
			if(opciones.overClass != undefined){
				ElementoCache.addClass(opciones.overClass)
			}
		});
		ElementoCache.mouseout(function(){
			if(opciones.outClass != undefined){
				ElementoCache.addClass(opciones.outClass);
			}
			if(opciones.acitveClass != undefined){
				ElementoCache.removeClass(opciones.acitveClass)
			}
			if(opciones.overClass != undefined){
				ElementoCache.removeClass(opciones.overClass)
			}
		});
		ElementoCache.click(function(){
			if(opciones.outClass != undefined){
				ElementoCache.removeClass(opciones.outClass);
			}
			if(opciones.acitveClass != undefined){
				ElementoCache.addClass(opciones.acitveClass)
			}
			if(opciones.overClass != undefined){
				ElementoCache.removeClass(opciones.overClass)
			}
		});
	
	});
}
/*
$.mOverClass({
			 elemento:".menu_header",
			 overClass:"menu_header_hover",
			 outClass:"menu_header_out",
			 activeClass:"menu_header_active"
			 })*/
/**********************************
    FUNCION MOUSEOVERADDCLASS_END
***********************************/

/**********************************
    FUNCION HEADER_MENU
	Despliega y oculta
	el menu del HEADER
***********************************/
jQuery.headerMenu = function(opciones_fn){
	var opciones = opciones_fn;
/////////////////////////////////
	jQuery(opciones.botones).each(function(){
		jQuery(this).mouseover(function(){
			$(this).css("background-position","0 -15px");
		});
		jQuery(this).mouseout(function(){
			$(this).css("background-position","0 0px");
		});
		jQuery(this).click(function(){
			jQuery(opciones.subMenu).hide();
			jQuery(opciones.menusClass).removeClass(opciones.activeClass);
			jQuery(this).parents(".menu_header:first").addClass(opciones.activeClass);
			jQuery(this).parents(".menu_header:first").find(opciones.subMenu).show();
		});
	});
	//cacheamos:
	var submenu_desplegado = jQuery(opciones.subMenu);
	var menu_header = jQuery(opciones.menusClass);
	submenu_desplegado.hover(function() {
	  //es un error de jquery no puedo hacer el out directamente as� que....
	}, function() {
	  submenu_desplegado.hide(); menu_header.removeClass(opciones.activeClass);
	});
	submenu_desplegado.hide();
/////////////////////////////////
}
/*
$.headerMenu({
	 botones:".menu_header_btn",
	 menusClass:".menu_header",
	 subMenu:".submenu_desplegado",
	 activeClass:"menu_header_desplegado"
 })*/
/**********************************
    FUNCION HEADER_MENU_END
***********************************/


/**********************************
    FUNCION MULTISEARCH_MENU
***********************************/
jQuery.multiSearchMenu = function(opciones_fn){
	var opciones = opciones_fn;
/////////////////////////////////
	//cacheo
	var header_buscador_selector_options = jQuery(opciones.opcionesBuscador);
	//Muestro el desplegable
	jQuery(opciones.btnSelector).bind("mouseenter",function(){
			header_buscador_selector_options.show();
		}).bind("mouseleave",function(){
			header_buscador_selector_options.hide();
	})
	//Selector_opcion
	header_buscador_selector_options.find("li").each(function(){
		jQuery(this).click(function(){
			var valor = $(this).text();
			jQuery(opciones.textLabel).text(valor);
			jQuery(opciones.inputID).attr("value", valor);
			header_buscador_selector_options.hide();
		});
	});
/////////////////////////////////
}
/*
$.multiSearchMenu({
	 opcionesBuscador:"#header_buscador_selector_options",
	 btnSelector:"#header_buscador_selector",
	 textLabel:"#header_buscador_selector_txt",
	 inputID:"#buscar_en"
 })*/
/**********************************
    FUNCION MULTISEARCH_MENU_END
***********************************/



/**********************************
    FUNCION MULTISEARCH_MENU
***********************************/
jQuery.multiSearchMenu = function(opciones_fn){
	var opciones = opciones_fn;
/////////////////////////////////
	//cacheo
	var header_buscador_selector_options = jQuery(opciones.opcionesBuscador);
	//Muestro el desplegable
	jQuery(opciones.btnSelector).bind("mouseenter",function(){
			header_buscador_selector_options.show();
		}).bind("mouseleave",function(){
			header_buscador_selector_options.hide();
	})
	//Selector_opcion
	header_buscador_selector_options.find("li").each(function(){
		jQuery(this).click(function(){
			var valor = $(this).text();
			jQuery(opciones.textLabel).text(valor);
			jQuery(opciones.inputID).attr("value", valor);
			header_buscador_selector_options.hide();
		});
	});
/////////////////////////////////
}
/*
$.multiSearchMenu({
	 opcionesBuscador:"#header_buscador_selector_options",
	 btnSelector:"#header_buscador_selector",
	 textLabel:"#header_buscador_selector_txt",
	 inputID:"#buscar_en"
 })*/
/**********************************
    FUNCION MULTISEARCH_MENU_END
***********************************/


/**********************************
    FUNCION TABS
***********************************/
jQuery.tabsIber = function(opciones_fn){
	var opciones = opciones_fn;
/////////////////////////////////
/////////////////////////////////
	jQuery(opciones.elementos).each(function(){
		//busco todas las tabs, activo la primera y oculto el resto
		var ids = new Array;
		contador = 0
		jQuery(this).find('li').each(function(){
			var elemento = jQuery(this);
			var elementoID = elemento.attr('id');
			ids.push(elementoID);
			//activo la primera tab
			if(contador ==0){
				jQuery(this).addClass(opciones.addClass);
			}
			contador++;
			
			//funcion para cada pestanya
			jQuery(this).click(function(){
				jQuery(this).parents(opciones.elementos+":first").parent().find(opciones.contenidos).hide();
				jQuery(opciones.prefijo+elementoID).show();
				
				jQuery(this).parents(opciones.elementos+":first").find('li').removeClass(opciones.addClass);
				jQuery(this).addClass(opciones.addClass);
			});
		});
		//oculto todo menos el primero
		var altura = 0;
		for(i=0; i<ids.length; i++){
			//busco el que es mas alto... y lo guardo
			tmp_altura = jQuery(opciones.prefijo+ids[i]).height();
			if(tmp_altura > altura){ altura = tmp_altura;}
			if(i!=0){
				jQuery(opciones.prefijo+ids[i]).hide();
			}
		}
		if(jQuery(this).hasClass('same')){
			for(i=0; i<ids.length; i++){
				jQuery(opciones.prefijo+ids[i]).css('height',altura+'px');
			}
		}
	});
/////////////////////////////////
/////////////////////////////////
}
/*
$.tabsIber({
	 elementos:".tabs",
	 contenidos:".tabs_contenido",
	 addClass:"activo",
	 prefijo:"content_"
 })*/
/* ESTRUCTURA
<DIV>
  |_<div class="tabs">
      |_<ul>
	     |_<li id="1_EJEMPLO">
		 |_<li id="2_EJEMPLO">
  |_<div id="content_1_EJEMPLO" class="tabs_contenido">
  |_<div id="content_2_EJEMPLO" class="tabs_contenido">
  
*/
/**********************************
    FUNCION TABS_END
***********************************/

/**********************************
    FUNCION AMPLIAR_INFO
***********************************/
jQuery.ampliarInfo = function(opciones_fn){
	var opciones = opciones_fn;
/////////////////////////////////
/////////////////////////////////
	jQuery(opciones.elementos).each(function(){
		jQuery(this).click(function(){
			if(jQuery(this).hasClass(opciones.addClass)){
		jQuery(this).removeClass(opciones.addClass);
		jQuery(this).parent().animate({height: opciones.altura.contraido}, opciones.velocidad );
				} else {
		jQuery(this).addClass(opciones.addClass);
		jQuery(this).parent().animate({height: opciones.altura.expandido}, opciones.velocidad );
				}
				return false;
			});
	});
/////////////////////////////////
/////////////////////////////////
}
/*
$.ampliarInfo({
	 elementos:".ampliar",
	 addClass:"on",
	 velocidad:500,
	 altura: {
		 contraido : "40px",
		 expandido : "80px"
	 }
 })*/
/**********************************
    FUNCION AMPLIAR_INFO_END
***********************************/


/**********************************
    FUNCION CONTRAER_FILTROS
***********************************/
jQuery.contraerFiltros = function(opciones_fn){
	var opciones = opciones_fn;
/////////////////////////////////
/////////////////////////////////
jQuery(opciones.elementos).children('span').each(function(){
	jQuery(this).mouseover(function(){
		jQuery(this).addClass(opciones.addClass);
	});
	jQuery(this).mouseout(function(){
		jQuery(this).removeClass(opciones.addClass);
	});
	
	jQuery(this).click(function(){
		var submenu = jQuery(this).parent().find('.filtros_desplegado');
		if(jQuery(this).parent().hasClass('on')){
			submenu.hide();
			jQuery(this).parent().removeClass('on');
		} else {
			submenu.show();
			jQuery(this).parent().addClass('on');
		}
	});
});
/////////////////////////////////
/////////////////////////////////
}
/*
$.contraerFiltros({
	 elementos:"ul.filtros li",
	 addClass:"hover"
 })*/

/*ESTRUCTURA
<ul class="filtros">
	<li>
		<span>Titulo</span>
		<ul class="filtros_desplegado">contenido</ul>
	</li>
</ul>
*/
/**********************************
   FUNCION CONTRAER_FILTROS_END
***********************************/


//

/**********************************
    FUNCION A�ADIR_FILTROS
***********************************/
jQuery.anyadirFiltros = function(opciones_fn){
	var opciones = opciones_fn;
	
	//construyo...
var padre = jQuery(opciones.elemento);
var lista = padre.find(opciones.lista);
for (i=0;i<opciones.campo.length;i++){
    lista.find('div:first').append('<a href="'+i+'">'+opciones.campo[i].titulo+'</a>');
	jQuery(opciones.campo[i].elemento).hide();
	
	
} 
/*
<a href="#categoria">A�adir categor�a</a>
                                                <a href="#metodo">A�adir m�todo</a>
                                                <a href="#tipo">A�adir tipo</a>
												*/
/////////////////////////////////
/////////////////////////////////
var elemento = padre.find(opciones.btn);
elemento.click(function(){
	if(jQuery(this).not("."+opciones.btnClassOn)){
		jQuery(opciones.lista).show();
		jQuery(this).addClass(opciones.btnClassOn);
	}
});

elemento.parent().bind("mouseleave",function(){
	jQuery(opciones.lista).hide();
	elemento.removeClass(opciones.btnClassOn);
});
function construyeListadoYaccioneS(){
	jQuery(opciones.lista+" a").each(function(){
		jQuery(this).bind("click",function(){
										   
			var tipo = jQuery(this).attr('href');
			if(jQuery('#unico_'+tipo).hasClass('noremove')){
				jQuery('#unico_'+tipo).show();
				jQuery(this).remove();
				if(lista.find('a').length == 0){
					jQuery(opciones.ocultarVacio).hide();
				}
			} else {
			var elementoParaColnar = jQuery(opciones.campo[tipo].elemento+':first');
			//nuevo = elementoParaColnar.clone().prependTo(opciones.elemento);
			if(opciones.campo[tipo].unico){
				jQuery(opciones.agregarA).append('<div id="unico_'+tipo+'" class="noremove"><span class="eliminar_campo_extra"><span></div>');
				jQuery(opciones.agregarA).find('#unico_'+tipo).append(elementoParaColnar);
				jQuery(opciones.campo[tipo].elemento).show();
				jQuery(this).remove();
				jQuery('.eliminar_campo_extra').each(function(){
					jQuery(this).bind("mouseenter",function(){									  
						jQuery(this).addClass('eliminar_campo_extra_over');
					});
					jQuery(this).bind("mouseleave",function(){										  
						jQuery(this).removeClass('eliminar_campo_extra_over');
					});
				});
				if(lista.find('a').length == 0){
					jQuery(opciones.ocultarVacio).hide();
				}
				jQuery(opciones.agregarA).find('#unico_'+tipo+' span').bind("click",function(){
					lista.find('div:first').append('<a href="'+tipo+'">'+opciones.campo[tipo].titulo+'</a>');
					jQuery(this).parent().hide();
					jQuery(opciones.ocultarVacio).show();
					construyeListadoYaccioneS();
				});
				
			} else {
				//alert('varios');
				//var nuevo = elementoParaColnar.clone().prependTo(opciones.elemento);
			}
		}
			jQuery(opciones.lista).hide();
			elemento.removeClass(opciones.btnClassOn);
			return false;
		});
	});
	
}
construyeListadoYaccioneS();
/////////////////////////////////
/////////////////////////////////
}
/*
$.anyadirFiltros({
	 elemento: "#widget_anyadir_filtro",
	 btn: ".btn_anyadir",
	 btnClassOn: "btn_anyadir_on",
	 lista: ".btn_anyadir_desplegado",
	 agregarA: ".extra",
	 campo:[{
		 titulo:"X",
		 elemento:'[name=ejemplo1]',
		 unico : false
	 },{
		 titulo:"X",
		 elemento:'[name=ejemplo2]',
		 unico : true
	 }]
 })*/

/**********************************
   FUNCION A�ADIR_FILTROS_END
***********************************/

/**********************************
    FUNCION LANZADOR_EXTENDIDO
***********************************/
jQuery.lanzadorExtendido = function(opciones_fn){
	var opciones = opciones_fn;
	jQuery(opciones.disparadores).each(function(){
			//funcion para cada pestanya
			jQuery(this).click(function(){
				var elementoID = jQuery(opciones.tab).attr('id');
				if(jQuery(opciones.estructuraTabs.prefijo+elementoID).is(':hidden')){
				var cacheTabs = jQuery(opciones.tab).parents(opciones.estructuraTabs.elementos+":first")
				cacheTabs.parent().find(opciones.estructuraTabs.contenidos).hide();
				jQuery(opciones.estructuraTabs.prefijo+elementoID).show();
				
				cacheTabs.find('li').removeClass(opciones.estructuraTabs.addClass);
				jQuery(opciones.tab).addClass(opciones.estructuraTabs.addClass);
				}
			});
	});
}
/*
$.lanzadorExtendido({
	 disparadores:".lanzador_extendido",
	 tab:"#plan_de_estudios",
	 estructuraTabs:{
		 elementos:".tabs",
		 contenidos:".tabs_contenido",
		 addClass:"activo",
		 prefijo:"content_"
	 }
 })*/

/**********************************
   FUNCION LANZADOR_EXTENDIDO_END
***********************************/

/**********************************
    FUNCION SCROLL_GLOBO
***********************************/
jQuery.scrollGlobo = function(opciones_fn){
	var opciones = opciones_fn;
	jQuery(window).scroll(function(){
		if(jQuery(opciones.IDaSeguir).is(':visible')){
			if(jQuery(window).scrollTop() > jQuery(opciones.IDaSeguir).offset().top){
				if(jQuery(window).scrollTop()<jQuery(opciones.IDaSeguir).offset().top+jQuery(opciones.IDaSeguir).height()-jQuery(opciones.IDglobo).height()){
					jQuery(opciones.IDglobo).animate({top:(jQuery(window).scrollTop()-jQuery(opciones.IDaSeguir).offset().top)+'px' },{queue: false, duration: 350});
				} else {
					jQuery(opciones.IDglobo).css('top',(jQuery(opciones.IDaSeguir).height()-jQuery(opciones.IDglobo).height()-20)+'px');
			  	}
			  }else {
				jQuery(opciones.IDglobo).css('top','0');
			  }
		}
	});
}
/*
$.scrollGlobo({
	 IDaSeguir:"#content_plan_de_estudios",
	 IDglobo:"#globo_contenido"
 })
*/

/**********************************
   FUNCION SCROLL_GLOBO_END
***********************************/




/**********************************
    FUNCION SLIDER_FILTROS
***********************************/
jQuery.sliderIber = function(opciones_fn){
	var opciones = opciones_fn;
/////////////////////////////////
/////////////////////////////////
	var stage = jQuery(opciones.stage);
	var contenedor = jQuery(opciones.contenedor);
	var anchoTotal = stage.find(opciones.elementos).length*opciones.anchoElemento;
	var anchoStage = stage.width();
	var btnNext = jQuery(opciones.btnNext);
	var btnPrev = jQuery(opciones.btnPrev);
	var sliderTotal = stage.find(opciones.elementos).length;
	var sliderContador = 0;
	var sliderDir = true;
	if(opciones.auto == undefined){ opciones.auto = true; }
	
	contenedor.css('width',anchoTotal+'px').css('position','absolute').css('margin-left','0px');
	
	
	function autoSlider(){
		
		if(contenedor.css('margin-left').split('px') == undefined){
			var margen = 0;
		} else {
			var margen = contenedor.css('margin-left').split('px');
			margen = margen[0];
		}
       
		contenedor.animate({'marginLeft':0-(sliderContador*opciones.anchoElemento)},500);
		if(sliderDir){
			if(sliderContador < (sliderTotal-opciones.cantidadVisible)){
				sliderContador++;
			} else {
				sliderContador--;
				sliderDir = false;
			}
		} else {
			if(sliderContador > 0){
				sliderContador--;
			} else {
				sliderContador++;
				sliderDir = true;
			}
		}
	}
	if(stage.find(opciones.elementos).length > 0){
	if(opciones.auto){
		var intervaloSlide = setInterval(autoSlider,4000);
	}}
	
	btnNext.click(function(){verSiguiente(); return false;});
	btnPrev.click(function(){verPrevio(); return false;});
	function verSiguiente(){
		clearInterval(intervaloSlide);
		if(contenedor.css('margin-left').split('px') == undefined){
			var margen = 0;
		} else {
			var margen = contenedor.css('margin-left').split('px');
			margen = margen[0];
		}
		if(margen <=0 && margen > -(anchoTotal-(opciones.cantidadVisible*opciones.anchoElemento)) ){
			sliderContador++
                        contenedor.animate({'marginLeft':0-(sliderContador*opciones.anchoElemento)},500);
								

		}
		return false;
	}
	function verPrevio(){
		clearInterval(intervaloSlide);
		if(contenedor.css('margin-left').split('px') == undefined){
			var margen = 0;
		} else {
			var margen = contenedor.css('margin-left').split('px');
			margen = margen[0];
		}
		if(margen<0 ){
			sliderContador--;
                       contenedor.animate({'marginLeft':0-(sliderContador*opciones.anchoElemento)},500);
					   		

		}
		//jQuery('#xivato').append(+margen+(anchoTotal-(opciones.cantidadVisible*opciones.anchoElemento))+'<br>');
		return false;
	}
/////////////////////////////////
/////////////////////////////////
}
/*
$.sliderIber({
	 stage:".stage",
	 contenedor:"#contenido_centros_destacados",
	 elementos:'a',
	 anchoElemento:124,
	 btnNext:'#btn_next',
	 btnPrev:'#btn_prev',
	 cantidadVisible:4,
	 auto: true;
});*/
/**********************************
   FUNCION SLIDER_END
***********************************/




/**********************************
    FUNCION CANTOS_ROMBOS
***********************************/
jQuery.cantosRombos = function(opciones_fn){
	var opciones = opciones_fn;
/////////////////////////////////
/////////////////////////////////
	if(opciones.exclude == undefined){
			var elementos = jQuery(opciones.elementos);
		} else {
			var elementos = jQuery(opciones.elementos+':not('+opciones.exclude+')');
	}
	elementos.each(function(){
		doIt(jQuery(this));
	});
	function doIt(elementoAccion){
			anchura = elementoAccion.width();
			anchuraisPar = false;
			if(anchura%2==0){ anchuraisPar = true;}
			if(anchuraisPar == false){elementoAccion.addClass('inpar')};
			
			var altura = elementoAccion.height();
			var isPar = false;if(altura%2==0){ isPar = true;}	if(isPar == false){altura++};
			//alert(elementoAccion.is(opciones.noHeight));
			noAltura = false;
			if(opciones.noHeight != undefined){
				for(i=0;i<opciones.noHeight.length;i++){					
					if(elementoAccion.is(opciones.noHeight[i])){
						noAltura = true;
					}
				}
			}
			if(noAltura){
					elementoAccion.css('min-height', altura+'px').css('height','auto').css('position','relative');//css('width',anchura+'px')
			} else {
					elementoAccion.css('min-height', altura+'px').css('height','auto').css('height',altura+'px').css('position','relative');//css('width',anchura+'px')
			}
			/*elementoAccion.attr('style','min-height:'+altura+'px; height:auto !important; height:'+altura+'px;position:relative');*/
			elementoAccion.append(opciones.insertarHTML);
	}
/////////////////////////////////
/////////////////////////////////
}
/*
$.cantosRombos({
	 elementos:".widget_gris",
	 insertarHTML:"<b class='tl'></b><b class='tr'></b><b class='bl'></b><b class='br'></b>",
 })*/
/**********************************
   FUNCION CANTOS_ROMBOS_END
***********************************/

/**********************************
   FUNCION DESHABILITA_PROVINCIAS
***********************************/
function update_provincia(){
	var pais=jQuery('#registro_pais_id').attr('value');
	if(pais != '1')
	{
		jQuery('#registro_provincia_id').removeAttr("enabled");
		jQuery('#registro_provincia_id').attr("disabled","disabled");
	}
	else
	{
		jQuery('#registro_provincia_id').removeAttr("disabled");
		jQuery('#registro_provincia_id').attr("enabled","enabled");
	}
}



/**********************************
    FUNCION MENU_CENTRO
***********************************/
jQuery.menuCentros = function(opciones_fn){
	var opciones = opciones_fn;
	//alert(jQuery(opciones.elementos).length);
	//alert(jQuery(opciones.elementos).length);
	if(jQuery(opciones.elementos).length > 0){
	var mix = new Array();
	var contenedores = new Array();
	if(opciones.exclude == undefined){
			var elementos = jQuery(opciones.elementos);
		} else {
			var elementos = jQuery(opciones.elementos+':not('+opciones.exclude+')');
	}
	elementos.each(function(){
		var id = jQuery(this).attr('href').split('#')[1];
		mix[id] = {'elemento': jQuery('#'+id),'id': id,'lanzador':jQuery(this)};
		contenedores.push({'elemento': jQuery('#'+id),'id': id,'lanzador':jQuery(this)});
		jQuery(this).click(function(){
				mostrar(id);
				return false;
		});
	});
	function mostrar(id){
		for(i=0;i<contenedores.length;i++){
			var Ocultar = true;
			/*if(opciones.noHide != undefined){
				//alert(opciones.noHide.length);
				for(i=0; i<opciones.noHide.length ;i++){
					if(contenedores[i]['elemento'].is(opciones.noHide[i])){
						Ocultar = false;
						//alert('oculta');
					}
				}
			}*/
			if(Ocultar){
				contenedores[i]['elemento'].hide();
			}
		}
		jQuery(opciones.elementos).parent().removeClass('activo');
		jQuery(mix[id]['lanzador']).parent().addClass('activo');
		jQuery(mix[id]['elemento']).show();
		
		jQuery('#filtros').css('height','200px');
		if(jQuery('body').height()< jQuery(window).height()){ tamanyo_final = jQuery(window).height();} else {tamanyo_final = jQuery('body').height();}
		jQuery('#filtros').css('height',tamanyo_final+'px');
		return false;
	}
	if(opciones.adicional != undefined){
		jQuery(opciones.adicional).each(function(){
			jQuery(this).click(function(){
				var id = jQuery(this).attr('href').split('#')[1];
				mostrar(id);
				return false;
			});
		});
	}
	var jash = window.location.hash.split('#')[1];
	//if(jash != undefined){ alert("noooo"); }
	if(jash != undefined && mix[jash]['id'] != ""){
		mostrar(jash);
		jQuery("html:not(:animated),body:not(:animated)").animate({ scrollTop: '0px'}, 1);
	} else {
		mostrar(contenedores[0]['id']);
	}
	}
	if(opciones.noHide != undefined){
		for(i=0; i<opciones.noHide.length ;i++){
					jQuery(opciones.noHide[i]).show();
		}
	}
	
}
/*
$.menuCentros({
	 elementos:"#filtros_cont"
})*/
/**********************************
   FUNCION MENU_CENTRO_END
***********************************/