/*news menu*/
function init_nMenu() {
$('#news1').click(function(){
		$('#newsInner1').slideToggle(1000);
		});
$('#news2').click(function(){
		$('#newsInner2').slideToggle(1000);
		});	
$('#news3').click(function(){
		$('#newsInner3').slideToggle(1000);
		});	
$('#news4').click(function(){
		$('#newsInner4').slideToggle(1000);
		});	
$('#news5').click(function(){
		$('#newsInner5').slideToggle(1000);
		});	
	};


/* Matt's Accordion */
function init_accordion() {

	// Does element exist?
	if (!$('div.sliders').length) {

		// If not, exit.
		return;
	}

	// Animation speed.
	var speed = 300;

	// Add class for last <li>.
	$('#container div:last').addClass('last');

	// Begin with mouseover.
	$('#container div').hover(function() {

		// Alter target <li>.
		$(this).stop().animate({
			width: '600px'

		// Speed.
		}, speed, 'swing')

		// Alter sibling <li>.
		.siblings('div').stop().animate({
			width: '76px'

		// Speed.
		}, speed, 'swing');
	},

	// End with mouseout.
	function() {

		// Restore target <li>.
		$(this).stop().animate({
			width: '180px'

		// Speed.
		}, speed)

		// Restore sibling <li>.
		.siblings('div').stop().animate({
			width: '180px'

		// Speed.
		}, speed);
	});




}

/*autorun*/
function init_auto() {

$('#container div').hover(function() {
	$('#container div').stop(rotation).animate({width: '180px'}, speed);
},
function(){
	init_accordion();
});

 
  
    var slides = ("#" +"hSlide" );
	var speed = 1000;
	var delay = 2500;
	var x = slides;
    var z =10;
	
	$('#container div:last').addClass('last');
if(z > 1)
{
 function rotation(){ 
 var y =1;
 for (i=0; i < 10; i++){
 $(x+y).animate({width: '600px'}, speed, 'swing').siblings('div').animate({width: '76px'}, speed);
$("#container div").delay(delay).animate({width: '180px'}, speed);
   y++;
   };  
   };
} else {
return;	
};

rotation();
}



/* old video player  */

function init_videoplayer(){
$('div#simpleTruths li').click(function () {
	
var $newDiv = jQuery($(this).text()+("Playback"));

if ($newDiv.is(':hidden')) {
	$("div.switchedOn").stop().fadeOut(50);
	 $newDiv.fadeIn(1000).addClass('switchedOn').removeClass('switchedOff');
	
	}else{
		$newDiv.fadeOut(100).removeClass('switchedOn').addClass('switchedOff');
	}
});
};

/* dropdown menu script */

function init_dropdown() {
	if (!$('ul.dropdown').length) {
		return;
	}
	
	$('ul.dropdown li.dropdown_trigger').hover(function() {
		$(this).find('ul').stop(true,true).fadeIn(500);
	},
	function() {
		$(this).find('ul').fadeOut(250);
	});
}

/* Video Player */

 function init_vplayer(){
$('#controls li').click(function () {                  
				   
				var newDiv = $(this).text().slice(6,[8]);
				var newVideo = "#Playback" + newDiv; 
				
                     $('#movieBox').empty();
					$('<div id="movieWindow"></div>').load('/video_page.html div' ,function() {
						$(this).find(newVideo).hide().appendTo('div#movieBox').fadeIn('normal');
					

	                     });
						
						return false;

			});
			};

/*print player*/
 function init_pplayer(){
$('#controls li').click(function () {                  
				   
			
				
				var newDiv = $(this).text().slice(6,[8]);
				var newPrint = "#Playback" + newDiv; 			
                   
					 $('#movieBox').empty();
					$('<div id="movieWindow" />').load('print_page.html div' ,function() {
						$(this).find(newPrint).hide().appendTo('#movieBox').fadeIn('normal');
					
	                     });
						
						return false;

			});
			};	


/*audio player*/
 function init_mplayer(){
$('#controls li').click(function () {                  
				   
			
				
				var newDiv = $(this).text().slice(6,[8]);
				var newAudio = "#Playback" + newDiv; 			
                   
					 $('#movieBox').empty();
					$('<div id="movieWindow" />').load('audio_page.html',function() {
						$(this).find(newAudio).hide().appendTo('#movieBox').fadeIn('normal');
					
	                     });
						
						return false;

			});
			};	




		
/*playhead*/			
function init_playHead(){
	 


var message = $( "#movieBox" );
var originalMessageTop = message.offset().top;
var view = $( window );

view.bind(
"scroll resize",
function(){

var viewTop = view.scrollTop();

if (
(viewTop > originalMessageTop) &&
!message.is( ".activeMovieFixed" )
){

message.removeClass( "activeMovieAbsolute" ).addClass( "activeMovieFixed" );

} else if (
(viewTop <= originalMessageTop) &&
message.is( ".activeMovieFixed" )
){

message.removeClass( "activeMovieFixed" ).addClass( "activeMovieAbsolute" );
  
}
}
);
  
};

/*Social Tab Animation */

function init_social(){
	
	$('#social').hover(function(){
		$(this).animate({"right": "-100px"}, "slow")}, 
	
	function() {$(this).stop().delay(500).animate({"right": "-352px"}, "slow" )});
	
	
};

/*tool tip*/
function init_toolTip () {


	var offsetX = 100;
	var offsetY = 250;
	var name = $(this).html();
    var description = "#desc" + name;

	$('#controls li').hover(function(e) {
		var name = $(this).html();
    var description = "#desc" + name;
		
		$('<div id="ttbg" />') 
		.css('top', e.pageY - offsetY)
		.css('left', e.pageX - offsetX)
		.appendTo('#b2b').fadeIn(500);
	$('<div id="textbox" />').load('print_page.html' ,function() {
	$(this).find(description).appendTo('#ttbg');
					
	                    });
	
	
	}, function() {
		$('#ttbg').remove();
	});
	
	$("#controls li").mousemove(function(e) {
		$("#ttbg").css('top', e.pageY - offsetY).css('left', e.pageX - offsetX);
	});
	
	

	
	
	
	
	
	
}

/*tool tip 3*/
function init_toolTip3 () {


	var name = $(this).html();
    var description = "#desc" + name;

	$('#controls li').hover(function(e) {

                  

		var name = $(this).text();
		var location = $(this);
    var description = "#desc" + name;
		$('<div id="ttbg" />') 
		.css('bottom', '60px')
		.css('left', '-30px')
		.appendTo(location).fadeIn(500);
	$('<div id="textbox" />').load('print_page.html' ,function() {
	$(this).find(name).appendTo('#ttbg');

	                    });
	
	
	}, function() {
		$('#ttbg').remove();
               
	});
	
}

function init_select () {


	

	$('#controls li').hover(function(e) {
		
		var location = $(this);
    var description = "#desc" + name;
		$('<div id="select" />')
		.css('bottom', '0px')
		.css('left', '0px')
		.appendTo(location);
	
	
	
	}, function() {
		$('#select').remove();
	});
	

	
	

	
	
	
	
	
	
}












