

jQuery(document).ready(function() {
	
	// Load only scripts that are needed
	
	Modernizr.load(
	{
		test: Modernizr.canvas,
		yep : ['http://www.gstatic.com/swiffy/v3.5/runtime.js', '/assets/js/mylibs/header.js'],
		nope: 'http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js',
		complete : function () {
			
			// Load flash header if canvas is not present
			
			if (!Modernizr.canvas) {
				
				var flashvars = {};
				var params = {};
				var attributes = {};
				params.wmode = "transparent";
				swfobject.embedSWF("assets/img/top-banner.swf", "top-banner", "623", "138", "8.0.0", false, flashvars, params, attributes);
				
			}
			// Load canvas header
			
			if (Modernizr.canvas) {
				
				var stage = new swiffy.Stage(document.getElementById("top-banner"), swiffyobject);
				stage.start();
				
			}
			
			if (!Modernizr.input.placeholder) {
				
				jQuery("#sidebar p").css('position', 'relative'); 
				jQuery("#sidebar label").addClass("inlineLabel").inFieldLabels();	
			}
		}
	}
	
	);
		
	// Add validation to captcha ---------------------------------------------------------------------	
	
	jQuery("#CaptchaV2").addClass("validate[required]");
	
	// Homepage slider ---------------------------------------------------------------------	
	
	jQuery('.flexslider').flexslider({
		animation: "slide",
		controlsContainer: ".flex-container"
	});
	
	// Internal Slider ---------------------------------------------------------------------	
	
	jQuery('.internal .slides').cycle({ 
		fx:     'scrollHorz', 
		prev:    '.previous',
        next:    '.next',
		pager:   '#menu', 
		pagerAnchorBuilder: function(idx, slide) { 
			// return selector string for existing anchor 
			return '#menu li:eq(' + idx + ') a'; 
		}
	}).cycle('pause');
	
	//   -------------------------------------------------------------------------------------------------
	
	jQuery('#direct').click(function() { 
		jQuery('#nav li:eq(2) a').trigger('click'); 
		return false; 
	});
		
	// Toogle internal banner menu  ---------------------------------------------------------------------	

	jQuery('a#expand').click(function() {
		jQuery('#menu, .square').slideToggle();
		return false;
	});

	
	// Facebook and Twitter hover animation ----------------------------------------------------------
	
	var navDuration = 150; 
	var navJumpHeight = "5px";
	
	jQuery('.facebook, .twitter').hover(function() {
		jQuery(this).animate({ top : "-="+navJumpHeight }, navDuration);            
	}, function() {
		jQuery(this).animate({ top : "0" }, navDuration);
	});
	
	// Colorbox  ------------------------------------------------------------------------------
	
	jQuery(".iframe").colorbox({
		iframe:		true, 
		width:		"80%", 
		height:		"80%"
		
	});
	
	jQuery(".colossusVideo").colorbox({
		iframe:		true, 
		width:		"860", 
		height:		"578"
		
	});
	
	jQuery('.ajax').colorbox({
		opacity:	0.70,
		escKey: 	false // Oh no usability..
	}, function() {
	     jQuery('.ajaxForm').validationEngine({
			  scroll: false
		 });
		 jQuery('#cboxOverlay, #cboxClose').click(function() {	
			jQuery('.ajaxForm').validationEngine('hide');
		});
	});
	
	jQuery(".ajaxForm, #newsletter").validationEngine({
		scroll: false
	});
	
	/* Google Analytics */
	window._gaq = [['_setAccount','UA-8833614-48'],['_trackPageview'],['_trackPageLoadTime']];
	Modernizr.load({
	  load: ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js'
	});
	
	/* Quantcast */
	var _qevents = _qevents || [];
	(function() {
	var elem = document.createElement('script');
	elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js";
	elem.async = true;
	elem.type = "text/javascript";
	var scpt = document.getElementsByTagName('script')[0];
	scpt.parentNode.insertBefore(elem, scpt);
	})();
	
	_qevents.push({
	qacct:"p-0bKhFZzftLwA6"
	});

});













