
 //typeCode: 学科 来源的区分标记
	function getRefreshTypeList(typeCode)
	{
			if(typeCode == '1')//设定选中的样式
			{
				$("#videoSource").addClass("active");
				$("#videoCourse").removeClass("active");
				$("#sideNav").removeClass("no-display");
				$("#course").addClass("no-display");
			}
			else
			{
				$("#videoSource").removeClass("active");
				$("#videoCourse").addClass("active");
				$("#sideNav").addClass("no-display");
				$("#course").removeClass("no-display");
			}
			return false;
	}

//等待时候的阴影
 var flobu = new flower_bubble ({
	base_obj: '#video_ten',
	background: { css: 'black', opacity: 0.5 },
	bubble: { image: 'bubble.png', width: 130, height: 98 },
	flower: { image: 'flower.gif', width: 32, height: 32 },
	block_mode: 'base_obj'
 }) ;
 
 
// 获取子菜单旋转后DIV的数据
// 参数intPage ：相应的页码ID
// 参数classCode ：相对应的子分类的ClassID
// 参数seriesCode ：相对应seriesCode(专题。讲堂。讲座)
function getSonDivData(intPage, classCode, seriesCode) {
	
	 flobu.enable();
	// 参数intPage ：相应的页码ID 旋转后默认显示第一页数据
	// 参数intDiv ：相对应的DIV所需要加载的子分类的ID
	var classCode = classCode;
	var intPage = intPage;
	//用来保存高亮位置的页码位置
	var n = 1;
	
	//如果是同一页就不用再查询
	var intPagebefor = $("#storePagenum").attr("value");
	if(intPage == intPagebefor && intPage != 1 && intPage != -2 && intPage != -1 && intPage != -3)
	{
	 	flobu.disable();//关闭等待的菊花
	 	return false;
	}
	//把页码保存到hidden
	else
	{
		$("#storePagenum").attr({"value" : intPage}) ;
	}
	
	
	//跳转处填写的页码
	if (intPage == -1 || intPage == -3) {
		
		var totalPage = $("#ttPage").attr("value"); //最大的页码号	
		
		if(intPage == -1)
			intPage = document.getElementById("toPageNum").value;
		else
			intPage = document.getElementById("topPageNum").value;
		
		//判断输入的是否数字 非 就 现在 第1页
		if(isNaN(intPage)){
		intPage = 1;
		}
		else
		{
			//判断输入页码大于最大页码
			if(parseInt(intPage) > parseInt(totalPage))
				intPage = 1;
		}
		//放入当前的页码标记
		$("#storePagenum").attr( {
			"value" :intPage
		});
	}
	
	$.getJSON("JSONvideofilemanage.action?pageNum=" + intPage + "&runTime="
					+ Math.round(Math.random() * 10000), function(data) {
				
				//var htmlhot="";
				var html = ""; //视频数据
				var topPagehtml = ""; //上部的页码
				var bottomPagehtml = ""; //下部的页码
				var ttPage = data.ttPage //总共的页码数
				var htmlType = ""; // 专题 讲堂
				var count = data.count
				
				
				// 下部页码的循环更新
				bottomPagehtml += '<div class="sabrosus">';
				if(ttPage > 0)
				{
					bottomPagehtml += '<a href="#" >共'+ ttPage +'页/'+count+'部</a> ';
					bottomPagehtml += '<a href="#" onclick="getSonDivData(\'1\',\''+classCode+'\',\''+seriesCode+'\');return false;">首&nbsp;页</a> ';
					for (var k = 0; k < data.pageList.length; k++) {
						var pageitem = data.pageList[k];
						//保存需要高亮的A的位置
	                    if(pageitem == intPage)
	                    {
	                      n = k;
	                    }
						bottomPagehtml += '<a href="#" onclick="getSonDivData(\''
								+ pageitem
								+ '\',\''
								+ classCode
								+ '\',\''
								+ seriesCode
								+ '\');return false;" id="buttonPage">'
								+ pageitem
								+ '</a> ';
					}
					bottomPagehtml += '<a href="#" onclick="getSonDivData(\''+ttPage+'\',\''+classCode+'\',\''+seriesCode+'\');return false;">末&nbsp;页</a> ';
					
					bottomPagehtml += '<input type="text" name="toPageNum" maxlength="5" value="" id="toPageNum" style="width:20px;height:12px;margin-top:4px;"/> ';
					
	               	bottomPagehtml += '<a href="#" onclick="getSonDivData(\'-1\',\''+classCode+'\',\''+seriesCode+'\');return false;">GO</a>';
                }
				bottomPagehtml += '</div>';
				
				$("#bottomPage").html(bottomPagehtml);
				
				
				
				// 下部页码的循环更新
				topPagehtml += '<div class="sabrosus">';
				if(ttPage > 0)
				{
					topPagehtml += '<a href="#" >共'+ ttPage +'页/'+count+'部</a> ';
					topPagehtml += '<a href="#" onclick="getSonDivData(\'1\',\''+classCode+'\',\''+seriesCode+'\');return false;">首&nbsp;页</a> ';
					for (var k = 0; k < data.pageList.length; k++) {
						var pageitem = data.pageList[k];
						topPagehtml += '<a href="#" onclick="getSonDivData(\''
								+ pageitem
								+ '\',\''
								+ classCode
								+ '\',\''
								+ seriesCode
								+ '\');return false;" id="buttonPage">'
								+ pageitem
								+ '</a> ';
					}
					topPagehtml += '<a href="#" onclick="getSonDivData(\''+ttPage+'\',\''+classCode+'\',\''+seriesCode+'\');return false;">末&nbsp;页</a> ';
					
					topPagehtml += '<input type="text" name="topPageNum" maxlength="5" value="" id="topPageNum" style="width:20px;height:12px;margin-top:4px;"/> ';
					
	               	topPagehtml += '<a href="#" onclick="getSonDivData(\'-3\',\''+classCode+'\',\''+seriesCode+'\');return false;">GO</a>';
                }
				topPagehtml += '</div>';
				$("#topPage").html(topPagehtml);
				
				

				// 清空上一页的数据
				// $("#ul1").empty();
				var listSize = $(".main_video[id^='list']").size() + 1;
				html += '<div class="main_video clear-block" id="list' + listSize+ '">';
				// 新一页的数据加载
				html += '<ul id="ul_video">';
				   for (var i = 0; i < data.listSonArray.length; i++) {
					var item = data.listSonArray[i];
					// 视频数据
					html += '<li class="clear-block">';
					html += '<div class="video_img pic">';
							//课件的视频
						if (item.seriesCode == 'XL04')
						{		
							if (item.coursewareType == '0') {// 同济课件
								html += '<a rel="#coursewareLayerNew" href="newCourseware.jsp?id='
										+ item.sid
										+ '"  target="_blank"  id="'
										+ item.sid
										+ '"><img class="thumbnail" src="images/videoImages/'
										+ item.sid
										+ '.jpg" width="111px" height="86px" onerror="this.src=\'images/img1.jpg\'"/></a>';
							}
							if (item.coursewareType == '1') {// 圣才课件
								html += '<a  href="lessons.action?SID=' + item.sid + '" target="blank"><img class="thumbnail" src="images/videoImages/'
										+ item.sid
										+ '.jpg" width="111px" height="86px" onerror="this.src=\'images/img1.jpg\'"/></a>';
							}
						}
						else//除课件以外的视频
						{
							
							html += '<a rel="#singleClipLayerNew" href="newPlay.action?sid='
								+ item.sid
								+ '&classCode_lm='
								+ item.classCode_lm 
								+ '" id="'
								+ item.sid
								+ '"  target="_blank"><img class="thumbnail" src="images/videoImages/'
								+ item.sid
								+ '.jpg" width="111px" height="86px" onerror="this.src=\'images/img1.jpg\'"/></a>';
								
						}	
					
					html += '<img class="addQlist addQlistvideo" src="images/pixel.gif" onclick="favInsert(\'' + item.sid + '\')" style="display: none;"/></div>';
					html += '<div class="video_introduce">';
					html += '<div class="title clear-block">';
					html += '<h3>' + item.title + '</h3>';
					html += '<div class="time">' + item.dateTimeSize + '</div>';
					html += '</div>';
					html += '<div class="description" title="'+ item.outline + '">　　'　　+ item.shortoutline + '</div>';
					html += '<div class="name">';
					html += '<p><B>关键词</B>：';
					if(item.listKeys!= null && item.listKeys !="")
					
					{
						for (var j = 0; j < item.listKeys.length; j++) {
							html += '<a class="linkcss" href="search.action?searchFlag=kws&keywords='+ item.listKeys[j] +'">'+ item.listKeys[j]+'</a>&nbsp;&nbsp;';
						}
					}
					
					html += '</p>';
					html += '</div>';	
					html += '<div class="c"><p>' + item.speaker + '</p></div>';
					html += '</div>';
					html += '</li>';
				}
					
				html += '</ul>';
				html += '</div>';
				
				/*
				//三级视频标题的获取
				var htmlTitle = "";
				if(data.thiTitleArray != null)
				{
					if(data.thiTitleArray.length > 0)
					{
						for (var k = 0; k < data.thiTitleArray.length; k++) {
							
							var item = data.thiTitleArray[k];
							htmlTitle += '<li>';
							htmlTitle += '<a href="#" onclick="getSonDivData(\'-2\',\''+ item.classCode +'\',\'\');return false;"><span>'+ item.className +'</span></a>';
							htmlTitle += '</li>';
							htmlTitle += '<li>|</li>';
						}
					}
				}
				$("#thiTitle ul").html(htmlTitle);
				
				
				if(data.classCode.length != 7)
				{
					$("#sort02").hide();
					$("#sort02").css("overflow","visible");
					$("#sort02").css("height","");
					$("#sort02").css("width","");				
					$("#sort02").data('orgHeight', $("#sort02").height()); //保存新菜单div的高度
				}
				*/
				
				// 热点视频
				//for (var k = 0; k < data.hotTenListArray.length; k++) {
				//	var item = data.hotTenListArray[k];
				//	htmlhot += '<li class="normal clearfix">';
				//	htmlhot += '<div class="shorttitle">'+ item.shorttitle +'</div>';
				//	htmlhot += '<div class="fullinfo">';
				//	htmlhot += '<div class="pic">';
				//	htmlhot += '<a rel="#singleClipLayer" href="'+ item.sid +'.flv" id="'+item.sid+'"><img class="thumbnail" src="images/videoImages/'+item.sid+'.jpg" onerror="this.src=\'images/img1.jpg\'"/></a>';
				//	htmlhot += '<img class="addQlist" src="images/adding.jpg" onclick="javascript:{document.form1.videoCode.value ='+ item.sid +';document.form1.submit();return false;}" /></div>';
				//	htmlhot += '<div class="videoInfo">' + item.shorttitle;
				//	htmlhot += '<br/><br/>时   长:' + item.dateTimeSize;
				//	htmlhot += '<br/><br/>播放次数:' + item.accessCount;
				//	htmlhot += '</div></div></li>';
				//	}
				//$('#hotTen').html(htmlhot);
				////////////////////////////////

				// $('#ul1').append(html);

				// var listSize = $(".video_list").size()+1;
				// html.attr("id","list"+listSize);
				// alert(listSize);
				// alert(html);
				
				//专题 讲堂 讲座的数据更新
				//$("#dissertation").attr({
				//	'onclick': 'getStatus(1,' + classCode + ')'
				//	});

				

				/*
				//中间部分的二级title
				if(data.classCode.length == 3) {
					
					// 各菜单的显示控制
					$("#gt3Name").html("");
					$("#gt2Name").html("");
					$("#thiNull a").html("");
					$("#secNull a").html("");
				}
				
				else if(data.classCode.length == 5) {
				
					
					$("#gt3Name").html("");
					$("#gt2Name").html("");
					$("#thiNull a").html("");
					
					$("#secNull a").html("&gt;" + "  " + data.secClassName);
					//更改二级菜单处的classCode
				}
				else if(data.classCode.length == 7)
				{
					$("#gt3Name").html("");
					$("#thiNull a").html("&gt;" + "  " + data.thiClassName);
				}
				else 
				{
					$("#gt2Name").html("");
					$("#gt3Name").html("");
				}
				
				
				//initMenu();
				
				//操作过程中再次选中 全部
				if(seriesCode.length == 0)
				{
					//更换专 题讲 堂处 的classCode
					htmlType += '<h2 class="filter" id="allrecord"  onclick="getStatus(\'4\',\''+classCode+'\')"> <span></span >全部</h2>';
					htmlType += '<h2 class="filter filter_off" id="dissertation"  onclick="getStatus(\'1\',\''+classCode+'\')"> <span></span >专题</h2>';
					htmlType += '<h2 class="filter filter_off" id="seminar"  onclick="getStatus(\'2\',\''+classCode+'\')"> <span></span >讲堂</h2>';
					htmlType += '<h2 class="filter filter_off" id="colloquia" onclick="getStatus(\'3\',\''+classCode+'\')"> <span></span >座谈</h2>';
					$("#topType").html(htmlType);	
				}
				
				
				//右边的title 一级
				if (data.classCode.length  == 3) {
					//$("#rightTitle").html("<span></span>" + data.firClassName);
				}
				//右边的title 二级
				else if(data.classCode.length  == 5)
				{
					//$("#rightTitle").html("<span></span>" + data.secClassName);
				}
				//右边的title 三级
				else 
				{
					//$("#rightTitle").html("<span></span>" + data.thiClassName);
				}
				//右边的视频数和总时间
				//$("#ttvideoCount").html("收录节目:" +  data.headInfoVideoCount + "部");
				//$("#ttvideoTime").html("总 时 长:" + data.headInfoVideoTimes + "分钟");
				*/
				
				// alert(html);
				// $("#list1").after(html);
				//$(".main_video[id^='list']:last").after(html);
				
				//$(".panelContainer").width($(".panelContainer").width() + 706);
				//$(".panelContainer").animate({
				//			left : "-=706"
				//		}, 1000, "easeInOutExpo");
				//$(".main_video:eq(0)").empty();
				
				$("#video_ten").html(html);
				
				$(".main_video[id^='list']:last").updateVideoLink();
				$(".main_video[id^='list']:last").iniAddFaorite();
				$(".main_video[id^='list']:last").hightLightLi();
				
				
				if(data.highText != null && data.highText != "")
				{
					$('.panelContainer').removeHighlight();
					$.highlight($('.panelContainer').get(0), data.highText);
				}
				
				
				//当前页码高亮
				if(intPage == -2) //二级分类 三级分类点击时选中第一页
                {
                  n = 0;
                }
				var m=n+2;
				
				$("#bottomPage").find("a:eq("+m+")").addClass("current");
				$("#topPage").find("a:eq("+m+")").addClass("current");
				
				
				if($("#hidUserMail").attr("value") == null || $("#hidUserMail").attr("value") == '')
				{
					new PopupLayer({trigger:".addQlist",popupBlk:"#blk8",closeBtn:"#close8",useOverlay:true,useFx:true,
					offsets:{
						x:500,
						y:165
					}
					});
				}
				
				flobu.disable();
				return false;
			})

}


