jQuery(document).ready(function() { 
	
	// DROP DOWN MENU CONTROL
	jQuery("#dropmenu ul").css({display: "none"}); // Opera Fix 
	jQuery("#dropmenu li").hover(function(){ 
		jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).show(268); 
		},function(){ 
		jQuery(this).find('ul:first').css({visibility: "hidden"}); 
		});
	
	// ACCORDION MENU CONTROL
	//jQuery('.accordion-container').hoverAccordion();
	
	jQuery('.accordion .tab').click(function() {
		jQuery(this).next().toggle('slow');
		jQuery(this).toggleClass("active");
		return false;
	}).next().hide();
	
	jQuery('.accordion .open').click();
	
	// DRAWER EFFECT
	// assuming we have the open class set on the H2 when the HTML is delivered
	jQuery('.drawers h2').next().hide();
      
	jQuery('h2.drawer-handle').click(function () {
	  // find the open drawer, remove the class, move to the UL following it and hide it
	  jQuery('.drawer-contents').slideToggle();
	  jQuery(this).toggleClass("active");
	});
	
	jQuery('h2.drawer-handle-private').click(function () {
	  // find the open drawer, remove the class, move to the UL following it and hide it
	  jQuery('.drawer-contents-private').slideToggle();
	  jQuery(this).toggleClass("active");
	});
	
	// Table Zebra Striping
	jQuery(".stripeme tr:odd").addClass("alt");
	jQuery("ol.commentlist li:odd").addClass("alt");
	
	// Jumpmenu
	jQuery(".jumpmenu").change(function() {
	    var val = jQuery(this).selectedValues();
	    if (val != '') {
		location.href=val;
	    }
	});
	
	// Jumpmenu
	jQuery(".sortjumpmenu").change(function() {
	    var val = jQuery(this).selectedValues();
	    if (val != '') {
		location.href=val;
	    }
	});
	
	// calender filters
	jQuery("a#submit-calender-filter").click(function() {
	    var val_category = jQuery("#type-filter").selectedValues();
		var val_destination = jQuery("#destination-filter").selectedValues();
		var val = "?" + val_category + "&" + val_destination ;
		location.href=val;	
	});

	// when the DOM is ready:
	  // find the div.fade elements and hook the hover event
	  jQuery('div.fade').hover(function() {
	    // on hovering over, find the element we want to fade *up*
	    var fade = jQuery('> div', this);
	    
	    // if the element is currently being animated (to a fadeOut)...
	    if (fade.is(':animated')) {
	      // ...take it's current opacity back up to 1
	      fade.stop().fadeTo(250, 1);
	    } else {
	      // fade in quickly
	      fade.fadeIn(250);
	    }
	  }, function () {
	    // on hovering out, fade the element out
	    var fade = jQuery('> div', this);
	    if (fade.is(':animated')) {
	      fade.stop().fadeTo(500, 0);
	    } else {
	      // fade away slowly
	      fade.fadeOut(500);
	    }
	  });

	// Fancy Box Implementation for html content
	//jQuery("a.iframe").fancybox({'width':780, 'height':600});
	
	jQuery("a.iframe").fancybox({
		'width'				: '75%',
		'height'			: '75%',
		'autoScale'     		: false,
		'transitionIn'			: 'none',
		'transitionOut'			: 'none',
		'type'				: 'iframe'


	});

  
}); 
