var STUDIOEA = STUDIOEA || {};

STUDIOEA.global = {
	utils: {
		init: function(){
			// init flyout menu
			jQuery('ul.sf-menu').superfish();
			// disable top level nav links
			jQuery('.topLevel').click(function() {
				return false;
			});
			
			// scroll to
			jQuery('.anchorForTop a').click(function(event){
				// prevent the default action for the click event
				event.preventDefault();

				// get the full url
				var full_url = this.href;

				// split the url by # and get the anchor target name
				var parts = full_url.split("#");
				var trgt = parts[1];

				// get the top offset of the target anchor
				var target_offset = jQuery("#"+trgt).offset();
				var target_top = target_offset.top;
				
				target_top = target_offset.top;
				
				// goto that anchor by setting the body scroll top to anchor top
				jQuery('html, body').animate({scrollTop:target_top}, 500);
			});
		}
		
	}
	
};

jQuery.noConflict();

jQuery(window).load(function(){
	
	STUDIOEA.global.utils.init();
	
});
