jQuery.noConflict();

jQuery(document).ready(function($) {

function initMenus() {
	$('ul.menu ul').hide();
	$.each($('ul.menu'), function(){
		$('#' + this.id + '.expandfirst ul:first').show();
	});
	$('ul.menu li a').click(
		function() {
			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;

			if($('#' + parent).hasClass('noaccordion')) {
				$(this).next().slideToggle('normal');
				return false;
			}
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				if($('#' + parent).hasClass('collapsible')) {
					$('#' + parent + ' ul:visible').slideUp('normal');
				}
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				$('#' + parent + ' ul:visible').slideUp('normal');
				checkElement.slideDown('normal');
				return false;
			}
		}
	);
}

initMenus();


$("ul.menu li.current_page_parent ul").show();

var initial_video_id = $('#contentinner ul li a:first').attr('class');
jQuery("#youtube-player-container").tubeplayer({
	width: 980, // the width of the player
	height: 550, // the height of the player
	allowFullScreen: "true", // true by default, allow user to go full screen
	initialVideo: initial_video_id, // the video that is loaded into the player
	playerID: "youtube-player", // the ID of the embedded youtube player
	showRelated: false
});

jQuery.tubeplayer.defaults.afterReady = function(){
	jQuery("#youtube-player-container").tubeplayer("cue", initial_video_id);
};

jQuery('#contentinner ul li a').click(function(c) {
			c.preventDefault();
				initial_video_id = $(this).attr('class');
				if (initial_video_id) {
				$('.textbox').css('display','none');
				if ($.browser.msie) {
				jQuery("#youtube-player-container").tubeplayer("play",{id: initial_video_id, autoPlay: 1});
				}
				$("#playerx").css('height',$(window).height()+'px').css('width','100%').css('paddingTop',$(document).scrollTop()+'px');
				$("#youtube-player-container").css('display','inline-block');
			} else {
				$("#youtube-player-container").css('display','none');
				idx = $(this).attr('href');
				$('.textbox').css('display','none');
				$("#playerx").css('height',$(window).height()+'px').css('width','100%').css('paddingTop',$(document).scrollTop()+'px');
				$("#"+idx).css('display','inline-block');
			}
});

$("#close").click(function(c) {
			c.preventDefault();
				if ($.browser.msie) {
			jQuery("#youtube-player-container").tubeplayer("pause");
				}
			$('.textbox').css('display','none');
			$("#playerx").css('height','1px').css('width','1px');
			$("#youtube-player-container").css('display','none');
})

  })(jQuery);



