﻿//PBlog2 公用JS代码
//Author:PuterJam

function TopicShow(e,TopicID){
	 e.className=(e.className=="BttnC")?"BttnE":"BttnC"
	 document.getElementById(TopicID).style.display=(e.className=="BttnC")?"":"none"
}

function CopyText(obj) {
	ie = (document.all)? true:false
	if (ie){
		var rng = document.body.createTextRange();
		rng.moveToElementText(obj);
		rng.scrollIntoView();
		rng.select();
		rng.execCommand("Copy");
		rng.collapse(false);
	}
}
//定义一个运行代码的函数
function runCode(o)
{
    ie = (document.all)? true:false
    if (ie)
    {
        var code=o.innerText;  //即要运行的代码。
        var newwin=window.open('','','');  //打开一个窗口并赋给变量newwin。
        newwin.opener = null // 防止代码对论谈页面修改
        newwin.document.write(code);  //向这个打开的窗口中写入代码code，这样就实现了运行代码功能。
        newwin.document.close();
    }
}


function saveCode(obj) {
         ie = (document.all)? true:false
    if (ie)
    {
        var winname = window.open('', '_blank', 'top=10000');
        var code=obj.innerText;
                  winname.opener = null
        winname.document.write(code);
        winname.document.execCommand('saveas','','code.htm');
        winname.close();
}
}
//写入顶部Flash文件
function WriteHeadFlash(Path,Width,Height,Transparent){
	 var Temp,T=""
	 Temp='<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="FlashH" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+Width+'" height="'+Height+'">'
	 Temp+='<param name="movie" value="'+Path+'"/>'
	 Temp+='<param name="quality" value="High"/>'
	 Temp+='<param name="scale" value="ExactFit"/>'
	 if (Transparent) {Temp+=' <param name="wmode" value="transparent"/>';T='wmode="transparent"'}
	 Temp+='<embed src="'+Path+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="FlashH" width="'+Width+'" height="'+Height+'" quality="High"'+T+' scale="ExactFit"/>'
	 Temp+='</object>'
	 document.getElementById("FlashHead").innerHTML=Temp
}