/*
var tI = null;
var tO = null;

// 初始化菜单

var initMenu = function() {

	var containers = $(".float_menubj"); // 找到所有子菜单div
	// 子菜单容器初始参数设定
	containers.each(function() {

				// 保存子菜单容器原始位置
				$(this).css('left', $(this).position().left);
				$(this).data('orgPos', $(this).position());
				$(this).data('orgHeight', $(this).height());
				$(this).data('orgWidth', $(this).width());

				// 隐藏除第一个子菜单容器以外其他容器
				if (containers.index($(this)) != 0) {
					$(this).hide();
					$(this).data('display', false); // 设置子菜单显示状态
				} else {
					$(this).data('display', true); // 设置子菜单显示状态
				};
			})
			
	var handle = $(".websitewz a[href^='#sort']"); // 找到所有包含子菜单的菜单项
	// var handle = $("#sonType a"); //找到所有包含子菜单的菜单项


	// 设置菜单项悬停事件
	handle.hover(function() {
				clearTimeout(tO);
				var thisHandle = $(this);
				tI = setTimeout(function() {
							showSubMenu(thisHandle, 1000);
						}, 200);
			}, function() {
				clearTimeout(tI);
				var thisHandle = $(this);
				tO = setTimeout(function() {
							hideSubMenu(thisHandle, 1000);
						}, 200);
			});

	handle.click(function() {
				return false; // 取消点击操作
			})

	// 设置子菜单容器悬停事件
	containers.hover(function() {// 鼠标在子菜单容器上时，设置鼠标状态为true
				$(this).data('mouseIsOver', true);
				clearTimeout(tO);
			}, function() {// 鼠标在离开子菜单容器上时
				clearTimeout(tI);
				$(this).data('mouseIsOver', false); // 设置鼠标状态为false

				var thisHandle = $(".websitewz a[href='#" + $(this).attr("id")
						+ "']"); // 找到相应的菜单项
				tO = setTimeout(function() {
							hideSubMenu(thisHandle, 1000);
						}, 200); // 延时隐藏该菜单项对应的子菜单容器
			});


}

// 隐藏菜单项对应子菜单容器动作
// handle ：菜单项对象
// speed：动画速度，默认为1000毫秒
var hideSubMenu = function(handle, speed) {

	// 动画速度
	speed = speed ? speed : 1000;

	// 查找菜单项相应子菜单容器
	var container = $(".float_menubj[id="
			+ handle.attr('href').replace('#', '') + "]");
	// var container = $("#sort01");

	// 如果鼠标在此容器上，不做任何动作 返回
	if (container.data('mouseIsOver') || !container.data('display'))
		return;

	// alert(container.size());

	// 取得容器收缩结束时位置和宽度
	var handlePosition = handle.position(); // 位置为菜单项所在位置
	// alert(handlePosition);
	var handleWidth = handle.width(); // 宽度为菜单项宽度

	container.css('overflow', 'hidden'); // 溢出容器内容自动隐藏

	// 收缩动画
	container.animate({
				left : handlePosition.left
			}, {
				queue : false,
				duration : speed
			}).animate({
				width : 0
			}, {
				queue : false,
				duration : speed
			}).animate({
				height : 0
			}, {
				queue : false,
				duration : speed
			});

	// container.slideUp(speed);
	container.data('display', false); // 设置容器显示状态
};

// 显示菜单项对应子菜单容器动作
// handle ：菜单项对象
// speed：动画速度，默认为1000毫秒
var showSubMenu = function(handle, speed) {

	speed = speed ? speed : 1000;

	var containers = $(".float_menubj");

	// 查找菜单项相应子菜单容器
	var container = $(".float_menubj[id="
			+ handle.attr('href').replace('#', '') + "]");
			
	if ($("li",	container).size()==0) return false;
	
	containers.not(container).each(function() {
				$(this).hide();
				$(this).data('display', false);
			});
	// var container = $("#sort01");

	// 如果容器已打开 ，没有任何动作，返回
	if (container.data('display'))
		return;

	// 取得容器放大开始时位置和宽度
	var handlePosition = handle.position();
	var handleWidth = handle.width();

	// 设置动画开始时容器css属性
	container.css('left', handlePosition.left); // 左位置
	container.css('overflow', 'hidden'); // 溢出容器部分隐藏
	//container.height(0); // 高度初始为0
	container.width(handleWidth); // 宽度为菜单项宽度

	// container.slideDown(speed);
	// 放大容器的动画执行
	container.animate({
				left : container.data('orgPos').left
			}, {
				queue : false,
				duration : speed
			}).animate({
				width : container.data('orgWidth')
			}, {
				queue : false,
				duration : speed
			}).animate({
				height : container.data('orgHeight')
			}, {
				queue : false,
				duration : speed
			});
	// container.css('overflow','visible');
	container.data('display', true);

};


*/



