function check_date(){
		var error=false;
		$('.date-selected').each(function(){
			var date_val=$(this).val();
			if (date_val.length<=0){
				error=true;
			}
		})
		if (Date.parse($('#start-date').val()) > Date.parse($('#end-date').val())) {
			error=true;
		}
		return error;
	};
function show_steps(){
	var msg=check_date();
	if (msg!==true){
			var data=$('.frm-act').serialize();
			$.ajax({
				type: "post",
				data: data,
				url: "ajax.checkdate.php",
				success: function(msg) {
					$('.step2').find('.step-show').html(msg);
					var rel=$('#cabins a:first').attr('rel');
					$('#cabins a:first').addClass('selected');
					$('#cabin').val(rel);
					$('.step-show').fadeIn();
	
				}
			});
		}
		else{
				$('.step-show').fadeOut();
		}
	
	
	}

$(document).ready(function() {
	$('.nav li').hover(
		function(){
			$(this).css('z-index','9999')
			$(this).find('.dd:eq(0)').stop(true,true).slideDown();
			if ($(this).find('a:eq(0)').hasClass('active'))
				$(this).find('a:eq(0)').addClass('active-set');
			else			
				$(this).find('a:eq(0)').addClass('active');
		},
		function(){
			$(this).css('z-index','1')
			$(this).find('.dd:eq(0)').stop(true,true).slideUp(100);
			if (!$(this).find('a:eq(0)').hasClass('active-set'))
				$(this).find('a:eq(0)').removeClass('active');
		}
	)
	
	if ($('.frm-act').length){
		$('.frm-act').jqTransform();
		if ($('.selectfixes').length){
			UpdatePrices();
		}
	}
	if ($('.formbox').length){
		$('form').jqTransform();
	}

	if ($('.scroll-pane').length){
			$('.scroll-pane').jScrollPane({showArrows: true});
			
		}

	//slider
	if ($('.slider').length){
		$('.slider').bxSlider({displaySlideQty: 3});
	}
	//slider2
	if ($('.slider2').length){
		$('.slider2').bxSlider({
			mode: 'fade', 
			pause: 5000,
			//speed: 500,
			auto: true						   
		});
	}
	
//initializatiion	
if ($('.step').length){
	$('.step-show').hide(1);
	//initialization
	show_steps();
	//date chenge event
//	$('.date-selected').change(function(){
	//	show_steps();
//	})
	//step 2 cabin click
	$('#cabins a').live('click',function(){
		var rel=$(this).attr('rel');
		$('#cabin').val(rel);
		$('#cabins a').removeClass('selected');
		$(this).addClass('selected');
		return false;
	})
}





	//datepicker
	/*_____________________________________*/
	
	function checkdate(argObj) {

		/*
			var startobj=$('#start-date');
			var endobj=$('#end-date');
			var start=startobj.val();
			var end=endobj.val();
			var s_date=''
			var e_date=''
			if (start!=''){
				var s_day= start.substring(0,2);
				var s_month= start.substring(3,5);
				var s_year= start.substring(6,10);
				s_date = new Date(s_year, s_month-1, s_day); 
			}
			if (end!=''){
				var e_day= end.substring(0,2);
				var e_month= end.substring(3,5);
				var e_year= end.substring(6,10);
				e_date = new Date(e_year, e_month-1, e_day); 
			}
			if (e_date!=''){
				if(s_date>e_date){
						startobj.val('');
					}
		*/
			if ($('.step').length){
				show_steps();
			}
		/*	}*/
			
	};
	
	/*_____________________________________*/
	var d = new Date();
	var curr_date = d.getDate();
	if (curr_date<10)
		curr_date='0'+curr_date;
	var curr_month = d.getMonth()+1;
	if (curr_month<10)
		curr_month='0'+curr_month;
	var curr_year = d.getFullYear();
	var date_str=curr_year+''+curr_month+''+curr_date;
	
	var disabled={  /*"20110401":"20110412", // Range of dates
					"20110501":"20110622", // Range of dates
					"20090622":"1",        // Single date
					"****1225":"1"         // Wildcard example */
					};
	
	datePickerController.addEvent(window, "load", function() {
		  var opts = {
			languageInfo	: "en",
			// The ID of the associated form element
			id:"start-date",   // The date format to use
			format:"m-sl-d-sl-Y",        // Days to highlight (starts on Monday)
			highlightDays:[0,0,0,0,0,1,1],        // Days of the week to disable (starts on Monday)
			disabledDays:[0,0,0,0,0,0,0],        // Dates to disable (YYYYMMDD format, "*" wildcards excepted)
			disabledDates:disabled,
			enabledDates:{},        // Don't fade in the datepicker        // NOTE: Only relevant if "staticPos" is set to false
			noFadeEffect:false,        // Is it inline or popup
			staticPos:false,        // Do we hide the associated form element on create
			hideInput:false,        // Do we hide the today button
			noToday:true,        // Do we show weeks along the left hand side
			showWeeks:true,        // Is it drag disabled        // NOTE: Only relevant if "staticPos" is set to false
			dragDisabled:true,     
			positioned:"",        // Do we fill the entire grid with dates
			fillGrid:true,        // Do we constrain dates not within the current month so that they cannot be selected
			constrainSelection:true,        // Callback Object
			callbacks:{"dateselect":[checkdate]}, 
			buttonWrapper:"",        // Do we start the cursor on a specific date (YYYYMMDD format string)
			cursorDate:""      
		  };
		  
		  var opts2 = {
			languageInfo	: "en",			
			// The ID of the associated form element
			id:"end-date",   // The date format to use
			format:"m-sl-d-sl-Y",        // Days to highlight (starts on Monday)
			highlightDays:[0,0,0,0,0,1,1],        // Days of the week to disable (starts on Monday)
			disabledDays:[0,0,0,0,0,0,0],        // Dates to disable (YYYYMMDD format, "*" wildcards excepted)
			disabledDates:disabled,
			enabledDates:{},        // Don't fade in the datepicker        // NOTE: Only relevant if "staticPos" is set to false
			noFadeEffect:false,        // Is it inline or popup
			staticPos:false,        // Do we hide the associated form element on create
			hideInput:false,        // Do we hide the today button
			noToday:true,        // Do we show weeks along the left hand side
			showWeeks:true,        // Is it drag disabled        // NOTE: Only relevant if "staticPos" is set to false
			dragDisabled:true,        // Positioned the datepicker within a wrapper div of your choice (requires the ID of the wrapper element)        // NOTE: Only relevant if "staticPos" is set to true
			positioned:"",        // Do we fill the entire grid with dates
			fillGrid:true,        // Do we constrain dates not within the current month so that they cannot be selected
			constrainSelection:true,        // Callback Object
			callbacks:{"dateselect":[checkdate]},        // Do we create the button within a wrapper element of your choice (requires the ID of the wrapper element)        // NOTE: Only relevant if staticPos is set to false
			buttonWrapper:"",        // Do we start the cursor on a specific date (YYYYMMDD format string)
			cursorDate:""      
		  }; 
		  
	
		datePickerController.createDatePicker(opts);
		datePickerController.setRangeLow("start-date",date_str);
		datePickerController.createDatePicker(opts2);
		datePickerController.setRangeLow("end-date",date_str);
	});
	
	
});


