

function checkDate()
{
	var yyyy, mon, day;
	var newUrl;
	yyyy = document.all("yearfield").value;
	if(fucCheckNUM(yyyy) == 0 || yyyy < 1000 || yyyy > 9999)
	{
		alert("请输出四位数字表示的年！");
		return false;
	}
	mon = document.all("monfield").value;
	if(fucCheckNUM(mon) == 0 || mon >12 || mon <1)
	{
		alert("请输入正确的月份！");
		return false;
	}
	
	day = document.all("dayfield").value;
	if(fucCheckNUM(day) == 0 || day > 31 || day < 1)
	{
		alert("请输入正确的日期！");
		return false;
	}
	//由于总是计算有误，不加那个来算了
	//但只对于静态页面的算法
	
	 curUrl = window.location.href;
	 pos1=curUrl.indexOf("enp.web.Publish");
	 if(pos1<0)
	 {
		 hh = "/"+yyyy+"-";
		 if(mon.length < 2)
		 	hh += "0";
		 hh += mon + "/";
		 if(day.length < 2)
		 	hh+="0";
		 hh += day;
		 ///////////////////
		 pos1 = curUrl.lastIndexOf('/');
		 curFile = curUrl.substring(pos1);
		 pos1 = curUrl.lastIndexOf('/',pos1-1)
		 pos1 = curUrl.lastIndexOf('/',pos1-1)
		 curBase = curUrl.substring(0,pos1);
		 newUrl = curBase + hh + curFile;
	 
		 window.open(newUrl);
	}
	return false;
}


function fucCheckNUM(NUM)
{
	var i,j,strTemp;
	strTemp="0123456789";
	if ( NUM.length== 0)
		return 0
	for (i=0;i<NUM.length;i++)
	{
		j=strTemp.indexOf(NUM.charAt(i)); 
		if (j==-1)
		{
			//说明有字符不是数字
			return 0;
		}
	}
	//说明是数字
	return 1;
}


function nodeUrl(yy,mm,dd)
{
 	var hh;
	var pos1;
	var curBase,curUrl,curFile;
	
        curUrl = window.location.href;
	pos1=curUrl.indexOf("enp.web.Publish");
	if(pos1>0)
	{
		//对于动态页面的算法
	 	hh = yy+"-";
	        if(mm+1 < 10)
	        	hh += "0";
	        hh += (mm+1) + "-";
	        if(dd < 10)
	        	hh+="0";
	        hh += dd;
	        ///////////////////
	        pos1 = curUrl.indexOf("&date=");
			if(pos1 > 0)
			{
		        curBase = curUrl.substring(0,pos1);
				pos1 = curUrl.indexOf('&',pos1+1)
				if(pos1 >0 )
					curFile = curUrl.substring(pos1);
				else
					curFile = "";
			}
			else
			{
				curBase = curUrl;
				curFile = "";
			}
	        
		return curBase+"&date=" + hh+curFile;
	}
	else
	{
		//对于静态页面的算法
	 	hh = "/"+yy+"-";
	        if(mm+1 < 10)
	        	hh += "0";
	        hh += (mm+1) + "/";
	        if(dd < 10)
	        	hh+="0";
	        hh += dd;
	        ///////////////////
	        pos1 = curUrl.lastIndexOf('/');
	        curFile = curUrl.substring(pos1);
	        pos1 = curUrl.lastIndexOf('/',pos1-1)
	        pos1 = curUrl.lastIndexOf('/',pos1-1)
	        curBase = curUrl.substring(0,pos1);
	         
//		return curBase + hh + curFile;
		return curBase + hh + "/node_18.htm";
	}
}

function drawDateForCms()
{
	var gNum;
		
	for(i=0;i<6;i++) 
	{
		document.write('<tr align=center>');
		for(j=0;j<7;j++) 
		{
			gNum = i*7+j;
			document.write('<td  bgcolor="#CDCDA9" class="default" align=center id="GD' + gNum +'" style="cursor: default;" width="14%"><a href="" id="CD' + gNum + '"><span class="date" style="font-family:Verdana, Arial;font-size:11px;"><font _onMouseOver="mOvr(' + gNum +')" onMouseOut="mOut()" id="SD' + gNum +'" color=""'></font></span></a><br><font id="LD' + gNum + '" size=2 class=pt9 style=display:none></font></td>');
		}
		document.write('</tr>');
	}
}