function getHtmlParas(suffix){
	var urlParas=location.search;
	urlParas=urlParas.substring(1,urlParas.length-suffix.length).split('/')
	return urlParas
}
function viewplay(para1,para2)//播放影片文件.(a)来源,(b)哪一集
{
	//a=0	b=0	
	var urlAndFrom,doc,url,from,nexturl,NextWebPage,w,h
	urlAndFrom=handleParas(para1,para2)//="稻香,http://localhost/Mtv/魔杰座周杰伦《稻香》.flv,flv"
	try{autoSubmitErr(urlAndFrom,para2)}catch(e){}//报错
	url=urlAndFrom[1];
	from=urlAndFrom[2]//="flv"
	nexturl=urlAndFrom[3]
	NextWebPage=urlAndFrom[4]
	w=970;h=540
	$("#player_container").attr("src",imagesPath+"js/video/play.html?url="+url+"&from="+from+"&nexturl="+nexturl+"NextWebPage="+NextWebPage+"&w="+w+"&h="+h+"");
}
function handleParas(para1,para2)//播放哪播放器的哪一集？(a)播放器(b)哪一集
{
	//para1=0		para2=2
	var i,fromArray,len1,len2,urlArray,j,dataStr,dataArray
	if (isNaN(para1) || isNaN(para2)){para1=1;para2=1}//=False
	fromArray=VideoListJson
	para1--;para2--
	len1=fromArray.length//=1
	if(para1>len1-1)//false
	{
		para1=len1-1
	}
	for (i=0;i<len1;i++)
	{
		if(para1==i)//true  选播放器
		{
			urlArray=fromArray[i][1]
			len2=urlArray.length;//=21
			if(para2>len2-1)//false
			{para2=len2-1};
			for (j=0;j<len2;j++)
			{
				if (para2==j){dataStr=urlArray[j];}
				if(para2+1==j)
				{
				urlinfo=urlinfo.replace("<from>",para1+1)
				urlinfo=urlinfo.replace("<pos>",j+1)
				dataStr=dataStr+"$"+urlArray[j]+"$"+urlinfo
				}
			}
		}
	}
	dataStr=dataStr+"$$$$"
	dataArray=dataStr.split('$');//="稻香"
	return dataArray
}
function autoSubmitErr(urlAndFrom,para2)//提取(a)中的字符串传给autoCheckWrong函数
{//urlAndFrom="第1集$27435139$youku"
//para2=0
	if (urlAndFrom[2]=='youku' || urlAndFrom[2]=='iask' || urlAndFrom[2]=='tudou')
	{
		autoCheckWrong(urlAndFrom[1],urlAndFrom[2],play_vid,'第'+(parseInt(para2)+1)+'组来源中的数据:'+urlAndFrom[0]+'$'+urlAndFrom[1].replace(/&/g,'%26')+'$'+urlAndFrom[2]);
	}
	//autoCheckWrong(27435139,"youku",79,"第1组来源中的数据:第1集$27435139$youku")
}
function autoCheckWrong(id,from,vid,errinfo)//将字符串传给ajax.asp
{//id=27435139		from="youku"	vid=79	errinfo="第1组来源中的数据:第1集$27435139$youku"
	ajax.get("/"+sitePath+"inc/ajax.asp?action=autocheck&from="+from+"&id="+id.replace(/&/g,'%26')+'&vid='+vid+'&err='+errinfo,
		function (obj){}	);	
	//		/move/inc/ajax.asp?action=autocheck&from=youku&id=27435139&vid=79&err="第1组来源中的数据:第1集$27435139$youku"
}
$(function(){
  var iframe='<iframe width="100%" height="1" frameborder="0" scrolling="no" src="/inc/comment/index.html?id='+videoID+'&type=1&title=标题" marginheight="0" marginwidth="0" name="comment" style="height: 791px;"></iframe>';	
  $("#comment_list").html(iframe)
  var param=getHtmlParas('.html');viewplay(param[0],param[1]);
})
