﻿$=function(obj)
{
    return document.getElementById(obj);
}

//简介隐藏/显示
function showHide(hideID,showID)
        {
            if(showID != null && showID.toLowerCase() != 'null')
            {
                if(document.getElementById(showID).style.display == "none")
                {
                    document.getElementById(showID).style.display = "block";
                }
                else
                {
                    document.getElementById(showID).style.display = "none";
                }
            }
            if(hideID != null && hideID.toLowerCase() != 'null')
            {
                document.getElementById(hideID).style.display = "none";
            }
        }

//--------投票验证(顶/踩)--------
//sid:文章ID
//Vote:投票类型(1顶0踩)
//IsVote:确定投票(1是0否)
//--------------------------------
function VideoVote(sid,Vote,IsVote)
{
    var xmlhttp;
	try
	{
	    xmlhttp=new XMLHttpRequest();
	}
	catch(e)
	{
	    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function()
	{
	    if (xmlhttp.readyState==4){
		    if (xmlhttp.status==200){		   
			    document.getElementById('VoteResult').innerHTML=xmlhttp.responseText;				
			}
		else{
			document.getElementById('VoteResult').innerHTML="更新失败.";
			}
		} 
	}
	xmlhttp.open("post", "/Video/UpdateVote.aspx", true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	if(IsVote==1)
	    xmlhttp.send("sid="+escape(sid)+"&Vote="+escape(Vote)+"&Action=Vote");
	else
	    xmlhttp.send("sid="+escape(sid)+"&Vote="+escape(Vote)+"&Action=Null");
}

//--------复制文本框中的内容--------
function CopyAll(T)
{
  T.focus(); //使文本框得到焦点
  T.select(); //把文本框中的内容全选
  if (document.all){
  therange=T.createTextRange();
  therange.execCommand("Copy"); //复制
  alert('复制成功.');
  }
}

//------------播放器----------
//w:播放器宽度
//h:播放器高度
//fp:播放器路径
//vp:视频文件路径
function VideoPlayer(w,h,fp,vp)
{
    var str = "<img src='/Video/images/index_17.gif' border='0' />";
    if(vp.length > 0)
    {
        str = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" + w + "' height='" + h + "' id='Player01' align='middle'>";
        str += "<param name='allowScriptAccess' value='sameDomain' />";
        str += "<param name='movie' value='" + fp + "' />";
        str += "<param name='quality' value='high' />";
        str += "<param name='bgcolor' value='#ffffff' />";
        str += "<param name='allowFullScreen' value='true' />";
        str += "<param name='FlashVars' value='" + vp + "' />";
        str += "<embed src='" + fp + "' FlashVars='" + vp + "' quality='high' bgcolor='#ffffff' width='" + w + "' allowFullScreen='true' height='" + h + "' name='Player01' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
        str += "</object>";  
    }
    
    return str;
}