//后台javascript



/*标签生成器*/
function tagcontent(){
	var tempstr;
	var trid;
	var thisid,cid,moduleid;
	var mycid; //当前频道ID

	//接收检测频道ID
	thisid = document.getElementById("content_cid").value;

	mycid = getobj("mycid").value-0;
	if (thisid.length==1)
	{
		alert("请选择频道");
		return false;
	}

	cid = thisid.split("$")[1];
	moduleid = thisid.split("$")[0]+"";

	switch (moduleid)
	{
	case "3":
		trid=18;
		break;
	case "4":
		trid=19;
		break;
	case "5":
		trid=20;
		break;
	case "6":
		trid=21;
		break;
	case "7":
		trid=22;	
		break;
	}
	tempstr = "{$li(listitem,main," + cid;
	tempstr += "," + document.getElementById("class").value;
	tempstr += "," + document.getElementById("topicid").value;
	tempstr += "," + document.getElementById("count").value;
	tempstr += "," + document.getElementById("showtype").value;
	tempstr += "," + getobj("date1").value;
	tempstr += "," + getobj("date2").value;
	tempstr += "," + getobj("timeunit").value;
	tempstr += "," + getobj("timetype").value;
	tempstr += ","+trid;
	tempstr += ")}";
	document.getElementById("tags").value = tempstr;
}

function admin_Size(num,objname){
	var obj=getobj(objname);
	if (parseInt(obj.rows)+num>=3) {
		obj.rows = parseInt(obj.rows) + num;	
	}
	if (num>0)
	{
		obj.width="90%";
	} 
}

//标签生成器二级联动菜单
function   changeselect1(obj,locationid){  
	document.getElementById(obj).length   =   0;  
	document.getElementById(obj).options[0]   =   new   Option('无分类限制','0');  

	/*当前页时反回不变*/
	/*if((locationid.split("$")[0])=="当前频道"){return false}*/

	/*非首页页时显示当前分类选项*/
	if((0+locationid.split("$")[1])!=1){
	document.getElementById(obj).options[1]   =   new   Option('--当前分类--','-1'); 
	}
	for   (i=1;   i<subcat.length;   i++)  
	{  
		if   (subcat[i][0]   ==   locationid.split("$")[1])  
		{ 
			document.getElementById(obj).options[ document.getElementById(obj).length]   =   new   Option(subcat[i][2],subcat[i][1]);}  
		}  

	document.getElementById("topicid").length   =   0;  
	document.getElementById("topicid").options[0]   =   new   Option('无专题限制','0');  
	document.getElementById("topicid").options[1]   =   new   Option('--当前专题--','-1'); 
	for   (i=1;   i<subcattopic.length;   i++)  
	{  
		if   (subcattopic[i][0]   ==   locationid.split("$")[1])  
		{ 
			document.getElementById("topicid").options[ document.getElementById("topicid").length]   =   new   Option(subcattopic[i][2],subcattopic[i][1]);}  
		} 
}  

function tagclass(){
	var tempstr;
	var trid;
	var thisid,cid,moduleid;
	var mycid;

	//接收检测频道ID
	thisid = document.getElementById("class_cid").value;
	mycid = getobj("mycid").value-0;

	if (thisid.length==1)
	{
		alert("请选择频道");
		return false;
	}

	cid = thisid.split("$")[1];
	moduleid = thisid.split("$")[0] + "";


	if (moduleid=="2")
	{
		alert("介绍频道不能调用其它频道的内容,如果需要请用首页频道复制出所需要频道");
		return false;
	}
	tempstr = "{$li(listclass,main," + cid;
	tempstr = tempstr + "," + document.getElementById("classtype").value;
	tempstr = tempstr + ",16)}";
	document.getElementById("tags").value = tempstr;		
}

