function ShowPic(pics,links,texts,intheight,intwidth)
{
	linkarr = new Array();
	picarr = new Array();
	textarr = new Array();
	var focus_width = intwidth;
	var focus_height = intheight;
	var text_height = 7;
	//var pics='IMAGES/ITZT-F1.jpg|IMAGES/ITZT-F2.jpg|IMAGES/ITZT-F3.jpg';
	//var links='http://school.studyget.com/259/ClassList_1482.shtml|http://school.studyget.com/817/ClassList_1482.shtml|http://school.studyget.com/457/ClassList_491.shtml';
	//var texts='文华——国际视觉设计工程师就业班|咨路——国际软件测试工程师就业班|复雅——平面广告设计师资格认证班';
	var swf_height = focus_height + text_height;
	var defJpeg = "IMAGES/ITZT-F1.GIF";
	
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
	document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="http://class.studyget.com/images/slide.swf">');
	document.write('<param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
	document.write('<embed src="http://class.studyget.com/images/slide.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}	

var PingTimer; 
var MapTimer;

function ShowPing(e)
{
	if (PingTimer) { window.clearInterval(PingTimer); }
	var Ping = $("div_ping");
	var Jiao = $("div_p_j");
	if (Ping.style.display = "none")
	{
		e = e ? e : window.event;
		mX = e.pageX || e.clientX + document.documentElement.scrollLeft;
		mY = e.pageY || e.clientY + document.documentElement.scrollTop;
		Ping.style.left 	= ( mX - 400 ) + "px";
		var beg = mY - document.documentElement.scrollTop;
		if (beg < 220) { Ping.style.top 	= ( mY - 50) + "px"; Jiao.className = "p_j_up"; }
		else {Ping.style.top 	= ( mY - 220 ) + "px";  Jiao.className = "p_j_down";}
		Ping.style.display = "";
		Ping.onmouseover = function () { window.clearInterval(PingTimer); };
		Ping.onmouseout = function () { ClearPing(); };
	}
	else {ShowPing(e);}	
}

function ClearPing()
{
	if (PingTimer){  window.clearInterval(PingTimer);  }
	PingTimer = setInterval("ClearShowPing()",1000);  	
}
	
function ClearShowPing()
{
	var Ping = $("div_ping");
	clearTimeout(PingTimer);
	if (Ping.style.display == "") { Ping.style.display = "none"; $("P_Content").value = ""; $("div_p_e").style.display = "none";}
}	

function submintComment()
{
	var strUrl,P_UserName,P_Pass;
	if ($("P_UserName")) {P_UserName = $("P_UserName").value;} else {P_UserName = $("User_Name").value;}
	if ($("P_Pass")) {P_Pass = $("P_Pass").value;}
	strUrl =  "CourseID=" + $("P_CourseID").value + "&Class_ID=" + $("P_ClassID").value + "&UserName=" + escape(P_UserName) + "&Pass=" + escape(P_Pass) + "&Content=" + escape($("P_Content").value) + "&User_ID=" + $("User_ID").value;
	var opt={
	    	method: "post",		
	    	postBody: strUrl,
	    	onSuccess: function(t)
	    	{
				var txt = t.responseText;
				Commentdisplayback(txt);
	    	},
	    	on404: function(t)
	    	{ alert('Error 404: 页面未找到'); },
	    	onFailure: function(t) 
	    	{ alert('Error ' + t.status + ' -- ' + t.statusText); }
	    	,onException:function(obj,e){alert(e.message);} 
	
	};
	new Ajax.Request('http://class.studyget.com/Ajax/submitComment.asp?TS=' + (new Date().getTime()),opt);	
}

function Commentdisplayback(t)
{
	if ( t.indexOf("OK:") != -1 )
	{
			var strContent,strT,arrT;
			strT = t.replace("OK:","");
			arrT = strT.split("###");
			$("User_ID").value = arrT[0];
			$("User_Ponit").value = arrT[1];
			$("User_Name").value = arrT[5];
			$("User_Ponit").value = arrT[4];
			strContent = arrT[2];
			var re = /Content\[(.*)\]/; 
			var r = re.exec(strContent); 
			$("comment").innerHTML = "";
			$("comment").innerHTML = r[1];
			$("comcou").innerText = "共有（" + arrT[3] + "）条评论";
			if (arrT[0] != 0)
			{
				if (!$("UserShow"))
				{
					var strTmp = "<div id=\"UserShow\">";
					strTmp += "<div id=\"User_Info\">" + arrT[5] + "<br/>学网币：<span id=\"User_Ponit\">" + arrT[1] + "<img src=\"http://class.studyget.com/images/wd-money.gif\"></span></div>";
					strTmp += "<div class=\"f_right\"><img src=\"" + arrT[4] + "\" id=\"UserFace\" width=\"55\" height=\"55\"></div></div>";
					$("Repl").innerHTML = "";
					$("Repl").innerHTML = strTmp;
				}	
				
			}
			ClearShowPing();
	
	}	
	else 
	{
		$("div_p_e").innerText = "";
		$("div_p_e").innerText = t;
		$("div_p_e").style.display = "";
	}
}

var CommentStar ={
	StarCount:0
}
CommentStar.OverStar=function(StarId){
	for(var i=0;i<this.StarCount;i++){
		if(i<=parseInt(StarId)){
			this.StarImg[i].src=this.OverStarImg.src;
		}
		else{
			this.StarImg[i].src=this.OutStarImg.src;
		}
	}
}

CommentStar.ScoreStar=function(StarId){
	for(var i=0;i<this.StarCount;i++){
		if(i<=parseInt(StarId)){
			this.StarImg[i].src=this.ClickStarImg.src;
		}
		else{
			this.StarImg[i].src=this.OutStarImg.src;
		}
	}
}

CommentStar.OutStar=function(){
	for(var i=0;i<CommentStar.StarCount;i++){
		this.StarImg[i].src=this.OutStarImg.src;
	}
}

CommentStar.ClickStar=function(StarId){
	var opt={
		method:"post",
		postBody:"CS_ID="+CommentStar.CS_ID+"&StarID="+StarId + "&Class_ID=" + CommentStar.Class_ID,
		onSuccess:function(t){
			var Info=t.responseText.split("|");
			CommentStar.ScoreStar(parseInt(Info[0])-1);
			CommentStar.CS_Score=parseInt(Info[1]);
			CommentStar.CS_CountP=parseInt(Info[2]);
			CommentStar.ShowInfo(2);
			var Avg;
			if(CommentStar.CS_CountP>0){Avg=Math.round(CommentStar.CS_Score/CommentStar.CS_CountP);}
			else{Avg=0;}
			for(var i=1;i<6;i++){
				if(i<=Avg){
					$("Scoreimg_"+i).src=CommentStar.ClickStarImg.src;
				}
				else{
					$("Scoreimg_"+i).src=CommentStar.OutStarImg.src;
				}
			}
		},
		onFailure: function(t) {
			CommentStar.ListenEvent();
       	 	CommentStar.ShowInfo(3);
		}
	}
	this.StopEvent();
	this.ShowInfo(1);
	new Ajax.Request(CommentStar.URL+"Ajax/submitScore.asp?"+new Date().getTime(),opt);
}

CommentStar.StopEvent=function(){
	for(var i=0;i<this.StarImg.length;i++){
		this.StarImg[i].onmouseout=function(){};
		this.StarImg[i].onmouseover=function(){};
		this.StarImg[i].onclick=function(){};
	}
}

CommentStar.ListenEvent=function(){
	for(var i=0;i<this.StarImg.length;i++){
		this.StarImg[i].onmouseout=function(){
			CommentStar.OutStar();
		};
		this.StarImg[i].onmouseover=function(){
			var StarId=this.id.split("_")[1];
			CommentStar.OverStar(StarId);
		};
		this.StarImg[i].onclick=function(){
			var StarId=this.id.split("_")[1];
			CommentStar.ClickStar(StarId);
		};
	}
}
CommentStar.ShowInfo=function(flag){
	var Avg;
	if(CommentStar.CS_CountP>0){Avg=Math.round(CommentStar.CS_Score/CommentStar.CS_CountP);}
	else{Avg=0;}
	switch(flag){
		case 0:
			$(this.ScoreNum).innerHTML="分值："+Avg*2;
			$(this.ScoreP).innerHTML=this.CS_CountP+"人参与评分";
			$(this.ScoreInfo).innerHTML="请点击星星给课程评分";
			break;
		case 1:
			$(this.ScoreInfo).innerHTML="正在提交您的评分...";
			break;
		case 2:
			$(this.ScoreNum).innerHTML="分值："+Math.round(this.CS_Score/this.CS_CountP)*2;
			$(this.ScoreP).innerHTML=this.CS_CountP+"人参与评分";
			$(this.ScoreInfo).innerHTML="感谢您参与评分！";
			break;
		case 3:
			$(this.ScoreInfo).innerHTML="提交错误，请重新提交";
			break;
	}
}
CommentStar.Init=function(StarCount,CS_ID,CS_Score,CS_CountP,OverStarSrc,OutStarSrc,ClickStarSrc,DisplayDiv,ScoreNum,ScoreP,ScoreInfo,URL,Class_ID){
	this.StarCount=StarCount;
	this.CS_ID=CS_ID;
	this.CS_Score=CS_Score;
	this.CS_CountP=CS_CountP;
	this.OverStarImg=new Image();
	this.OverStarImg.src=OverStarSrc;
	this.OutStarImg=new Image();
	this.OutStarImg.src=OutStarSrc;
	this.ClickStarImg=new Image();
	this.ClickStarImg.src=ClickStarSrc;
	this.DisplayDiv=DisplayDiv;
	this.ScoreNum=ScoreNum;
	this.ScoreP=ScoreP;
	this.ScoreInfo=ScoreInfo;
	this.URL=URL;
	this.Class_ID = Class_ID;
	this.StarImg=new Array();
	for(var i=0;i<this.StarCount;i++){
		this.StarImg[i]=new Image();
		this.StarImg[i].src=this.OutStarImg.src;
		this.StarImg[i].id="Star_"+i;
		$(this.DisplayDiv).appendChild(this.StarImg[i]);
	}
	this.ListenEvent();
	this.ShowInfo(0);
}


function ShowMap(e)
{
	if (MapTimer) { window.clearInterval(MapTimer); }
	var Map = $("ShowMap");
	if (Map.style.display = "none")
	{
		e = e ? e : window.event;
		mX = e.pageX || e.clientX + document.documentElement.scrollLeft;
		mY = e.pageY || e.clientY + document.documentElement.scrollTop;
		Map.style.left 	= ( mX - 180 ) + "px";
		Map.style.top 	= ( mY + 10) + "px";
		Map.style.display = "";
		Map.onmouseover = function () { window.clearInterval(MapTimer); };
		Map.onmouseout = function () { ClearMap(); };
	}
	else {ShowMap(e);}	
}

function ClearMap()
{
	if (MapTimer){  window.clearInterval(MapTimer);  }
	MapTimer = setInterval("ClearShowMap()",1000);  	
}
	
function ClearShowMap()
{
	var Map = $("ShowMap");
	clearTimeout(MapTimer);
	if (Map.style.display == "") { Map.style.display = "none";}
}	

	function OpenVideo(srcE)
	{
		if ($("TC_Video").style.display == "")
		{
			$("TC_Video").style.display = "none";
			srcE.src = "http://class.studyget.com/images/open.gif";
		}
		else
		{
			$("TC_Video").style.display = "";
			srcE.src = "http://class.studyget.com/images/close.gif";
		}
	}

