var fluid = {
Ajax : function(){
	$("#loading").hide();
	var content = $("#ajax-content").hide();
	$("#toggle-ajax").bind("click", function(e) {
        if ( $(this).is(".hidden") ) {
            $("#ajax-content").empty();

            $("#loading").show();
            $("#ajax-content").load("/fluid960gs/data/ajax-response.html", function() {
            	$("#loading").hide();
            	content.slideDown();
            });
        }
        else {
            content.slideUp();
        }
        if ($(this).hasClass('hidden')){
            $(this).removeClass('hidden').addClass('visible');
        }
        else {
            $(this).removeClass('visible').addClass('hidden');
        }
        e.preventDefault();
    });
},
Toggle : function(){
	var default_hide = {"grid": true };
	$.each(
		["grid", "paragraphs", "blockquote", "list-items", "section-menu", "tables", "forms", "login-forms", "search", "articles", "accordion"],
		function() {
			var el = $("#" + (this == 'accordon' ? 'accordion-block' : this) );
			if (default_hide[this]) {
				el.hide();
				$("[id='toggle-"+this+"']").addClass("hidden")
			}
			$("[id='toggle-"+this+"']")
			.bind("click", function(e) {
				if ($(this).hasClass('hidden')){
					$(this).removeClass('hidden').addClass('visible');
					el.slideDown();
				} else {
					$(this).removeClass('visible').addClass('hidden');
					el.slideUp();
				}
				e.preventDefault();
			});
		}
	);
},
Kwicks : function(){
	var animating = false;
    $("#kwick .kwick")
        .bind("mouseenter", function(e) {
            if (animating) return false;
            animating == true;
            $("#kwick .kwick").not(this).animate({ "width": 133 }, 200);
            $(this).animate({ "width": 460 }, 200, function() {
                animating = false;
            });
        });
    $("#kwick").bind("mouseleave", function(e) {
        $(".kwick", this).animate({ "width": 215 }, 200);
    });
},
SectionMenu : function(){
	$("#section-menu")
        .accordion({
            "header": "a.menuitem"
        })
        .bind("accordionchangestart", function(e, data) {
            data.newHeader.next().andSelf().addClass("current");
            data.oldHeader.next().andSelf().removeClass("current");
        })
        .find("a.menuitem:first").addClass("current")
        .next().addClass("current");
},
Accordion: function(){
	$("#accordion").accordion({
        'header': "h3.atStart",
		active: ".openme",
		animated: "slide",
		autoHeight: false
    }).bind("accordionchangestart", function(e, data) {
        data.newHeader.css({
            "font-weight": "bold"
        });

        data.oldHeader.css({
            "font-weight": "normal"
        });
    }).find("h3.atStart:first").css({
        "font-weight": "bold"
    });
},
Cycle: function(){
	$('#headcyc').cycle({
			fx:      'fade',
			speed:    600, 
			timeout:  8000,
			easing: 'easeInOutSine'
		});
},
Cycle2: function(){
	$('#msg_cycle').cycle({
			fx:      'fade',
			speed:    600, 
			timeout:  8000,
			easing: 'easeInOutSine'
		});
},
Cycle3: function(){
	$('#msglarge').cycle({
			fx:      'fade',
			speed:    600, 
			timeout:  8000,
			easing: 'easeInOutSine'
		});
},
ebCycle: function(){
	$('#ebgallery').cycle({
			fx:      'fade',
			speed:    300, 
			timeout:  4000,
			easing: 'easeInOutSine'
		});
}
}
jQuery(function ($) {
	if($("#accordion").length){fluid.Accordion();}
	if($("[id$='ajax']").length){fluid.Ajax();}
	if($("[id^='toggle']").length){fluid.Toggle();}
	if($("#kwick .kwick").length){fluid.Kwicks();}
	if($("#section-menu").length){fluid.SectionMenu();}
	if($("#headcyc").length){fluid.Cycle();}
	if($("#msg_cycle").length){fluid.Cycle2();}
	if($("#msglarge").length){fluid.Cycle3();}
	if($("#ebgallery").length){fluid.ebCycle();}
	
	/*$('#tab').flash(
        { 
          src: '/images/livery/holding/flashinxtab.swf',
          width: 187,
          height: 100,
		  wmode: 'transparent'
        },
        { version: 8 }
    );	
	$('#logo').flash(
        { 
          src: '/images/xcolourchanger.swf',
          width: 470,
          height: 230,
		  wmode: 'transparent'
        },
        { version: 8 }
    );	*/
	
	$('#img_intro').cycle({
			fx:      'scrollHorz',
			speed:    800, 
			timeout:  8000,
			easing: 'easeInOutSine'
		});
	$('#logo a').remove();
	

	$('#headflash').flash(
        { 
          src: '/images/livery/eb/EarlyBirdFinal2.swf',
          width: 940,
          height: 230
        },
        { version: 8 }
    );	
	$('#headflash img').remove();
	
	

});