
	$(function(){

      $('.textpage #article').columnize({ columns: 2 });

      $(".fancybox").fancybox({
         'titleShow': true,
         'titlePosition': 'outside'
      });

		$('#comment_captcha').val('42');

		$('#divPersonalData').hide();
//		$('#divCcDataBlock').hide();
		
		$('#aPayWithCc').click(function(){$('#divCcDataBlock').show();return false;});
		
		// mini reservation
		$.fn.miniReservation = function()
		{
			var updatePeriod = function(f)
			{
				var start = f.find('#txtStart').val();
				var end = f.find('#txtEnd').val();
				if(start && end)
				{
					start = start.split('.');
					var sd = new Date(start[2], start[1]-1, parseInt(start[0])+1);
	
					var end = end.split('.');
					var ed = new Date(end[2], end[1]-1, parseInt(end[0])+1);

//					var nights = Math.ceil(Math.abs(sd.getTime() - ed.getTime()) / 24 / 1000 / 60 / 60);
					var nights = Math.floor(Math.abs(ed - sd) / 24 / 1000 / 60 / 60);

					if(nights)
					{
						f.find('.info').show().find('.nights').html(nights+'' );
					}
					else
					{
						f.find('.info').hide();
					}
				}
			};
			
			return this.each(function()
			{
				var f = $(this);				
				f.find('#txtStart').change(function(){updatePeriod(f);});
				f.find('#txtEnd').change(function(){updatePeriod(f);});
			});
		};
		
		$('#reservation').miniReservation();


      $('.toggleValue').focus(function()
      {
         this.value = "";
      });
      $('.toggleValue').blur(function()
      {
         if(this.value == "") this.value = this.defaultValue;
      });
	});
