var yt_videos = [];
var yt_current = 0;

function youtubeNext(){
	$('.button-on').removeClass('button-on').addClass('button');
	if (yt_current+1 > yt_videos.length-1){
		yt_current = 0;
	} else {
		yt_current++;
	}
	
	$('#video'+(yt_current+1)).removeClass('button').addClass('button-on');
	$('#video_content').tubeplayer('play',yt_videos[yt_current]);
}

function youtubeChange(pos){
	$('.button-on').removeClass('button-on').addClass('button');
	
	$('#video'+(pos+1)).removeClass('button').addClass('button-on');
	$('#video_content').tubeplayer('play',yt_videos[pos]);
	yt_current = pos;
}

function youtubeStateChange(){
	
}

function initYoutubePlayer(videos){
	yt_videos = videos;

	$('#video_content').tubeplayer({
		width: 435, // the width of the player
		height: 255, // the height of the player
		allowFullScreen: "true", // true by default, allow user to go full screen
		initialVideo: yt_videos[0], // the video that is loaded into the player
		preferredQuality: "default",
		showinfo: true,
		//swfobjectURL: "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",
		loadSWFObject: false, // if you include swfobject, set to false

		iframed: true
	});
	

	
}
