$(document).ready(function() {
  $("#buttonmontagne").click(function() {
  	$("#recherchelac").slideUp("fast");
  	$("#recherchemontagne").slideDown("fast");
  });
  $("#buttonmontagne2").click(function() {
  	$("#recherchelac").slideUp("fast");
  	$("#recherchemontagne").slideDown("fast");
  });
  $("#buttonlac").click(function() {
  	$("#recherchemontagne").slideUp("fast");
    $("#recherchelac").slideDown("fast");
  });
  $("#buttonlac2").click(function() {
	  $("#recherchemontagne").slideUp("fast");
	  $("#recherchelac").slideDown("fast");
  });
});

$(document).ready(function() {
  $("#buttonvente").click(function() {
  	$("#laclocation").slideUp("fast");
  	$("#lacvente").slideDown("fast");
  });
  $("#buttonlocation").click(function() {
    $("#laclocation").slideDown("fast");
  	$("#lacvente").slideUp("fast");
  });
});

$(document).ready(function() {
	$("#buttonvente2").click(function() {
		$("#montagnelocation").slideUp("fast");
		$("#montagnevente").slideDown("fast");
	});
	$("#buttonlocation2").click(function() {
		$("#montagnelocation").slideDown("fast");
		$("#montagnevente").slideUp("fast");
	});
});

$(document).ready(function() {
// setting the tabs in the sidebar hide and show, setting the current tab
	$('div.tabbed div').hide();
	$('div.t1').show();
	$('div.tabbed ul.tabs li.t1 a').addClass('tab-current');

// SIDEBAR TABS
$('div.tabbed ul li a').click(function(){
	var thisClass = this.className.slice(0,2);
	$('div.tabbed div').hide();
	$('div.' + thisClass).show();
	$('div.tabbed ul.tabs li a').removeClass('tab-current');
	$(this).addClass('tab-current');
	});
});

  jQuery(function() {
		var loader = jQuery('<div id="loader"><img src="/media/images/loading_mini.gif" alt="loading..." /> Envoi en cours</div>')
			.hide()
			.appendTo("#form");
		jQuery().ajaxStart(function() {
			loader.show();
		}).ajaxStop(function() {
			$("#loader").hide();
			$("#form").hide();
		}).ajaxError(function(a, b, e) {
			throw e;
		});

		var v = jQuery("#form").validate({
			submitHandler: function(form) {
				jQuery(form).ajaxSubmit({
					target: "#rappel"
				});
			}
		});
	});
function sendData(param, page, combo){
	if(document.all){
	  var XhrObj = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	  var XhrObj = new XMLHttpRequest();
	}
	var content = document.getElementById(combo);

	XhrObj.open("POST", page);
	XhrObj.onreadystatechange = function(){
	  if (XhrObj.readyState == 4 && XhrObj.status == 200) {
	    content.innerHTML = XhrObj.responseText ;
	  }
	}
	XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	XhrObj.send(param);
}