﻿//Javascript Document
function mesActual(){
	//dejamos la funcion para que no falle la carga
}
$(document).ready(function(){
	// para el desplegable de idiomas
	$("#langBox").mouseenter(function(e){
	  $("#langBox .list").css("display", "block");
	});
	
	$("#langBox").mouseleave(function(e){
	  $("#langBox .list").css("display", "none");
	});	
		
	$('#fLinks .open').click(function (){
		$('#fLinks .open').hide();
		$('#fLinks .close').show();
		$('#fLinks .list').fadeIn(200);
		return false;
	});
	
	$('#fLinks .close').click(function (){
		$('#fLinks .close').hide();
		$('#fLinks .open').show();
		$('#fLinks .list').fadeOut(200);
		return false;
	});
	
	$('#masOpc .open').click(function (){
		$('#masOpc .open').hide();
		$('#masOpc .close').show();
		$('#masOpc .list').fadeIn(200);
		return false;
	});
	
	$('#masOpc .close').click(function (){
		$('#masOpc .close').hide();
		$('#masOpc .open').show();
		$('#masOpc .list').fadeOut(200);
		return false;
	});
	
	//03.08.11 -- para la informacion turistica
	$('#inftrs .open').click(function (){
		$('#inftrs .open').hide();
		$('#inftrs .close').show();
		$('#inftrs .list').fadeIn(200);
		return false;
	});
	
	$('#inftrs .close').click(function (){
		$('#inftrs .close').hide();
		$('#inftrs .open').show();
		$('#inftrs .list').fadeOut(200);
		return false;
	});
	
	
	// para el desplegabe de disponibilidad
	$('#Msubm_5').mouseenter(function(){
		$('#Subm_5').show();
	});
	$('#Msubm_5').mouseleave(function(){
		$('#Subm_5').fadeOut(200);
	});
	
	// para el desplegabe de busquedas rapidas
	$('#Msubm_7').mouseenter(function(){
		$('#Subm_7').show();
	});
	$('#Msubm_7').mouseleave(function(){
		$('#Subm_7').fadeOut(200);
	});
	
	// control de ocultacion
	$('.actns a').click(function(){

		$(this).removeClass('up');
	
		if ($(this).hasClass('vw')) {
			$(this).parent().find('.oc').addClass('up');
			$(this).parent().parent().find('.cntnt').fadeIn(250,function(){solveIeOpacity(this)});
		} else if ($(this).hasClass('mr')) {
			$(this).parent('.actns').hide();
			$(this).parent().parent().find('.more').fadeIn(250,function(){solveIeOpacity(this)});
		} else {
			$(this).parent().find('.vw').addClass('up');
			$(this).parent().parent().find('.cntnt').hide();
		}
		return false;
	});

	$('.ops a.slt').click(function(){
		var n=$(this).attr('href');
		openInfo(n);
	});
	
	$('.ops a.slt_cl').click(function(){
		closeAllInfos();
		var n=$(this).attr('href');
		openInfo(n);
	});
	
	// 13.04.11 carmen -- para las multipestañas del formulario de fechas horizontal
	$('#multi_pest a').click(function(){
		var n=$(this).attr('id');
		$('#multi_pest a').removeClass('up');
		$('#'+n).addClass('up');
		$('.pest_bx').hide();
		$('#'+n.replace(/\w+_\w+_(\d+)/, 'bx_bsc_$1')).fadeIn(250);

		return false;
	});
});

function closeAllInfos() {
	$('.oc').removeClass('up');
	$('.vw').addClass('up');
	$('.cntnt').hide();
}

function openInfo(n) {
	$(n+' .vw').removeClass('up');
	$(n+' .oc').addClass('up');
	$(n+' .cntnt').fadeIn(250,function(){solveIeOpacity(this)});
}

function solveIeOpacity (n) {
	if ($.browser.msie) $(n).get(0).style.removeAttribute('filter');
}

function agregar(){
   if ((navigator.appName=="Microsoft Internet Explorer") && 
		 (parseInt(navigator.appVersion)>=4)) {
	  var url="http://www.casaspain.com/"; 
	  var titulo="CASASPAIN - Alquiler apartamentos pisos villas";
	  window.external.AddFavorite(url,titulo);
   } else { 
	  if(navigator.appName == "Netscape") 
		 alert("Presione Crtl+D para agregar este sitio en sus Bookmarks"); 
   }
}

function popUp(URL,w,h) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=" + w + ",height=" + h + ",left = 251,top = 257');");
}
//'ECD - Funcin que permite mostrar una pestaa sin registrar informacin en el History del navegador.
function FocusAnchor(strAnchor){
		//closeAllInfos();
		$('#' + strAnchor).show();
		openInfo('#'+ strAnchor);
		location.hfer="#" +strAnchor;
		location.replace("#" + strAnchor);
		
}

function abrirdiv() {
	div = document.getElementById('flotante');
	div.style.display ='';
}

function cerrardiv() {
	div = document.getElementById('flotante');
	div.style.display = 'none';
}
