﻿	$(function() {
		$( "#slider_home" ).slider({
			value:1,
			min: 1,
			max: 12,
			step: 1,
			slide: function( event, ui ) {
				$( "#groupsize" ).val(ui.value );
			}
		});
		$( "#groupsize" ).val($( "#slider_home" ).slider( "value" ) );
	});
	
		$(function() {
		$( "#slider" ).slider({
			value:1,
			min: 1,
			max: 12,
			step: 1,
			slide: function( event, ui ) {
				$( "#site_cottage_search_groupsize" ).val(ui.value );
			}
		});
		$( "#site_cottage_search_groupsize" ).val($( "#slider" ).slider( "value" ) );
	});
	
	/* English/UK initialisation for the jQuery UI date picker plugin. */
/* Written by Stuart. */
jQuery(function($){
	$.datepicker.regional['en-GB'] = {
		closeText: 'Done',
		prevText: 'Prev',
		nextText: 'Next',
		currentText: 'Today',
		monthNames: ['January','February','March','April','May','June',
		'July','August','September','October','November','December'],
		monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
		'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
		dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
		dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
		dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'],
		weekHeader: 'Wk',
		dateFormat: 'dd/mm/yy',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['en-GB']);
});
	
		$(function() {
		$.datepicker.setDefaults($.datepicker.regional['en-GB']);
		$( "#startdate" ).datepicker({
			showOn: "button",
			buttonImage: "/images/calendar.gif",
			buttonImageOnly: true
		});
	});
	
			$(function() {
			$.datepicker.setDefaults($.datepicker.regional['en-GB']);
		$( "#site_cottage_search_startdate" ).datepicker({
			showOn: "button",
			buttonImage: "/images/calendar.gif",
			buttonImageOnly: true
		});
	});
	
	
	
	$(function() {
		
		$( "#button" ).click(function() {
			$( "#effect" ).toggle( 'fold', '', 500 );
			return false;
		});
	});
	
	
	
			$(function() {
		
$( "#dialog-form" ).dialog({
   autoOpen: false,
   height: 130,
   width: 200,
   modal: true,
   buttons: {
    "Finish": function() {
      $( this ).dialog( "close" );
    }
   },
   close: function() {
    allFields.val( "" ).removeClass( "ui-state-error" );
   },
   open: function(event, ui) { $('.ui-widget-overlay').bind('click', function(){ $("#dialog-form").dialog('close'); }); }
  });

		$( "#language_dialog" )
			.button()
			.click(function() {
				$( "#dialog-form" ).dialog( "open" );
			});
					
					

	});

	$(function() {
		$( "#tabs" ).tabs({
			cookie: {
				// store cookie for a day, without, it would be a session cookie
				expires: 1
			}
		});
	});
	
    $(function(){
        $("div.feature_cottage_carousel").carousel( { pagination: true } );
    });
    
    
    $(function() {
            $('.cottage_preview_1').each(function() {
               var $link=$(this);
               var p = $(this).position();
               var $dialog = $(".cottage_preview_text"+this.id)
               //var $dialog = $("div."+this.id)
               .dialog({
                  autoOpen: false,
                  position: [p.left+50,p.top],
                  resizable: false,
                  width:260,
                  minHeight:20
               });
               $link.mouseover(function() {
                  $dialog.dialog("open");
               }).mousemove(function(event) {
                  $dialog.dialog("option","position", {
                     my: "center bottom",
                     at: "center top",
                     of: event,
                     offset: "0 -20"
                  });

               }).mouseout(function() {
                  $dialog.dialog("close");
               });
            });
            $(".ui-dialog-titlebar").hide();
         });
         
             $(function() {
            $('.cottage_preview_2').each(function() {
               var $link=$(this);
               var p = $(this).position();
               var $dialog = $(".cottage_preview_text_la_"+this.id)
               //var $dialog = $("div."+this.id)
               .dialog({
                  autoOpen: false,
                  position: [p.left+50,p.top],
                  resizable: false,
                  width:260,
                  minHeight:20
               });
               $link.mouseover(function() {
                  $dialog.dialog("open");
               }).mousemove(function(event) {
                  $dialog.dialog("option","position", {
                     my: "center bottom",
                     at: "center top",
                     of: event,
                     offset: "0 -20"
                  });

               }).mouseout(function() {
                  $dialog.dialog("close");
               });
            });
            $(".ui-dialog-titlebar").hide();
         });
         
             $(function() {
            $('.cottage_preview_3').each(function() {
               var $link=$(this);
               var p = $(this).position();
               var $dialog = $(".cottage_preview_text_so_"+this.id)
               //var $dialog = $("div."+this.id)
               .dialog({
                  autoOpen: false,
                  position: [p.left+50,p.top],
                  resizable: false,
                  width:260,
                  minHeight:20
               });
               $link.mouseover(function() {
                  $dialog.dialog("open");
               }).mousemove(function(event) {
                  $dialog.dialog("option","position", {
                     my: "center bottom",
                     at: "center top",
                     of: event,
                     offset: "0 -20"
                  });

               }).mouseout(function() {
                  $dialog.dialog("close");
               });
            });
            $(".ui-dialog-titlebar").hide();
         });
         
         
         $(document).ready(function(){
             $("#county").change(function () {
              var svalue = "";
              $("#county option:selected").each(function () {
                    svalue = $(this).attr("value");
              });
              
              if(svalue != "") {
                $.post("/ajax/get-locations.aspx", { region_id: svalue },
                function(data){
                    if(data != "error") {
                        $("#location").html(data);
                    }
                });
              }
              else {
                $("#location").html('<option value="">Please select...</option>');
              }
            })
            .change();
            });
            
            
                     $(document).ready(function(){
             $("#site_cottage_search_county").change(function () {
              var svalue = "";
              $("#site_cottage_search_county option:selected").each(function () {
                    svalue = $(this).attr("value");
              });
              
              if(svalue != "") {
                $.post("/ajax/get-locations.aspx", { region_id: svalue },
                function(data){
                    if(data != "error") {
                        $("#site_cottage_search_location").html(data);
                    }
                });
              }
              else {
                $("#site_cottage_search_location").html('<option value="">Please select...</option>');
              }
            })
            .change();
            });
            
                        
                     $(document).ready(function(){
             $("#ctl00_county").change(function () {
              var svalue = "";
              $("#ctl00_county option:selected").each(function () {
                    svalue = $(this).attr("value");
              });
              
              if(svalue != "") {
                $.post("/ajax/get-locations.aspx", { region_id: svalue },
                function(data){
                    if(data != "error") {
                        $("#ctl00_location").html(data);
                    }
                });
              }
              else {
                $("#ctl00_location").html('<option value="">Please select...</option>');
              }
            })
            .change();
            });
            
            
            $(function() {
		        $("#get_in_touch_jquery").accordion({
			        collapsible: true,
			        active: false,
			        autoHeight: false
		        });
	        });
            
	        
	        $(document).ready(function(){
/* toggles cottage features */
	
	/*$(".show_cottage_features").hide();*/
	$(".cottage_features_toggle").toggle(
		function(){ //shows content add shows close icon
			$(".show_cottage_features").hide("fast");
			$(".cottage_features_toggle_indicator").addClass("cottage_features_toggle_indicator_showopen");
		}, function() { //hides content add shows open icon
			$(".show_cottage_features").show("fast");
			$(".cottage_features_toggle_indicator").removeClass("cottage_features_toggle_indicator_showopen");
		});
	
	/* toggles cottage description */
	
	/*$(".show_description").hide();*/
	$(".cottage_description_toggle").toggle(
		function(){ //shows content add shows close icon
			$(".show_description").hide("fast");
			$(".cottage_description_toggle_indicator").addClass("cottage_description_toggle_indicator_showclose");
		}, function() { //hides content add shows open icon
			$(".show_description").show("fast");
			$(".cottage_description_toggle_indicator").removeClass("cottage_description_toggle_indicator_showclose");
		});
	
	/* toggles cottage accommodation */
	
	/*$(".show_accommodation").hide();*/
	$(".cottage_accommodation_toggle").toggle(
		function(){ //shows content add shows close icon
			$(".show_accommodation").hide("fast");
			$(".cottage_accommodation_toggle_indicator").addClass("cottage_accommodation_toggle_indicator_showclose");
		}, function() { //hides content add shows open icon
			$(".show_accommodation").show("fast");
			$(".cottage_accommodation_toggle_indicator").removeClass("cottage_accommodation_toggle_indicator_showclose");
		});
	
	/* toggles cottage local info */
	
	/*$(".show_localinfo").hide();*/
	$(".cottage_localinfo_toggle").toggle(
		function(){ //shows content add shows close icon
			$(".show_localinfo").hide("fast");
			$(".cottage_localinfo_toggle_indicator").addClass("cottage_localinfo_toggle_indicator_showopen");
		}, function() { //hides content add shows open icon
			$(".show_localinfo").show("fast");
			$(".cottage_localinfo_toggle_indicator").removeClass("cottage_localinfo_toggle_indicator_showopen");
		});
		
	/* toggles cottage guestbook */
	
	/*$(".show_guestbook").hide();*/
	$(".cottage_guestbook_toggle").toggle(
		function(){ //shows content add shows close icon
			$(".show_guestbook").hide("fast");
			$(".cottage_guestbook_toggle_indicator").addClass("cottage_guestbook_toggle_indicator_showopen");
		}, function() { //hides content add shows open icon
			$(".show_guestbook").show("fast");
			$(".cottage_guestbook_toggle_indicator").removeClass("cottage_guestbook_toggle_indicator_showopen");
		});
	
	/* toggles cottage services */
	
	/*$(".show_services").hide();*/
	$(".cottage_services_toggle").toggle(
		function(){ //shows content add shows close icon
			$(".show_services").hide("fast");
			$(".cottage_services_toggle_indicator").addClass("cottage_services_toggle_indicator_showclose");
		}, function() { //hides content add shows open icon
			$(".show_services").show("fast");
			$(".cottage_services_toggle_indicator").removeClass("cottage_services_toggle_indicator_showclose");
		});
	
	/* toggles cottage notes */
	
	/*$(".show_notes").hide();*/
	$(".cottage_notes_toggle").toggle(
		function(){ //shows content add shows close icon
			$(".show_notes").hide("fast");
			$(".cottage_notes_toggle_indicator").addClass("cottage_notes_toggle_indicator_showclose");
		}, function() { //hides content add shows open icon
			$(".show_notes").show("fast");
			$(".cottage_notes_toggle_indicator").removeClass("cottage_notes_toggle_indicator_showclose");
		});
		});
	
	
	
	
	
	
	
                $("#wishlist_result_display a, #wishlist_result_display_remove a").live("click", function(){
                    if($(this).hasClass('add_property')) {
                        $(this).attr('class', 'remove_property');
                    }
                    else {
                        $(this).attr('class', 'add_property');
                    }		            
		            cc = $(this).attr('id');
                    
                    $.post("/cottage-wishlist/process.aspx", { propertyMAIN: cc },
                    function(data){
//                        if(data != "error") {
//                          $("#java_style_list").append(data)
//                        }
                    });
                    return false;
    		    });
