function basename (path, suffix) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Ash Searle (http://hexmen.com/blog/)
    // +   improved by: Lincoln Ramsay
    // +   improved by: djmix
    // *     example 1: basename('/www/site/home.htm', '.htm');
    // *     returns 1: 'home'
    // *     example 2: basename('ecra.php?p=1');
    // *     returns 2: 'ecra.php?p=1'

    var b = path.replace(/^.*[\/\\]/g, '');
    
    if (typeof(suffix) == 'string' && b.substr(b.length-suffix.length) == suffix) {
        b = b.substr(0, b.length-suffix.length);
    }
    
    return b;
}


$(document).ready(function(){
				/*LIGHTBOX*/
				$("a[rel='lightbox']").colorbox();
				$('a[rel="individual"]').colorbox({rel:'nofollow'});
				$(".html_lightbox").colorbox({iframe:true, innerWidth:780, innerHeight:500});
				//Cases Rurals
				$("a[rel='barbatx']").colorbox();
				
				$('.menu li a').each(function () {
						if (basename(window.location.href) == basename($(this).attr('href')))
							$(this).addClass('activo');
						else
							$(this).removeClass('activo');
			     });
				
				$('.submenu li a').each(function () {
						if (basename(window.location.href) == basename($(this).attr('href')))
							$(this).addClass('subactivo');
						else
							$(this).removeClass('subactivo');
			     });
				
				
});
/*ABRIR VENTANA*/
function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}
/*PESTAŅAS VIAJES*/
function cambia(tipo) {
  $('.grupos_tipo').hide();
  $('#' + tipo).show();
  $('.tabs_menu li').removeAttr('class');
  $('#' + tipo + '_li').attr('class', 'actual');
}
cambia('preambulo');