function tagtopic(){
	var tempstr;
	var trid;
	var thisid,cid,moduleid;
	var mycid;

	//接收检测频道ID
	thisid = document.getElementById("topic_cid").value;
	mycid = getobj("mycid").value-0;

	if (thisid.length==1)
	{
		alert("请选择频道");
		return false;
	}

	cid = thisid.split("$")[1];
	moduleid = thisid.split("$")[0] + "";


	if (moduleid=="2")
	{
		alert("这个频道不能调用其它频道的内容,如果需要请用首页频道复制出所需要频道");
		return false;
	}

	trid=17;
	

	tempstr = "{$li(listtopic,main," + cid;
	tempstr = tempstr + ","+trid+")}";
	document.getElementById("tags").value = tempstr;
}

function taggroup()	{
	var tempstr;
	var thisid,cid,moduleid;
	var mycid;

	//接收检测频道ID
	thisid = document.getElementById("topic_cid").value;
	mycid = getobj("mycid").value-0;

	if (thisid.length==1)
	{
		alert("请选择频道");
		return false;
	}

	cid = thisid.split("$")[1];
	moduleid = thisid.split("$")[0] + "";


	if (moduleid=="2")
	{
		alert("这个频道不能调用其它频道的内容,如果需要请用首页频道复制出所需要频道");
		return false;
	}

	

	tempstr = "{$li("+getobj("groupname").value+",main," + cid+","+getobj("count").value;
	tempstr = tempstr + ",23,24)}";
	document.getElementById("tags").value = tempstr;
}

function tagblog(){
	var tempstr;
	var thisid;

	tempstr = "{$li(blog,main,"+getobj("blogtype").value+","+getobj("count").value;
	tempstr = tempstr + ",25)}";
	document.getElementById("tags").value = tempstr;
}

function tagvote(){getobj("tags").value = "{$li(vote,main,"+getobj("thisclassid").value+",11,12)}";}

function tagitem(){
	var tempstr;
	var thisid;

	tempstr = "{$li(item,main,"+getobj("itemid").value;
	tempstr = tempstr + ",13)}";
	document.getElementById("tags").value = tempstr;
}

function showform(id,title){
	var editform;
	editform = "<form method=post action='?act=savereadme&id=" + id + "' style='display:inline;'>";
	editform += "<input type='text' name='readme' value='" + title + "' size='30'>";
	editform += "<input type='submit' value='修改'>";
	editform += "</form>";
	document.getElementById('readme'+id).innerHTML=editform;
}

/*是否是预览图片,名称中包含pre的就是预览图*/
function ispreimg(str){
	if (str.indexOf("/pre/")>0){document.write(" <i>预</i> ");}
}
function Preview(obj,str){
	if(obj.length==0) return false;

	if (str){
		var sExt=str.substr(str.lastIndexOf(".")+1);
		sExt=sExt.toUpperCase();
		switch(sExt){
		case "GIF":
		case "JPG":
		case "BMP":
		case "PNG":
			//tdPreview.innerHTML = "<img border=0 src='" + url + "' width='170' height='140'>";
		document.getElementById(obj).innerHTML="<img src='" + str + "' onclick='javascript:window.open(this.src);' style='CURSOR: pointer' onload='rsimg(this,180 )'>";

		//tdPreview.innerHTML = sHTML;
		}
	}
	else 
	{
		tdPreview.innerHTML = "";
	}
}

function getsize(size) {
    if (size==null) return false;
    size = (size / 1024);
	size = Math.round(size);
	if(size==0){size=1}
    document.write(size+"k");
}
//预览图显示相应标记
function showprestr(str){
	if (str.indexOf("/pre/")>0)
	{
		document.write("<cite>预</cite>");
	}
}
//编辑title
function toarea(num){
	var obj="t"+num;
	var I;
	for (I=0; I<100; I++){
		if(chkdiv("templatehelp"+I)){getobj("templatehelp"+I).style.color="#000";}
	}	
	if(chkdiv("templatehelp"+num)){
		getobj(obj).focus();
		getobj("templatehelp"+num).style.color="#f00";
		}
}



