function killerr() {return true}  
window.onerror=killerr 

function oCopy(str)
{
var clipBoardContent=str;
window.clipboardData.setData("Text",clipBoardContent);
alert("代码复制成功，代码内容为：\n\n"+str+"\n\n您可以将此代码粘贴到您想插入本内容的位置");
}

/*生成html*/
function Cre(i){
  if(i.style.display == "none"){
    i.style.display="";
  }else{
    i.style.display="none";
  }
}

/*采集*/
function Gather(i,a){
  if(i.style.display == "none"){
    i.style.display="";
    a.style.display="";
  }else{
    i.style.display="none";
    a.style.display="none";
  }
}

//选取所有
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }

//设定图片显示尺寸
var flag=false; 
function DrawImage(ImgD,w,h){ 
var image=new Image(); 
image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
flag=true; 
if(image.width/image.height>= w/h){ 
if(image.width>w){ 
ImgD.width=w; 
ImgD.height=(image.height*w)/image.width; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
/*ImgD.alt=image.width+"×"+image.height;*/ 
} 
else{ 
if(image.height>h){ 
ImgD.height=h; 
ImgD.width=(image.width*h)/image.height; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
/*ImgD.alt=image.width+"×"+image.height;*/ 
} 
} 
/*else{ 
ImgD.src=""; 
ImgD.alt="" 
}*/ 
} 

function statusmove(str){
self.status = str;
}
function statusover(){
self.status = '';
}

function show(i,n,t){     
if (i.style.display == "none") {     
		i.style.display = "";
		n.style.display = "";
		t.style.background = "url('img/Menu_BG.gif')";
	}else{     
		i.style.display = "none";
		n.style.display = "none";
		t.style.background = "url('img/Menu_BG1.gif')";
	}     
}	     

function TopType(){
if(Top.style.display == ""){
Top.style.display = "none";
TopPic.src="img/p_5.gif"
}else{
Top.style.display = "";
TopPic.src="img/p_6.gif"
}
}

function MenuType(){
if(menu.style.display == ""){
menukey.innerHTML = ">> 显示菜单";
menu.style.display = "none";
}else{
menukey.innerHTML = "<< 隐藏菜单";
menu.style.display = "";
}
}

/*文章新闻添加*/
function WM_LinkCheck(){
  if(document.NewsForm.WM_UseLinkUrl.checked==true){
    document.NewsForm.WM_LinkUrl.disabled=false;
     ArticleContent.style.display='none';
     ArticleContent1.style.display='none';
  }
  else{
    document.NewsForm.WM_LinkUrl.disabled=true;
    ArticleContent.style.display='';
    ArticleContent1.style.display='';
  }
}

//新闻添加
function doChange(objText, objDrop){
	if (!objDrop) return;
	var str = objText.value;
	var arr = str.split("|");
	objDrop.length=0;
	for (var i=0; i<arr.length; i++){
	objDrop.options[i] = new Option(arr[i], arr[i]);
	PicUrl=objDrop.options[i].value;
	}
	document.NewsForm.WM_DefaultPicUrl.value = PicUrl;
	NewsForm.WM_PicPreview.src = PicUrl;
	NewsForm.WM_PicPreview.alt = PicUrl;
}

//菜单书签
function menudis(tit,show,font,num){
  for(g=1;g<=num;g++){
	document.all("show"+g).style.display="none";
	document.all("tit"+g).className="mLabel";
	document.all("titfont"+g).className="mLabeltit";
  }
  if(tit.style.display=="none"){
	show.style.display="none";
	tit.className="mLabel";
	font.className="mLabeltit";
	}
	else{
	show.style.display="";
	tit.className="mLabel1";
	font.className="mLabeltit1";
	}
}

//后台书签
function dis(tit,show,num,pic){
  for(g=1;g<=num;g++){
	document.all("tit"+g).background="Img/"+pic+"_1.gif";
	document.all("show"+g).style.display="none";
	document.all("tit"+g).className="Label";
  }
  if(tit.style.display=="none"){
    tit.background="Img/"+pic+"_1.gif";
	show.style.display="none";
	tit.className="Label";
	}
	else{
	tit.background="Img/"+pic+".gif";
	show.style.display="";
	tit.className="Label1";
	}
}

//System_Templates.asp
function temp(i,n){     
if (n.style.display == "none") {     
		i.src = "img/-.gif";
		n.style.display = "";
	}else{     
		i.src = "img/+.gif";
		n.style.display = "none";
	}     
}	     

// 显示无模式对话框
function ShowDialog(url, width, height) {
	var arr = showModalDialog(url, window, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");
}

function preview() /* Preview for the "Compilation" */
	{
		if(document.NewsForm.HtmlCode.value.length>0)
			{
				pr=window.open("","Preview","scrollbars=1,width=800,height=500");
				pr.document.write(document.NewsForm.HtmlCode.value);
			}
		else alert('无任何内容可供预览!')
}

//添加广告表单
function ads(i){
  switch(i){
    case "text":
      ad1.style.display = "none";
      ad2.style.display = "";
      ad3.style.display = "";
      ad4.style.display = "none";
      ad5.style.display = "";
      ad6.style.display = "none";
	  break;
    case "pic":
      ad1.style.display = "";
      ad2.style.display = "none";
      ad3.style.display = "";
      ad4.style.display = "";
      ad5.style.display = "";
      ad6.style.display = "none";
	  break;
    case "swf":
      ad1.style.display = "";
      ad2.style.display = "none";
      ad3.style.display = "none";
      ad4.style.display = "";
      ad5.style.display = "none";
      ad6.style.display = "none";
	  break;
    case "code":
      ad1.style.display = "none";
      ad2.style.display = "none";
      ad3.style.display = "none";
      ad4.style.display = "none";
      ad5.style.display = "none";
      ad6.style.display = "";
	  break;
  }
}

//添加频道
function Channel_Show(){     
		Channel.style.display = "";
}	     
function Channel_Close(){     
		Channel.style.display = "none"; 
}	

function Keyword(addKeyword) { 
var revisedTitle; 
var currentTitle = document.NewsForm.WM_Keyword.value; 
if (addKeyword!=""){
if (currentTitle==""){
revisedTitle = addKeyword; 
}else{
revisedTitle = addKeyword+","+currentTitle; 
}
}else{
revisedTitle="";
}
document.NewsForm.WM_Keyword.value=revisedTitle; 
}

/*标签添加输出格式选择*/
function Label(i){
  switch(i){
    case "1":
      table.style.display = "none";
      div.style.display = "none";
	  break;
    case "2":
      table.style.display = "";
      div.style.display = "none";
	  break;
    case "3":
      table.style.display = "none";
      div.style.display = "";
	  break;
  }
}

/*标签添加输出格式选择*/
function Label2(i){
  switch(i){
    case "1":
      table1.style.display = "";
      div1.style.display = "none";
      table2.style.display = "";
      div2.style.display = "none";
	  break;
    case "2":
      table1.style.display = "none";
      div1.style.display = "";
      table2.style.display = "none";
      div2.style.display = "";
	  break;
  }
}

//居中打开窗口
function openwindow( url, winName, width, height) {
xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 )){
xposition = (screen.width - width) / 2;
yposition = (screen.height - height) / 2;}
theproperty= "width=" + width + "," 
+ "height=" + height + "," 
+ "location=0," 
+ "menubar=0,"
+ "resizable=1,"
+ "scrollbars=0,"
+ "status=0," 
+ "titlebar=0,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + "," //仅适用于Netscape
+ "screeny=" + yposition + "," //仅适用于Netscape
+ "left=" + xposition + "," //IE
+ "top=" + yposition; //IE 
window.open( url,winName,theproperty );
}

