﻿String.prototype.Trim 	= function(){return this.replace(/^\s+|\s+$/g,"");}
String.prototype.Ltrim	= function(){return this.replace(/^\s+/g, "");}
String.prototype.Rtrim	= function(){return this.replace(/\s+$/g, "");}
String.prototype.LtrimN	= function(){return this.replace(/(&nbsp;)*/, "");}

function isFieldEName(s) {
	var patrn=/^[a-zA-Z]{3,12}$/;
	if (!patrn.exec(s)) {
		return false;
	}
	return true;
}
/*删除*/
function CheckDele(){
	if(!confirm('确定删除记录?')){return false;}
}

function Checkdo(megstr){
	if(!confirm(megstr)){return false;}
}


function CheckClassDele(){
	if(!confirm('确定删除该栏目及其所有子栏目?')){return false;}
}
/*对话框*/
function ShowDialog(obj,url,width,height){
	var str=showModalDialog(url,window,"dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:auto;resizable:no;status:no");
	if (str != undefined){
		var arr = obj.split(",");
		var str = str.split("*");
		if(arr.length > 1){
			for(i = 0; i < arr.length; i++){
				eval(arr[i]).value = str[i];
			}
		}else{
			eval(obj).value = str;
		}
	}
}
//编辑对话框
function editorShowDialog(obj,url,width,height){
	var str=showModalDialog(url,window,"dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:auto;resizable:no;status:no");
	if (str != undefined){
		var oEditor = FCKeditorAPI.GetInstance(obj) ;
		//document.getElementById("title").value = "值为1";
		if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
		{
			oEditor.InsertHtml(str);
		}
		else
		alert( 'You must be on WYSIWYG mode!' );
	}
	//document.getElementById('Content').innerhtml = "1111111111";
}
function InsertHTML(obj,Insertstr)
{
	var oEditor = FCKeditorAPI.GetInstance(obj) ;

	if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
	{
		oEditor.InsertHtml(Insertstr);
	}
	else
		alert( 'You must be on WYSIWYG mode!' ) ;
}
// 批量  删除 发布 推荐 评论 滚动 信息


function doButton(s,ac){
	List.action = "?ac="+ s +"&do=selectCommand&value="+ac; 
	List.submit();
}
/*清空 关键字*/
function clearKeyWord(){
	with (document.Article){
		keywords.value='';
		keywordsIDList.value='';
	}
}
/*清空 列表模版内容*/
function clearListTemplate(){
	with (document.form){
		ListTemplate.value='';
	}
}
/*清空 详细模版内容*/
function clearDetailTemplate(){
	with (document.form){
		DetailTemplate.value='';
	}
}
/*全选 编辑 信息
var flag=1;
function selectAll(){
    if(flag==1){
        if(List.chxID.length!=undefined){
            for (var i=0;i<List.chxID.length;i++)
            List.chxID[i].checked=true;
        }else{
            List.chxID.checked=true;
        }
    flag=0;
    }else{
        if(List.chxID.length!=undefined){
            for (var i=0;i<List.chxID.length;i++)
            List.chxID[i].checked=false;
        }else{
            List.chxID.checked=false;
        }
    flag=1;
    }
}*/
/***************客户端***************/
/**反选*/
function CheckOthers(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];

			if (e.checked==false)
			{
				e.checked = true;
			}
			else
			{
				e.checked = false;
			}
	}
}
/**全选*/
function CheckAll(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
			e.checked = true;
	}
}

/**折叠*/
function onChange(s){
//childSort=document.all("child" + i);
   if(s.style.display=="none"){
		  s.style.display="";}
   else{
		  s.style.display="none";}
}
