
function Geturl(id,videoID)
{
return 'http://count.pcpop.com/ArtVideoDataOperate.aspx?VideoID='+videoID+'&TypeID='+id+'&jsoncallback=?';
}

//写flv
function writeflv(srid,videoID)
{
if(srid==0)
{
 $('#flvurl'+videoID)[0].innerHTML='<object id=object'+videoID+'  classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0 width=480 height=400><param name=movie value="http://vv.pcpop.com/player/player.swf?file='+srid+'" /><param name=quality value=high /><param name=allowScriptAccess value=always /><param name=wmode value=transparent><embed wmode=transparent src="http://vv.pcpop.com/player/player.swf?file='+srid+'" quality=high pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash width=480 height=400></embed></object><script>document.getElementById("object'+videoID+'").SetVariable("urllk",top.location.toString())</script>';
} 
}

//请求JSON
function RequestJson(videoID)
{
$.getJSON(Geturl(6,videoID),function (json)
{
$('#Video_Name'+videoID)[0].innerHTML=json.name;
$('#Favtime'+videoID)[0].innerHTML=json.fav;
$('#Usetime'+videoID)[0].innerHTML=json.uses;
$('#badtime'+videoID)[0].innerHTML=json.bads;
$('#GoodTime'+videoID)[0].innerHTML=json.good;
$('#Video_type'+videoID)[0].innerHTML=json.types;
$('#playtime'+videoID)[0].innerHTML=json.plays;
writeflv(json.link,videoID);
});
}

	
	
  //构建lightbox
  //w:对话框宽度，h:对话框高度，html:对话框中的html,eg:msg('300','200',innerhtml)
	function msg(w,h,link,flvurl){
	var flvHTML='<object id=object'+flvurl+'  classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0 width=480 height=400><param name=movie value="http://vv.pcpop.com/player/player.swf?file='+flvurl+'" /><param name=quality value=high /><param name=allowScriptAccess value=always /><param name=wmode value=transparent><embed wmode=transparent src="http://vv.pcpop.com/player/player.swf?file='+flvurl+'" quality=high pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash width=480 height=400></embed></object><script>document.getElementById("object'+flvurl+'").SetVariable("urllk",top.location.toString())</script>'
	var flashhtmls=flvHTML.replace('<PARAM NAME="Play" VALUE="0">','').replace('<PARAM NAME="Play" VALUE="-1">','');
	//对话框中的html
	var innerhtml="<center>";
    innerhtml+="<div style='height:1px;overflow:hidden;background:#9dc9ec;width:400px;border-left:1px solid #9dc9ec;border-right:1px solid #9dc9ec;'></div>"
    innerhtml+="<div style='height:1px;overflow:hidden;background:#9dc9ec;width:400px;border-left:1px solid #9dc9ec;border-right:1px solid #9dc9ec;'></div>"
    innerhtml+="<div style='height:1px;overflow:hidden;background:#9dc9ec;width:400px;border-left:1px solid #9dc9ec;border-right:1px solid #9dc9ec;'></div>"
    innerhtml+="<div style='height:20px;overflow:hidden;background:#9dc9ec;width:400px;border-left:1px solid #9dc9ec;border-right:1px solid #9dc9ec;color:#fff;font-size:12px;font-weight:bold;text-align:left;padding-top:5px;'>&nbsp;与朋友分享视频</div>"
    innerhtml+="<div style='height:100px;width:400px;background-color:#ffffff;overflow:hidden;border-left:1px solid #9dc9ec;border-right:1px solid #9dc9ec;padding-top:8px;padding-bottom:15px;font-size:12px;text-align:left'>&nbsp;&nbsp;本页面地址:<input onmousedown='this.select();copyToClipboard(this.value);alert(\"复制代码成功！\")' type=text style='height:18px;width:75%' value='"+location.href+"'/><br>&nbsp;&nbsp;网页HTML:&nbsp;&nbsp;<input value='"+flashhtmls+"' onmousedown='this.select();copyToClipboard(this.value);alert(\"复制代码成功！\")' type=text style='height:18px;width:75%' /><br>&nbsp;&nbsp;论坛UBB:&nbsp;&nbsp;&nbsp;<input onmousedown='this.select();copyToClipboard(this.value);alert(\"复制代码成功！\")' type=text style='height:18px;width:75%' value='[flash]http://vv.pcpop.com/player/player.swf?file="+link+"[/flash]' /><br><center><input type=button onclick='cancle()' value='关 闭' /></center></div>";
    innerhtml+="<div style='height:1px;overflow:hidden;background:#ffffff;width:400px;border-left:1px solid #9dc9ec;border-right:1px solid #9dc9ec;'></div>"
    innerhtml+="<div style='height:1px;overflow:hidden;background:#ffffff;width:400px;border-left:1px solid #9dc9ec;border-right:1px solid #9dc9ec;'></div>"
    innerhtml+="<div style='height:1px;overflow:hidden;background:#9dc9ec;width:400px;border-left:1px solid #9dc9ec;border-right:1px solid #9dc9ec'></div>"
    innerhtml+="</center>"
	//覆盖层
	var p=document.createElement("DIV");
	p.id="p";
	p.style.position="absolute";
	p.style.width="100%";
	p.style.height=((document.body.offsetHeight>document.body.scrollHeight)?'100%':document.body.scrollHeight + "px");
	p.style.zIndex='998';
	p.style.top='0px';
    p.style.left='0px';
	p.style.backgroundColor="gray";
	//FireFox
	p.style.opacity='0.5';
	//IE
	p.style.filter="alpha(opacity=80)";
	document.body.appendChild(p);
	//高亮对话框
	var p1=document.createElement("DIV");
	p1.style.position="absolute";
	p1.id="p1";	
	p1.style.width=w + "px";	
	p1.style.height="153px";
	p1.style.zIndex='999';	
	var top;
	var left=Math.ceil(((document.documentElement.offsetWidth)-parseInt(p1.style.width.replace('px','')))/2);//+document.documentElement.scrollLeft;
	document.ns = navigator.appName == "Netscape";
	if(document.ns)
 	{
		top= pageYOffset+(window.innerHeight-153)/2;
	}
	else
	{
		top=Math.ceil(((document.documentElement.offsetHeight)-parseInt(p1.style.height.replace('px','')))/2)+document.documentElement.scrollTop;
	}
	p1.style.top=( top < 0 ? 0 : top ) + 'px';
  p1.style.left=( left < 0 ? 0: left ) + 'px';
	document.body.appendChild(p1);
	//对话框中的html
	p1.innerHTML=innerhtml;
	var arr=document.getElementsByTagName("select");
	var i=0;
	while(i<arr.length){
	  arr[i].style.visibility='hidden';
	  i++;
	}
	p1.focus();
}
function ReplaceStr(str)
{
    return str.replace('<','').replace('>','');
}
//关闭lightbox
	function cancle(){ 
 document.body.removeChild(document.getElementById('p'));
	  document.body.removeChild(document.getElementById('p1'));
	  var arr=document.getElementsByTagName("select");
	  var i=0;
	  while(i<arr.length){
	  arr[i].style.visibility='visible';
	  i++;
	  }	 
	}
function copyToClipboard(txt) {

             window.clipboardData.clearData();
						 txt=txt.replace('<PARAM NAME="Play" VALUE="0">','').replace('<PARAM NAME="Play" VALUE="-1">','');
             window.clipboardData.setData("Text", txt);

}