function ShowTimingType(num){ 
   switch(num){
     case "0":     
        document.NewsForm.WeekDay.style.display='none';
        break;
     case "1":     
        document.NewsForm.WeekDay.style.display='';
        break;
     default:
        alert("错误参数调用！");
        break;
    }
}

//ajax提示框功能
var Obj=''
document.onmouseup=MUp
document.onmousemove=MMove

function MDown(Object){
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}

function MMove(){
if(Obj!=''){
  document.all(Obj).style.left=event.x-pX;
  document.all(Obj).style.top=event.y-pY;
  }
}

function MUp(){
if(Obj!=''){
  document.all(Obj).releaseCapture();
  Obj='';
  }
}

//上传完成后返回参数处理
function upback(Spic,str){
  if(str!=""){
	 // alert('<IMG SRC=' + str + ' onload=\"DrawImage(this, 500, 500)\">');
  eWebEditor1.appendHTML('<IMG SRC=' + str + ' onload=\"DrawImage(this, 500, 500)\">');
  if(Spic!=""){
      document.NewsForm.DefaultPic.value = Spic;
      Add(Spic);
      PicPreview.innerHTML = "<Img src="+Spic+" onload=\'DrawImage(this, 118, 118);\'>";
    }else{
      document.NewsForm.DefaultPic.value = str;
      Add(str);
      PicPreview.innerHTML = "<Img src="+str+" onload=\'DrawImage(this, 118, 118);\'>";
    }
  }
  closeWithIframe();
}

//上传完成后返回参数处理
function UpBackPic(Spic){
  if(Spic!=""){
	  //alert('<IMG SRC=' + Spic + ' onload=\"DrawImage(this, 500, 500)\">');
	  eWebEditor1.appendHTML('<IMG SRC=' + Spic + ' onload=\"DrawImage(this, 500, 500)\">');
      document.NewsForm.DefaultPic.value = Spic;
      Add(Spic);
      PicPreview.innerHTML = "<Img src="+Spic+" onload=\'DrawImage(this, 118, 118);\'>";
    
  }
  //closeWithIframe();
}