function mktime () {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: baris ozdil
    // +      input by: gabriel paderni
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: FGFEmperor
    // +      input by: Yannoo
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: jakes
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Marc Palau
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +      input by: 3D-GRAF
    // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Chris
    // +    revised by: Theriault
    // %        note 1: The return values of the following examples are
    // %        note 1: received only if your system's timezone is UTC.
    // *     example 1: mktime(14, 10, 2, 2, 1, 2008);
    // *     returns 1: 1201875002
    // *     example 2: mktime(0, 0, 0, 0, 1, 2008);
    // *     returns 2: 1196467200
    // *     example 3: make = mktime();
    // *     example 3: td = new Date();
    // *     example 3: real = Math.floor(td.getTime() / 1000);
    // *     example 3: diff = (real - make);
    // *     results 3: diff < 5
    // *     example 4: mktime(0, 0, 0, 13, 1, 1997)
    // *     returns 4: 883612800 
    // *     example 5: mktime(0, 0, 0, 1, 1, 1998)
    // *     returns 5: 883612800 
    // *     example 6: mktime(0, 0, 0, 1, 1, 98)
    // *     returns 6: 883612800 
    // *     example 7: mktime(23, 59, 59, 13, 0, 2010)
    // *     returns 7: 1293839999
    // *     example 8: mktime(0, 0, -1, 1, 1, 1970)
    // *     returns 8: -1
    var d = new Date(),
        r = arguments,
        i = 0,
        e = ['Hours', 'Minutes', 'Seconds', 'Month', 'Date', 'FullYear'];

    for (i = 0; i < e.length; i++) {
        if (typeof r[i] === 'undefined') {
            r[i] = d['get' + e[i]]();
            r[i] += (i === 3); // +1 to fix JS months.
        } else {
            r[i] = parseInt(r[i], 10);
            if (isNaN(r[i])) {
                return false;
            }
        }
    }

    // Map years 0-69 to 2000-2069 and years 70-100 to 1970-2000.
    r[5] += (r[5] >= 0 ? (r[5] <= 69 ? 2e3 : (r[5] <= 100 ? 1900 : 0)) : 0);

    // Set year, month (-1 to fix JS months), and date.
    // !This must come before the call to setHours!
    d.setFullYear(r[5], r[3] - 1, r[4]);

    // Set hours, minutes, and seconds.
    d.setHours(r[0], r[1], r[2]);

    // Divide milliseconds by 1000 to return seconds and drop decimal.
    // Add 1 second if negative or it'll be off from PHP by 1 second.
    return (d.getTime() / 1e3 >> 0) - (d.getTime() < 0);
}

