/*
 * SimpleModal Basic Modal Dialog
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2010 Eric Martin - http://ericmmartin.com
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Revision: $Id: basic.js 254 2010-07-23 05:14:44Z emartin24 $
 */

jQuery(function ($) {
	// Load dialog on page load
	//$('#basic-modal-content').modal();

	// Load dialog on click
	$('.basic').click(function (e) {
		$('#modal-content').modal();
		return false;
	});
	
	$('.basic2').click(function (e) {
		$('#modal-tell').modal();
		return false;
	});
	
	$('.basic3').click(function (e) {
		$('#location').modal();
		return false;
	});
	
	$(".lightbox").lightbox();
	
	$(function() {
		var dates = $( "#from, #to" ).datepicker({
			defaultDate: "+1w",
			changeMonth: true,
			numberOfMonths: 3,
			onSelect: function( selectedDate ) {
				var option = this.id == "from" ? "minDate" : "maxDate",
					instance = $( this ).data( "datepicker" ),
					date = $.datepicker.parseDate(
						instance.settings.dateFormat ||
						$.datepicker._defaults.dateFormat,
						selectedDate, instance.settings );
				dates.not( this ).datepicker( "option", option, date );
			}
		});
	});
	
	$(document).ready(function() {	
		if ($('#panel #panel-1').length>0) {
			$('#mask').css({'height':$('#panel #panel-1').height()});	
		}
		else{
			if ($('#panel #panel-2').length>0){
				$('#mask').css({'height':$('#panel #panel-2').height()});	
			}
			else{
				if ($('#panel #panel-3').length>0){
					$('#mask').css({'height':$('#panel #panel-3').height()});	
				}	
				else{
					$('#mask').css({'height':$('#panel #panel-4').height()});		
				}
			}
		}


	$('#panel').width(parseInt($('#mask').width() * $('#panel div').length));
	$('#panel div').width($('#mask').width());
	$('a[rel=panel]').click(function () {
		var panelheight = $($(this).attr('href')).height();
		$('a[rel=panel]').removeClass('selected');
		$(this).addClass('selected');
		$('#mask').animate({'height':panelheight},{queue:false, duration:500});			
		$('#mask').scrollTo($(this).attr('href'), 800);		
		return false;
	});
});
});