function Add(str) {
	var sel2=document.NewsForm.PicSelect;
	sel2.options[sel2.length]=new Option(str,str);
	sel2.selectedIndex = sel2.length-1;
}

function PicReset(str){
document.NewsForm.DefaultPic.value = str;
if (str == ""){
PicPreview.innerHTML = "<Img src=../Images/nopic.gif onload=\'DrawImage(this, 118, 118);\'>";
}else{
PicPreview.innerHTML = "<Img src="+str+" onload=\'DrawImage(this, 118, 118);\'>";
}
}

//用户头像回传操作
function upother(str){
  document.NewsForm.DefaultPic.value = str;
  document.images['PicShow'].src=str;
  closeWithIframe();
}

//广告图片回传操作
function upad(str){
  document.NewsForm.DefaultPic.value = str;
  closeWithIframe();
}

function sift(){
  if (NewsForm.c.value !=""){
    if (NewsForm.c.value == "|||"){
	  NewsForm.c.value = "";
      NewsForm.c.focus();
      alert('条件不能为“|||”');
	}else{
      var sift;
      var siftv = NewsForm.e5.value;
      sift = NewsForm.a.children[NewsForm.a.selectedIndex].text + '|||' + NewsForm.b.children[NewsForm.b.selectedIndex].text + '|||'  + NewsForm.c.value;
      if(siftv.indexOf(sift)!=-1){
	    alert('此过滤器规则在下面列表中已存在');
	    NewsForm.c.focus();
	    return false;
	  }
	  if (siftv!=""){
	    NewsForm.e5.value =  NewsForm.e5.value+'\n'+sift;
	  }else{
	    NewsForm.e5.value =  sift;
	  }
	  NewsForm.c.value = "";
	  NewsForm.c.focus();
	}
  }else{
    NewsForm.c.focus();
    alert('条件不完整');
  }
}

/*打开选项控制示例*/
var Skey
Skey=0;
function Select(){
  if(Skey==0){
    Skey=1;
    SelectPic.style.display="";
  }else{
    Skey=0;
    SelectPic.style.display="none";
  }
}

//ajax提示框========================================
function openWithIframe(tit,url,w,h){
	var sWidth,sHeight;
	sWidth=document.body.clientWidth;
	sHeight=document.body.scrollHeight;
	var bgObj=document.createElement("div");
	bgObj.setAttribute('id','bgDiv');
	bgObj.style.position="absolute";
	bgObj.style.top="0";
	bgObj.style.background="#000000";
	bgObj.style.filter="Alpha(Opacity=30);";
	bgObj.style.left="0";
	bgObj.style.width=sWidth + "px";
	bgObj.style.height=sHeight + "px";
	bgObj.style.zIndex = "10000";
    document.body.appendChild(bgObj);

    massage_box.style.left = (document.body.clientWidth - w) / 2;
    massage_box.style.top = (document.body.clientHeight - h) / 2;
    massage_box.style.screenx = (document.body.clientWidth - w) / 2;//仅适用于Netscape
    massage_box.style.screeny = (document.body.clientHeight - h) / 2;//仅适用于Netscape
    massage_box.style.width = w+"px";
    massage_box.style.height = h+"px";
    pop_title.innerHTML=tit;
    massage_box.style.display=''
    var popiframe='<iframe src="'+url+'" width="'+(w-11)+'px"  height="'+(h-36)+'px" frameborder=0 scrolling=no></iframe>';
    pop_iframe.innerHTML=popiframe;
}
function closeWithIframe(){
    massage_box.style.display="none";
    document.body.removeChild(document.getElementById("bgDiv"));
}
document.write('<div id="massage_box" style="position:absolute; FILTER: progid:DXImageTransform.Microsoft.DropShadow();z-index:10001;display:none">');
document.write('<div style="border-width:1 1 3 1; width:100%; height:100%; background:#fff; color:#666666; font-size:12px; line-height:150%">');
document.write('<div onmousedown=MDown(massage_box) style="background:#666666; height:20px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;color:#fff;cursor:move;padding:0 0 4px 0">');
document.write('<div style="display:inline; width:200px; position:absolute;padding:3px 0 0 5px" id=pop_title></div>');
document.write('<span onClick="closeWithIframe()" style="float:right; display:inline; cursor:hand;padding:3px 5px 0 0;font-size:12px">关闭</span>');
document.write('</div>');
document.write('<div style="padding:5px" id=pop_iframe></div>');
document.write('</div>');
document.write('</div>');
//ajax提示框功能========================================
function InitAjax(){
var ajax=false; 
try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); } 
catch (e) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { ajax = false; } }
if (!ajax && typeof XMLHttpRequest!='undefined') { ajax = new XMLHttpRequest(); } 
return ajax;}

//公用ajax
function ToAjax(url,Post){
	if (url!=""){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST", url, true); 
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=GB2312"); 
		ajax.send(Post);
	    ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;}
	      AjaxShow.innerHTML = getinfo;
		  }
	}
}

