/*<![CDATA[*/
		   
/*****************************************************************************
//-> START General Functions
*****************************************************************************/

// --> START Date Picker
var d = new Date();
var day = d.getDay();
var interval = 3;
	if(day > 2 && day < 7) interval+= 2;
/*****************************************************************************
//-> END General Functions
*****************************************************************************/

/*****************************************************************************
//-> START Window Load
*****************************************************************************/

$(window).load(function () {

// --> START DatePicker
	$('#arrive').focus(function(){
		//$(this).val('');
			}).datepicker({
			//minDate: interval, 
			//beforeShowDay: $.datepicker.noWeekends, 
			dateFormat: 'd MM, yy',
			minDate: 1, 
			showOn: "both", 
			showAnim: "show", 
			speed: "fast", 
			buttonImage: "images/cal.gif", 
			buttonImageOnly: true, 
			hideIfNoPrevNext: true,
			onSelect: function(dateStr) {
				var newDate = $(this).datepicker('getDate');
				if (newDate) { // Not null
					newDate.setDate(newDate.getDate() + 1);
				}
				$('#depart').datepicker('setDate', newDate, $(this).datepicker('hide'));
			}
	});
	$('#depart').focus(function(){
		//$(this).val('');
			}).datepicker({
			//minDate: interval, 
			//beforeShowDay: $.datepicker.noWeekends, 
			dateFormat: 'd MM, yy',
			minDate: 1, 
			showOn: "both", 
			showAnim: "show", 
			speed: "fast", 
			buttonImage: "images/cal.gif", 
			buttonImageOnly: true, 
			hideIfNoPrevNext: true
	});
	
// --> Start Cycle
	// Add 'scrollVert' functionality for scroll boxe
	(function($) {

		$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
		    $cont.css('overflow','hidden');
		    opts.before.push(function(curr, next, opts, fwd) {
		        $(this).show();
		        var currH = curr.offsetHeight, nextH = next.offsetHeight;
		        opts.cssBefore = fwd ? { top: -nextH } : { top: nextH };
		        opts.animIn.top = 0;
		        opts.animOut.top = fwd ? currH : -currH;
		        $slides.not(curr).css(opts.cssBefore);
		    });
		    opts.cssFirst = { top: 0 };
		    opts.cssAfter = { display: 'none' }
		};

	})(jQuery);
	
	// Init scroll
	$('#scroll-speacial-offers ul').cycle({ 
	    fx: 'scrollVert',
		speed: 850,
		rev: true,
		timeout: 6000,
		next:   '#scroll-speacial-offers ol li.next', 
	    prev:   '#scroll-speacial-offers ol li.previous'
	});

// --> Init Image cycle
	$(".image-holder ul").cycle({ 
		fx:     'fade', 
		speed:  2500, 
		timeout: 5000, 
		sync:1
	});

// --> Init FancyBox
	$("a[rel=gallery]").fancybox({
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'titlePosition' 	: 'over'
	});

// --> Start Menu
	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
	$("ul.topnav li.open").each(function(){
		$(this).hover(function() { //When trigger is clicked...
			//Following events are applied to the subnav itself (moving subnav up and down)
			$(this).find("span").addClass("subhover"); //On hover over, add class "subhover"
			$(this).find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click
			
			// inner sub navigation..
			$(this).parent().find("li.sub-inner").hover(function() {
				$(this).find("ul.subnav-inner").css({"position":"absolute","left":$(this).parent().width()});
				$(this).find("ul.subnav-inner").slideDown('fast').show();
			}, function(){	
				$(this).find("ul.subnav-inner").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
			});
			
		}, function(){	
			$(this).find("span").removeClass("subhover"); //On hover out, remove class "subhover"
			$(this).find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up	
		});
	});

// --> Remove border from last child on side menu
	$("ul.side-menu li:last").css({"border-bottom":"0px none"});
	
	
// --> Start Disable '#' links from being clicked
	$("a[href^='#']").click(function() {
		return false;
	});

// --> Init External Links
	$("a[rel*='external']").attr("target","_blank");
	
// --> Stripping a tags with: class="remove"
	$("a[class*='strip']").each(function(){
		$(this).replaceWith($(this).html()); 
	});
	
// --> Init SPAM Email links
	$("a[href^='mailto:']").each(function(){
		var mail = $(this).attr("href").replace("mailto:","");
		var replaced = mail.replace("/at/","@");
		$(this).attr("href","mailto:"+replaced);
		if($(this).text() == mail){ 
			$(this).text(replaced);
		}
	});

});

/*****************************************************************************
//-> END Window Load
*****************************************************************************/

/*]]>*/
