/* ********** (C) REIS.NL 2009 ********** */

/* ********** ****** ********* ********** */
/* ********** JQUERY FUNCTIONS ********** */
/* ********** ****** ********* ********** */

$(document).ready(function() {
		
	$("li.option").click(function() {
		var num = this.id.replace(/\D/g, ""); // Replace non numeric character with nothing to get the number from the clicked li
		$("fieldset[id^='fs']").hide(); // Hide all fieldsets with an id that starts with fs
        $("#fs" + num).show(); // Show the fieldset with id fs + num (ie fs2)
	});
		
	$(".tabs span").click(function() {
		var num = this.id.replace(/\D/g, ""); // Replace non numeric character with nothing to get the number from the clicked span
		$("div.content").hide(); // Hide all divs with an id that starts with content
		$("#content" + num).show(); // Show the div with id content + num (ie content2)
	});
	
	$("div.list div.accommodation").click(function() {
		//var num = this.id.replace(/\D/g, ""); // Replace non numeric character with nothing to get the number from the clicked span
		var loc = this.id;
        window.location = loc;
	});
	
	$("div.list div.country").click(function() {
		//var num = this.id.replace(/\D/g, ""); // Replace non numeric character with nothing to get the number from the clicked span
		var name = this.id;
        window.location = "/" + name;
	});
	
	$(".query").click(function() {
		$("div.query").hide(); // Hide all divs with an id that starts with content
	});
	
	$('#tabs').tabs();

	$("#accordion").accordion({
		collapsible: true
	});
	$("#topoffers").accordion({
		collapsible: true
	});
	$("#offers").accordion({
		collapsible: true
	});
	
	$("#kwaliteit").accordion({
		collapsible: true
	});
	
	$("#searchoptions").accordion({
		collapsible: true
	});
	$("#banner").accordion({
		collapsible: true
	});
	
	$(function() {
		$("#tabs").tabs();
	});
			
	//Open links naar aff. in een nieuw venster en registreer de click via GA
	$(function(){
		$('a.new-window').click(function(){
		  pageTracker._trackEvent('External_URL', 'Click', this.href);
	      window.open(this.href);
	      return false;
	      });
    });

	$(".stars-wrapper").stars({
			disabled: true,
		     inputType: "option",
		     split: 2
	});
	
	$("div.list div.accommodation").mouseover(function(){
		$(this).find("div.more-info").show();
	    }).mouseout(function(){
	    	$(this).find("div.more-info").hide();
	});
	
	
	 $('.date-pick').datepicker({
		beforeShow: function(input, inst)
	    {
	        inst.dpDiv.css({marginTop: -input.offsetHeight + 'px', marginLeft: -input.offsetWidth + 'px'});
	    },
	    dateFormat: 'yy-mm-dd',
	    defaultDate: +7
		}).trigger('change');
	 
});



/* ********** ********** ********* ********** */
/* ********** JAVASCRIPT FUNCTIONS ********** */
/* ********** ********** ********* ********** */

/*

*/
