function initCufon() {
	Cufon.replace('#header h1', { fontFamily: 'AGP', hover: true,textShadow: '1px 1px  #706654' });
	Cufon.replace('#header #phone', { fontFamily: 'AGP', hover: true,textShadow: '1px 1px  #706654' });	
	Cufon.replace('#quicksearch label', { fontFamily: 'Trebuchet2', hover: true });

}

initCufon();
anylinkcssmenu.init("anchorclass");





$(document).ready(function() {

	
$("#searchresults").tablesorter({sortList: [[0,0]], widgets: ['zebra']}); 
	$(".trigger").tooltip({ 
		position: "center left",
		tip:'.tooltip',
		delay:2000,
		offset: [0,10],relative:true,
		onBeforeShow: function(){
		clear();
			theUrl = this.getTrigger().attr("tooltip");
			getAjaxData(theUrl, this.getTip());
		}
	});

	function clear() {

$('.trigger').each(function() {
  $(this).data('tooltip').hide();
});

	}

	function getAjaxData(theUrl, $tip) {
	    $.ajax({
	        url:theUrl,
	        success: function(response) {
	            $tip.html(response);
	        }
	    });
	}



$('#slideshowhome').cycle({ 
    fx: 'fade',
	next:   '.next', 
    prev:   '.prev',
 timeoutFn: calculateTimeout 
});




 var $slideshow =$('#slideshow').cycle({ 
    fx: 'fade',
	next:   '.next', 
    prev:   '.prev'
});

var classes = ['sspause', 'ssplay'];
     $('#pause a').click(function(e) {
        e.preventDefault();
        $slideshow.cycle('toggle', true);
        var cls = classes[$slideshow[0].cyclePause ? 1 : 0];
        $(this).find('span').attr('class', cls);
    });


/* $("#slideshow-container-prop").mouseover(function() {
	    $('#slideshow').cycle('pause'); 
		$('.pause').addClass("shown");
  }).mouseout(function(){
		$('#slideshow').cycle('resume'); 
		$('.pause').removeClass("shown");
  });*/





/*
$('#arrive').datepicker({
		dateFormat: "yy-mm-dd",
		onSelect: function(dateText, inst) {
			dateText = eval(dateText);
			var min = new Date();
			min.setTime(dateText);
			$('#depart').datepicker('option', 'minDate', min);
		}

	});

	$('#depart').datepicker({
		dateFormat: "yy-mm-dd",
	});*/


$('#arrive').datepicker({
			 onSelect: function(dateText, inst) { $('#depart').datepicker("option", "minDate", dateText)}
		});
	$('#arrive-icon').click(function() {
		$('#arrive').datepicker('show');
	});
$('#depart').datepicker();
	$('#depart-icon').click(function() {
		$('#depart').datepicker('show');
	});


});

var timeouts = [4,4,4,4,4,4,4,10]; 
function calculateTimeout(currElement, nextElement, opts, isForward) { 
    var index = opts.currSlide; 
    return timeouts[index] * 1000; 
} 

