
function show_hide(field) {
	if (document.getElementById(field).style.display == 'block') document.getElementById(field).style.display = 'none'
	else if (document.getElementById(field).style.display == 'none') document.getElementById(field).style.display = 'block'
}


function Opensupport2(newin) {
	Support2=window.open(newin,"Support2","resizeable=yes,scrollbars=yes,width=550,height=320 top=250,left=250");
	window.Support2.focus();
}

function Opensupport3(newin) {
	Support3=window.open(newin,"Support3","resizeable=yes,scrollbars=yes,width=600,height=435 top=250,left=250");
	window.Support3.focus();
}

function Opensupport4(newin) {
	Support4=window.open(newin,"Support4","resizeable=yes,scrollbars=yes,width=350,height=545 top=250,left=250");
	window.Support4.focus();
}


function Opensupport5(newin) {
Support5=window.open(newin,"Support5","resizeable=yes,scrollbars=yes,width=825,height=565 top=50,left=50");
window.Support5.focus();
}


function Opensupport6(newin) {
Support4=window.open(newin,"Support4","resizeable=yes,scrollbars=yes,width=800,height=565 top=50,left=50");
window.Support4.focus();
}

function Opensupport753(newin) {
Support4=window.open(newin,"Support4","resizeable=yes,scrollbars=yes,width=800,height=565 top=50,left=50");
window.Support4.focus();
}


function showImage(imgUrl) {
  	document.property_image.src = imgUrl;
}


function addToFavorites( rid ) {
		//$("div#extendstatus").html("");
			//$("div#extendstatus").css("display","none");

			var r = rid.split(",");
		 
		 	var yurl = "/Ocean-Isle-Beach-rentals/add-to-favorites.cfm?rid="+r['1'] +"&ts="+new Date();



			$.get(yurl,'',function(data) {

				var response = jQuery.trim(data);
				if (response !='') {
					if (response.search("~")) {

						var res = response.split("~");
						//$("div#extendstatus").html(res[0]);
						//$("#e"+aid).html(res[1]);
						//$("div#extendstatus").css("display","");
						//alert(res[1]);
						$("a#atf"+res[1]).html("<img class='icon' border='0' src='/images/icons/add.png'/> Added");

					} else {

						//$("div#extendstatus").html(response);
						//$("div#extendstatus").css("display","");
					}
				}
			});//$.get
		 return false;

	}

function deleteFromFavorites( rid ) {
		//$("div#extendstatus").html("");
			//$("div#extendstatus").css("display","none");

		 
		 	var yurl = "/Ocean-Isle-Beach-rentals/delete-from-favorites.cfm?rid="+rid+"&ts="+new Date();



			$.get(yurl,'',function(data) {

				var response = jQuery.trim(data);
				if (response !='') {
					if (response.search("~")) {

						var res = response.split("~");
						//alert(res[1]);
						$("li#"+res[1]).remove();
						//$("div#extendstatus").html(res[0]);
						//$("#e"+aid).html(res[1]);
						//$("div#extendstatus").css("display","");

					} else {
						
						//$("div#extendstatus").html(response);
						//$("div#extendstatus").css("display","");
					}
				}
			});//$.get
		 return false;

	}




$(document).ready(function () {

   $('#navigation li:has(ul)').hover( 
      function () {
         $(this).find('ul').fadeIn('fast');
      }, 
      function () {
         $(this).find('ul').hide();
      }
   );
   
   $('#navigation li:has(ul) > a').click( function () {
      return false;
    });
   
   

   function saturdayFilter(date) {
   	return (date.getDay() != 6) ? [false, ''] : [true, '']; 
   }
   function noFilter(date) {
      return [true, ''];
   }
   
   
   if($("#strCheckin").datepicker) {
  		$("#strCheckin").datepicker({showOn: 'button', buttonImage: '/images/layout/smallCal.png', buttonImageOnly: true, beforeShowDay: saturdayFilter});
  		$("#strCheckin1").datepicker({showOn: 'button', buttonImage: '/images/layout/smallCal.png', buttonImageOnly: true, beforeShowDay: saturdayFilter});
		$("#strCheckin2").datepicker({showOn: 'button', buttonImage: '/images/layout/smallCal.png', buttonImageOnly: true, beforeShowDay: noFilter});
   }
	 


   $("input[name='period']").click( function () {
	   
      if( $("input[name='period']:checked").val() == 'daily' ) {
         $("#strCheckin").datepicker('option', {beforeShowDay: noFilter});
         $("#intNights").html("\
            <option value='1'>1</option> \
            <option value='2'>2</option> \
            <option value='3'>3</option> \
            <option value='4'>4</option> \
            <option value='5'>5</option> \
            <option value='6'>6</option>");
			$("#pn").show();
      } else {
         $("#strCheckin").datepicker('option', {beforeShowDay: saturdayFilter});
         $("#intNights").html("\
             <option>7</option>\
             <option>14</option>\
             <option>21</option>");
			 $("#pn").hide();
         
      }
   });
   
   $("input[name='period']:checked").click();




   $("input[name='period1']").click( function () {
	   
      if( $("input[name='period1']:checked").val() == 'daily' ) {
         $("#strCheckin1").datepicker('option', {beforeShowDay: noFilter});
         $("#intNights1").html("\
            <option value='1'>1</option> \
            <option value='2'>2</option> \
            <option value='3'>3</option> \
            <option value='4'>4</option> \
            <option value='5'>5</option> \
            <option value='6'>6</option>");
			$("#pn1").show();
      } else {
         $("#strCheckin1").datepicker('option', {beforeShowDay: saturdayFilter});
         $("#intNights1").html("\
             <option>7</option>\
             <option>14</option>\
             <option>21</option>");
			 $("#pn1").hide();
         
      }
   });
   
   $("input[name='period1']:checked").click();
   







   
	

   
});

function copydate(){
	
	//$("#strCheckinBottom").val($("#strCheckin1").val());
	//$("#strCheckinBottom1").val($("#strCheckin1").val());
	
	
	}

$(document).ready( function () {

   $('.unhide').bind('click', function () {
      var id = '#' + $(this).attr('rel');
      $(id).toggle();
   });

      $('.unhide1').bind('click', function () {
      var id = '#' + $(this).attr('rel');
      $(id).toggle();

	  //alert($(this).attr('href'));
	  document.location.toString($(this).attr('href'));
   });

   $('.hidden').hide();
   
   $("#amenTable a").click(function(){
							 
			var u = $(this).attr('href');				 
			//alert(u);
			$(this).attr('href',u+"&strcheckin="+$("#strCheckin1").val());
				    
				    
	});


})

