jQuery(document).ready(function($){

$('a.topBtn3').click(function() {
	_gaq.push(['_trackEvent', 'online booking', 'click', 'reservations']);
});

	/*********** SETTING UP HEIGHT TOGGLE OF CONTENTS ********/
	$('.row2 .column1 h3').toggle(
		function()
		{
			$('.row2').animate({
				height: "42"
			}, 500);
			
			$('.jspVerticalBar').css('display','none');
                        
                        $('.row2 .column1 h3').toggleClass("closed");
		},
		function()
		{
			$('.row2').animate({
				height: "290"
			}, 500);
			
			$('.jspVerticalBar').css('display','block');
                        
                        $('.row2 .column1 h3').toggleClass("closed");
		}
	);

/********** SETTING UP SCROLL PANEL ************/
	$(function(){
    	       $('.row2 .column1').jScrollPane();
	});

/*********** DATE PICKER *************/
	if ($(".date-pick").length > 0){
		$(function() {
			$('.date-pick').datepicker({
				showOtherMonths: true, 
				selectOtherMonths: true,
				minDate:0 , 
				showOn: 'button', 
				buttonImage: webURL + 'images/calendar.jpg',
				buttonImageOnly: true
			});
		
			if (currentLang == 'el') {
				$('.date-pick').datepicker('option', $.datepicker.regional['el']);
			} else {
				$('.date-pick').datepicker('option', $.datepicker.regional['en-GB']);
			}			
		});
		
		var today = new Date();
		today.setDate(today.getDate()+1);
		var todayDate = '' + today.getDate();
		var todayDateStr = ( todayDate.length==1 ? '0'+todayDate : todayDate );
		var todayMonth = '' + (today.getMonth()+1);
		var todayMonthStr = ( todayMonth.length==1 ? '0'+todayMonth : todayMonth );
		
		var dateInEl = document.getElementById('date-in');
		var usDateInEl = document.getElementById('eu-date-in');
		
		if (usDateInEl) {
			if (usDateInEl.value == 'unknown') {
				dateInEl.value = todayDateStr + '/' + todayMonthStr + '/' +  today.getFullYear();
				usDateInEl.name = 'usdatein';
				usDateInEl.defaultValue = 'waiting'; 
				usDateInEl.value = usDateInEl.defaultValue;
			}
		}
	}
	
/******* SETTING POSITIONING OF ELEMENTS ************/
        var footerTop = $('#superwrapper').height() - $('#footer').height();	
        $("#footer").css("top",footerTop+"px");
        var headerLeft = $('#superwrapper').width() - $('#header').width();	
        $("#header").css("left",headerLeft +"px");
        var bestRateLeft = $('#superwrapper').width() - 340;	
        $(".row1 .column3").css("left",bestRateLeft +"px");
		
	$(window).bind('resize', function(){
	
             footerTop = $('#superwrapper').height() - $('#footer').height();	
             $("#footer").css("top",footerTop+"px");
             headerLeft = $('#superwrapper').width() - $('#header').width();	
             $("#header").css("left",headerLeft +"px");
             bestRateLeft = $('#superwrapper').width() - 340;	
             $(".row1 .column3").css("left",bestRateLeft +"px");
               					
	});
        
        $('.row2 .column1 h3').click();

});

function bookingOnSubmit() {
	var dateParts = $("#date-in").val().split('/');
	document.getElementById('eu-date-in').value = $("#date-in").val();
	document.getElementById('date-in').value = dateParts[1] + '/' + dateParts[0] + '/' + dateParts[2];
	document.getElementById('eu-date-in').name = 'eudatein';

        _gaq.push(['_trackEvent', 'online booking', 'Submit', 'booking form']);

	return true;
}

/***************** LANGUAGE SELECT BOX *******************/
$(function() {

	$('#languages ul').each(function() {
		var html = $('<select onchange="window.location.href=this.value;" ></select>');
		
		$(this).find('a').each(function() {
			var option = $('<option ></option>');
			option.attr('value', $(this).attr('href')).html($(this).text());
			
			if ($(this).hasClass('active')) {
				option.attr('selected', 'selected');
			}
			
			html.append(option);
		});
		
		$(this).replaceWith(html);
	});

});
				var _gaq = _gaq || [];
				_gaq.push(['_setAccount', 'UA-25065039-1']);
				_gaq.push(['_trackPageview']);
				_gaq.push(['_trackPageLoadTime']);
				
				(function() {
					var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
					ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
					var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
				})();