/*表单部分*/
function showoption(str){
	if (str.length>0)
	{
		str = str.replace(/\|/g,"<br>");
		document.write(str);
	}	
}




/*=============================*/
/*财务明细*/
/*显示款项审核状态*/
function showmoneystate(num){
	num=num+0;
	if (num==0)
	{
		document.write("<img src='../images/check_error.gif' alt='' />");
	}
	else
	{
		document.write("<img src='../images/check_right.gif' alt='' />");	
	}
}
/*显示款项种类*/
function showmoneytype(num){
	num=num+0;
	switch (num)
	{
	case 1 :
		document.write("入款");
		break;
	case 2 :
		document.write("扣款");
		break;
	case 3 :
		document.write("消费");
		break;
	}
}



/*===============================*/
/*显示定单状态*/
function showordertype(num){
	var arrordertype = ordertype.split("|")
	num+=0
	document.write(arrordertype[num]);
}
/*是否显示删除定单*/
function delorder(num1,num2){
	num1=0+num1;
	num2=0+num2;
	if (num2==2)
	{
		getobj("ad"+num1).style.display="none";
	}
	
}

/*是一时显示对勾*/
function isright(num){
	num=0+num;
	if(num==1){document.write("<img src=\"../images/check_right.gif\" alt=\"\" />")}
}



/*频道管理*/
function chatype(num){
	num=0+num;
	switch (num)
	{
	case 0 :
		document.write("系统");
		break;
	case 1 :
		document.write("内部");
		break;
	case 2 :
		document.write("外部");
		break;
	}
}
function chaoperate(num1,num2){
	num1=0+num1;num2=0+num2;
	if (num1==1||num1==3||num1==4||num1==5||num1==9){
		document.write("<a href=\"?act=ghost&id="+num1+"\" onclick=\"return showinnew(this,400,450)\">克隆</a>");
	}
	else{
		document.write("<span class=\"gray\">克隆</span>");
	}
	switch(num2){
		case 0:
			document.write("￤<span class=\"gray\">删除</span>");
			break;
		case 1:
			document.write("￤<a href=\"?act=delghost&id="+num1+"\" onClick=\"return confirm('确认要删除ID="+num1+"的这个频道吗!删除后不可恢复')\">删除</a>");
			break;
		case 2:
			document.write("￤<a href=\"?act=delout&id="+num1+"\" onClick=\"return confirm('确认要删除除ID="+num1+"的这个频道吗!删除后不可恢复')\">删除</a>");
	}
}




/*user_blog.asp*/
/*编辑用户分类*/
function edituserclass(num){
	edit("classinfo",200,150);
	getobj("classtitle").value=getobj("title"+num).innerHTML;
	getobj("classcls").value=getobj("cls"+num).innerHTML;
	getobj("classform").action+=num
}
/*数据库类型*/
function mymdb(num){
	if (num==0)
	{
		document.write("Access")
	}
	else
	{
		document.write("MsSQL")
	}
}

function getJVer(){
  //获取JScript 版本
  return ScriptEngineMajorVersion() +"."+ScriptEngineMinorVersion()+"."+ ScriptEngineBuildVersion();
}
//=============================私有函数:admin_template.asp

/*把文件地址追加到指定obj*/
function fileurl(obj,str){
	var originallyvalue;
	var thisgap='';

	if (obj=="myurl")
	{
		thisgap="\n"
		originallyvalue=window.opener.document.getElementById(obj).value;
		if(originallyvalue.length==0){
			window.opener.document.getElementById(obj).value="下载地址|"+str;
		}
		else{
			window.opener.document.getElementById(obj).value+=thisgap+"下载地址|"+str;
		}	
	}

	else{
	window.opener.document.getElementById(obj).value=str;
	}
	window.close();
}
