var postSubmited = false;
function popnew(url,title,width,height){
    var w = 1024;
    var h = 768;

    if (document.all || document.layers){
        w = screen.availWidth;
        h = screen.availHeight;
    }

    var leftPos = (w/2-width/2);
    var topPos = (h/2.3-height/2.3);

    window.open(url,title,"width="+width+",height="+height+",top="+topPos+",left="+leftPos+",scrollbars=no,resizable=no,status=no")
}

function ctlent(obj) {
	if(postSubmited == false && (event.ctrlKey && window.event.keyCode == 13) || (event.altKey && window.event.keyCode == 83)) {
			if(this.document.input.topicsubmit) this.document.input.topicsubmit.disabled = true;
			if(this.document.input.replysubmit) this.document.input.replysubmit.disabled = true;
			if(this.document.input.editsubmit) this.document.input.editsubmit.disabled = true;
			postSubmited = true;
			this.document.input.submit();
	}
}

var flag=false; 
function DrawImage(ImgD){ 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0){ 
		flag=true; 
		if(image.width>=518){ 
			ImgD.width=518; 
			ImgD.height=(image.height*518)/image.width; 
		}else{ 
			ImgD.width=image.width; 
			ImgD.height=image.height; 
		}  
	} 
} 

function winconfirm(confirmMSG,confirmURL){
	question = confirm(confirmMSG);
	if (question != "0"){
		window.location=confirmURL;
	}
}

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 makemedia(strType,strID,strURL,intWidth,intHeight)
{
	var varHeader="V";
	var tmpstr="";
	var bSwitch = false;
	bSwitch = document.getElementById(varHeader+strID).value;
	bSwitch	=~bSwitch;
	document.getElementById(varHeader+strID).value = bSwitch;
	if(bSwitch){
		document.getElementById(strID).innerHTML = "影音文件源地址：<a href='"+strURL+"' target='_blank'>"+strURL+"</a>";
	}else{
		switch(strType.toUpperCase()){
			case "SWF":
				tmpstr="<object codeBase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='"+intWidth+"' height='"+intHeight+"'><param name='movie' value='"+strURL+"'><param name='quality' value='high'><param name='AllowScriptAccess' value='never'><embed src='"+strURL+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+intWidth+"' height='"+intHeight+"'>'"+strURL+"'</embed></OBJECT>";
				break;
			case "CC":
                                tmpstr="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+intWidth+"' height='"+intHeight+"'><param name='movie' value='http://union.bokecc.com/"+strURL+"'><param name='allowFullScreen' value='true' /><param name='quality' value='high'><embed src='http://union.bokecc.com/"+strURL+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+intWidth+"' height='"+intHeight+"'></embed></OBJECT>";
                                break;
                        case "WMA":
				tmpstr="<object classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'  id='MediaPlayer' width='"+intWidth+"' height='"+intHeight+"'><param name='ShowStatusBar' value='0'><param name='AutoStart' value='True'><param name='Filename' value='"+strURL+"'></object>";
				break;
			case "WMV":
				tmpstr="<object classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' width='"+intWidth+"' height='"+intHeight+"'><param name='ShowStatusBar' value='-1'><param name='AutoStart' value='Ture'><param name='Filename' value='"+strURL+"'></object>";
				break;
			case "RM":
				tmpstr="<object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' height='"+intHeight+"' id='Player' width='"+intWidth+"' viewastext><param name='_ExtentX' value='12726'><param name='_ExtentY' value='8520'><param name='AUTOSTART' value='0'><param name='SHUFFLE' value='0'><param name='PREFETCH' value='0'><param name='NOLABELS' value='0'><param name='CONTROLS' value='ImageWindow'><param name='CONSOLE' value='_master'><param name='LOOP' value='0'><param name='NUMLOOP' value='0'><param name='CENTER' value='0'><param name='MAINTAINASPECT' value='"+strURL+"'><param name='BACKGROUNDCOLOR' value='#000000'></object><br><object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' height='32' id='Player' width='"+intWidth+"' VIEWASTEXT><param name='_ExtentX' value='18256'><param name='_ExtentY' value='794'><param name='AUTOSTART' value='-1'><param name='SHUFFLE' value='0'><param name='PREFETCH' value='0'><param name='NOLABELS' value='0'><param name='CONTROLS' value='controlpanel'><param name='CONSOLE' value='_master'><param name='LOOP' value='0'><param name='NUMLOOP' value='0'><param name='CENTER' value='0'><param name='MAINTAINASPECT' value='0'><param name='BACKGROUNDCOLOR' value='#000000'><param name='SRC' value='"+strURL+"'></object>";
				break;
			case "QT":
				tmpstr="<embed src='"+strURL+"' autoplay='true' Loop='false' controller='true' playeveryframe='false' cache='false' scale='TOFIT' bgcolor='#000000' kioskmode='false' targetcache='false' pluginspage='http://www.apple.com/quicktime/'>";
				break;
			case "RA":
				tmpstr="<object classid='clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA' id='RAOCX' width='"+intWidth+"' height='"+intHeight+"'><param name='_ExtentX' value='6694'><param name='_ExtentY' value='1588'><param name='AUTOSTART' value='0'><param name='SHUFFLE' value='0'><param name='PREFETCH' value='0'><param name='NOLABELS' value='0'><param name='SRC' value='"+strURL+"'><param name='CONTROLS' value='StatusBar,ControlPanel'><param name='LOOP' value='0'><param name='NUMLOOP' value='0'><param name='CENTER' value='0'><param name='MAINTAINASPECT' value='0'><param name='BACKGROUNDCOLOR' value='#000000'><embed src='"+strURL+"' width='253' autostart='true' height='60'></embed></object>"
		}
		document.getElementById(strID).innerHTML = tmpstr;
	}
}

