 function logoAnimation() {
	var so = new SWFObject('http://ten2oneentertainment.com/flash/Top_Logo.swf','mpl','443','149','8');
	so.addParam('allowscriptaccess','always');
	so.addParam('allowfullscreen','true');
	so.addVariable('width','443');
	so.addVariable('height','149');
	so.addParam('wmode', 'transparent');
	so.addVariable('file','http://ten2oneentertainment.com/flash/Top_Logo.swf');
	so.write('logofile');	
}


soundManager.url = '/soundmanager/swf/'; // path to directory containing SM2 SWF
soundManager.debugMode = false;
soundManager.onload = function() {
  // SM2 has loaded - now you can create and play sounds!
  soundManager.createSound('helloWorld','/mp3/swish.mp3');
  soundManager.play('helloWorld');
}

var hoverSound = function () {
	var aSoundObject = soundManager.createSound({
	 id:'mySound2',
	 url:'/mp3/hover2.mp3'
	});
	aSoundObject.play('mySound2');	
}

var flyDownSound = function () {
	var aSoundObject = soundManager.createSound({
	 id:'mySound3',
	 url:'/mp3/click2.mp3'
	});
	aSoundObject.play('mySound3');	
}
 $(function() {
	/*
		$(".next a").click(function() {
		var profileLink = $(this).attr("href");
		
		$("#profileWrap").load('http://ten2oneentertainment.com' + profileLink + ' #profileWrap');
		return false;
		
	});
	*/
	
	$("#main_menu ul:first li a").not(".flydown").hover(function () {
		hoverSound();
		$("a.flydown").removeClass('hoverOn');
	});
	
	$("#nav-one li a.flydown").hover(function () {
		if ($(this).next("ul").css("visibility") == 'hidden') {
			flyDownSound();
		}
		$(this).addClass('hoverOn');
	});
	
	//Add external link icon to external links - 
	$('a').filter(function() {
		//Compare the anchor tag's host name with location's host name
	    return this.hostname && this.hostname !== location.hostname;
	 }).addClass("external");

	
	// -------------------------------------- Superfish Menu -------------------------------------- //
	$('ul#nav-one').superfish({ 
		delay:       100,                             // one second delay on mouseout 
		animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
		speed:       'slow',                          // faster animation speed 
		autoArrows:  false,                           // disable generation of arrow mark-up 
		dropShadows: false	                          // disable drop shadows 
	}); 
	
	// -------------------------------------- Viewable -------------------------------------- //
	function loadFooterAnimation() {
		var so = new SWFObject('http://ten2oneentertainment.com/flash/content_bottom.swf','mpl','1243','100','8');
		so.addParam('allowscriptaccess','always');
		so.addParam('allowfullscreen','true');
		so.addVariable('width','1243');
		so.addVariable('height','100');
		so.addParam('wmode', 'transparent');
		so.addVariable('file','http://ten2oneentertainment.com/flash/content_bottom.swf');
		so.write('content_btm');	
	}

	// show footer animation when element in view
	$('#content_btm').viewable(function(event, percent) {
		var animationLoaded = $(this).hasClass("animation_loaded");
		if (percent > 0.58 && !animationLoaded) {
			loadFooterAnimation();
			$(this).addClass("animation_loaded");
		}
	});

	// -------------------------------------- Shadowbox -------------------------------------- //
	// Overlay for media such as flash videos
	var options = {
        resizeLgImages:     true,
        displayNav:         true,
        handleUnsupported:  'remove',
        keysClose:          ['c', 27], // c or esc
        autoplayMovies:     false,
		overlayColor:		'#000',
		overlayOpacity:		0.8,
		animate:			false
    };

    Shadowbox.init(options);
	
	// -------------------------------------- Carousel -------------------------------------- //
	// Used in profile images
	// Display images in carousel	
	
	$("#mycarousel").jcarousel({
		scroll: 1,
		initCallback: mycarousel_initCallback,
		buttonNextHTML: null,
        buttonPrevHTML: null
	});

	function mycarousel_initCallback(carousel) {
		$('#mycarousel-next').bind('click', function() {
			carousel.next();
			return false;
		});
	
		$('#mycarousel-prev').bind('click', function() {
			carousel.prev();
			return false;
		});
	};

	
	/*$(".jMyCarousel").jMyCarousel({
       mouseWheel: false,		// shall the carousel handle the mousewheel event to animate ?
        auto: false,			// shall the carousel start automatically
        speed: 600,				// speed in ms of the animation.
        easing: 'linear',		// linear animation.
        vertical: false,		// set the carousel in a vertical mode
        circular: false,			// run in circular mode. Means : images never reach the end.
        visible: '100%',			// size of the carousel on the screen. Can be in percent '100%', in pixels '100px', or in images '3' (for 3 images)
        start: 0,				// position in pixels that the carousel shall start at
        scroll: 1,
        step: 60,				// value in pixels, or "default"
        eltByElt: false,		// if activated, the carousel will move image by image, not more, not less.
        evtStart : 'mouseover',	// start event that we want for the animation (click, mouseover, mousedown, etc..)
		evtStop : 'mouseout'	// stop event that we want for the animation (blur, mouseout, mouseup, etc..)
	});*/
	
	// -------------------------------------- Lightbox -------------------------------------- //
	// Used in profile images
	// Display images in overlay
	$('.lightbox').lightBox({
		imageBtnPrev: '/images/left.png',
		imageBtnNext: '/images/right.png',
		fixedNavigation: false
	});
	
	// -------------------------------------- Scroll Pane -------------------------------------- //
	// Customizes default browser scrollbars
	// this initialises the demo scollpanes on the page.
	$('#bio').jScrollPane();
	$('#video_scroll').jScrollPane();

});