// 控制状态
function getStatus(id,classCode) {

	var status = "";
	// 专题
	//if (id == 1) {
		//$("#dissertation").toggleClass("filter_off");
	//}
	//// 讲堂
	//else if (id == 2) {
	//	$("#seminar").toggleClass("filter_off");
	//}
	// 座谈
	//else if (id == 3) {
	//	$("#colloquia").toggleClass("filter_off");
	//}
	
	//专题
	if(id == 1)
	{
		//$("#dissertation").toggleClass("filter_off");
		//移除灰色
		$("#dissertation").removeClass("filter_off");
		//状态变灰色
		$("#seminar").addClass("filter_off");
		$("#colloquia").addClass("filter_off");
		$("#allrecord").addClass("filter_off");
		status = "XL01";
	}
	//讲堂
    else if(id == 2)
    {
    	//$("#seminar").toggleClass("filter_off");
    	//移除灰色
    	$("#seminar").removeClass("filter_off");
    	//状态变灰色
    	$("#dissertation").addClass("filter_off");
    	$("#colloquia").addClass("filter_off");
    	$("#allrecord").addClass("filter_off");
    	status = "XL02";
    } 
	 //座谈
	 else if(id == 3)
    {
    	//$("#colloquia").toggleClass("filter_off");
    	//移除灰色  
    	$("#colloquia").removeClass("filter_off");
    	//状态变灰色
    	$("#dissertation").addClass("filter_off"); 
    	$("#seminar").addClass("filter_off");
    	$("#allrecord").addClass("filter_off");
    	status = "XL03"; 	
    } 
	 //座谈
	 else if(id == 4)
    {
    	//$("#colloquia").toggleClass("filter_off");
    	//移除灰色  
		 $("#allrecord").removeClass("filter_off");
    	//状态变灰色
		$("#colloquia").addClass("filter_off");
    	$("#dissertation").addClass("filter_off"); 
    	$("#seminar").addClass("filter_off");
    	status = ""; 	
    } 

	/*
	var statusNot = $(".filter_off").text();
	if (statusNot.length == 2) {
		if (statusNot == "专题") {
			status = "|XL01|";
		} else if (statusNot == "讲堂") {
			status = "|XL02|";
		} else {
			status = "|XL03|";
		}
	} else if (statusNot.length == 4) {
		var a = statusNot.substring(0, 2);
		var b = statusNot.substring(2, 4);
		if (a == "专题") {
			a = "|XL01|";
		} else if (a == "讲堂") {
			a = "|XL02|";
		} else {
			a = "|XL03|";
		}

		if (b == "专题") {
			b = "|XL01|";
		} else if (b == "讲堂") {
			b = "|XL02|";
		} else {
			b = "|XL03|";
		}
		status = a + "," + b;
	} else if (statusNot.length == 6) {
		status = "|XL01|" + "," + "|XL02|" + "," + "|XL03|";
	}
	*/

	getSonDivData('1', classCode, status);
	return false;
}

$(document).ready(function() {
			//$(".main_video").updateVideoLink();
			//$(".main_video").iniAddFaorite();
			//加号显现的绑定
			//$("#video_ten").iniAddFaorite();

	//initMenu();
	
	//var handle = $(".websitewz a[href^='#sort']").eq(0);
	//tO = setTimeout(function() {
	//			hideSubMenu(handle, 1000);
	//		}, 2000);

});

