function check()
{
if(document.form1.N_title.value=="")
{
alert("请输入文章标题!");
document.form1.N_title.focus();
return false;
}
if(document.form1.N_sid.value=="文章类别")
{
alert("请选择文章类别!");
return false;
}
}
function checks()
{
if(confirm("确定要删除选中的记录，删除后不可恢复！"))	
{
	document.form3.action.value='del';
	document.form3.submit();		
}
return false;
}
function show()
{
if (document.getElementById("N_homepic").checked==true)
{document.getElementById("N_pic").style.display="block";}
else
{document.getElementById("N_pic").style.display="none";}
}

function opw(url,name,width,height) 
{
window.open(url,name,''+'width='+width+',height='+height+',scrollbars=yes'+'');
}
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;
}
}

function insertText(stext,sinput,snum)
{
stext1=eval("document.form1."+sinput+".value");
if (snum==1)
{	
	if (stext==0 & stext != "")
	{
		eval("document.form1."+sinput+".value=''");
	}
	else
	{
		if (stext != "")
		{
			//判断选中的值是否已经存在
			if (stext1.indexOf(stext)==-1)
			{	
				if (stext1=="")
				{
				eval("document.form1."+sinput+".value='"+stext+"'")
				}
				else
				{
					eval("document.form1."+sinput+".value='"+stext1+","+stext+"'")
				}
			}
		}
	}
}
else
{
	if (stext==0 & stext != "")
	{
		eval("document.form1."+sinput+".value=''");
		document.form1.N_fromurl.value="";
	}
	else
	{
		stext2=document.form1.N_fromurl.value;
		if (stext != "")
		{
			//判断选中的值是否已经存在
			if (stext1.indexOf(snum)==-1)
			{	
				if (stext1=="")
				{
				eval("document.form1."+sinput+".value='"+snum+"'");
				document.form1.N_fromurl.value=stext;
				}
				else
				{
					eval("document.form1."+sinput+".value='"+stext1+","+snum+"'");
					document.form1.N_fromurl.value=stext2+","+stext;
				}
			}
		}
	}
}
}
//显示窗口
function showModal(url,width,height)
{
	try
	{
		window.showModalDialog(url+"&Rnd="+Math.random(),window,'dialogHeight:'+height+' px; dialogWidth:'+width+' px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: No; status: No; scroll:Yes');
	}
	catch(e){}	
}

function Check_NewsOptions(optionid)
{
	if(document.getElementById("news_option"+optionid).checked==true)
	{
		style="";
	}
	else
	{
		style="none";
	}
	document.getElementById("news_Options_td"+optionid).style.display=style;
	if(optionid==3)
	{
		if(document.getElementById("news_Option3").checked==false)
		{
			style="";
		}
		else
		{
			style="none";
		}
		document.getElementById("news_Options_td10").style.display=style;
		document.getElementById("news_Options_td11").style.display=style;
	}
}

//检测标题是否重复
function CheckNewsTitle()
{
Ntitle=this.form1.N_title.value;
var xmlhttp;
try
{
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{ 
try
{
xmlhttp=new XMLHttpRequest();
}
catch (e)
{
}
}
}
if (Ntitle=="")
{
msg="文章标题不能为空！";
alert(msg);
return false;
}

//创建请求，并使用escape对email编码，以避免乱码
xmlhttp.open("get","checktitle.asp?title="+escape(Ntitle)+ "&t=" + new Date().getTime());
xmlhttp.onreadystatechange=function()
{
if(4==xmlhttp.readyState)
{
if(200==xmlhttp.status)
{
	msg=xmlhttp.responseText;
}
else
{
msg="网络链接失败";
}
alert(msg); 
}
}
xmlhttp.send(null); 
return false;
}