//缩放字体大小////////////////////////////
var status0='';
var curfontsize=10;
var curlineheight=18;
function fontZoomA(){
  if(curfontsize>8){
    document.getElementById('fontzoom').style.fontSize=(--curfontsize)+'pt';
	document.getElementById('fontzoom').style.lineHeight=(--curlineheight)+'pt';
  }
}
function fontZoomB(){
  if(curfontsize<64){
    document.getElementById('fontzoom').style.fontSize=(++curfontsize)+'pt';
	document.getElementById('fontzoom').style.lineHeight=(++curlineheight)+'pt';
  }
}
// 字体大小
function ContentSize(size)
{
var obj=document.getElementById("size");obj.style.fontSize=size+"px";
}
// 隐藏脚本——————--------------
function opencat(cat){
  if(cat.style.display=="none"){
    cat.style.display="";
  	} else {
    cat.style.display="none"; 
  	}
}
// 评论脚本——————--------------
function AddText(text) {
	if (document.FrontPage_Form1.Content.createTextRange && document.FrontPage_Form1.Content.caretPos) {      
		var caretPos = document.FrontPage_Form1.Content.caretPos;      
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
		text + ' ' : text;
	}
	else document.FrontPage_Form1.Content.value += text;
	document.FrontPage_Form1.Content.focus(caretPos);
}

function blogquote(objID,strAuthor,strTime){
	document.FrontPage_Form1.Content.value += "[quote][b]最初由 [color=blue]"+strAuthor+"[/color] 发表于 "+strTime+"：[/b]\n"+document.getElementById(objID).innerText+"[/quote]";
        document.FrontPage_Form1.Content.focus();
}


function Checklogin(id)
{
var str=getObjValues("title"+id);
if(str==""){
alert("请输入查看密码！");
return false;
}
if(str.length>20){
alert("不需要这么长的密码！");
return false;
}
GETAjax("../Hxblog/blog_Ajax.asp?id="+id+"&t="+str,"Hxblog"+id);
document.getElementById("title"+id).value="";
return false;
}

function Checkcomment(id,page)
{
OpenClose("commentinfo"+id,page);
GETAjax("../Hxblog/blog_commentAjax.asp?id="+id+"&page="+page,"commentinfo"+id);
return false;
}

function Checkcommentput(id)
{
var str1=document.FrontPage_Form1.comm_memName.value;
var str2=document.FrontPage_Form1.blog_Code.value;
var str3=document.FrontPage_Form1.Content.value;
if(str1==""){
alert("请输入作者名称！");
return false;
}
if(str1.length>12){
alert("不需要这么长的名称！");
return false;
}
if(str2==""){
alert("请输入验证码！");
return false;
}
if(str3==""){
alert("请输入评论内容！");
return false;
}
if(str3.length>600){
alert("不需要这么长的评论！");
return false;
}
var strA = "comm_memName="+ escape(str1);
strA += "&blog_Code=" + escape(str2);
strA += "&content=" + escape(str3);
POSTAjax("../Hxblog/blog_Comment.asp?action=1&id="+id,strA,"commentmsg");
FrontPage_Form1.reset();
return false;
}

function Checkcommentdel(id,p){
   if(window.confirm("确认删除么？"))
     {
     GETAjax("../Hxblog/blog_Comment.asp?action=2&id="+id+"&p="+p,"msg"+id+p);
     return false;
     }
}

function Checkcommentreply(id,p){
GETAjax("../Hxblog/blog_Comment.asp?action=3&id="+id+"&p="+p,"reply"+id+p);
return false;
}

function Checkcommentreplyput(id,p)
{
var str=getObjValues("replyContent"+p);
if(str==""){
alert("请输入回复内容！");
return false;
}
if(str.length>200){
alert("不需要这么长的回复！");
return false;
}
var strA = "replycontent="+ escape(str);
POSTAjax("../Hxblog/blog_Comment.asp?action=4&id="+id+"&p="+p,strA,"reply"+id+p);
return false;
}

function Checkcommenttb(id)
{
OpenClose("commentinfo"+id);
GETAjax("../Hxblog/blog_tbajax.asp?action=1&id="+id,"commentinfo"+id);
return false;
}

function Checkcommenttbdel(id){
   if(window.confirm("确认删除么？"))
     {
     GETAjax("../Hxblog/blog_tbajax.asp?action=2&id="+id,"commentinfo"+id);
     return false;
     }
}

function showBlogUser(id)
{
GETAjax("../Hxblog/User_Ajax.asp?id="+id,"Blog"+id+"_menu");
return false;
}

function showVisitor(id)
{
GETAjax("../user/user_Visitor.asp?id="+id,"userVisitor");
return false;
}

function BlogAboutme(id)
{
GETAjax("../HxBlog/user_MaterialAjax.asp?id="+id,"Aboutme","个人资料");
return false;
}

function BlogComment(id,page)
{
GETAjax("../HxBlog/user_CommentAjax.asp?id="+id+"&page="+page,"Aboutme","所有评论");
return false;
}

function BlogVisitor(id)
{
GETAjax("../HxBlog/user_VisitorAjax.asp?id="+id,"Aboutme","在线访客");
return false;
}
// -->