function CheckDate(myfrm)
 {
  var vdate,vyear,vmonth,vday,vstr;
  vstr="0123456789";
  vdate=myfrm.value;
	if(vdate!=""){	 
	
	if(vdate.length!=8){	  
	
	alert("请输入标准八位长编码！");
	myfrm.focus();
	return false;		     
	}  

	if(vdate.length==8){	 
  	   
			for (var i=0; i < vdate.length; i++)
			{
				var letter = vdate.charAt(i).toLowerCase();
				if (vstr.indexOf(letter) != -1)
				continue;
				alert("日期含有无效字符: " + letter);
				myfrm.focus();
				return false;
				break;
			}	
			
			if(vdate.slice(4,6)>12 || vdate.slice(4,6)<1 || vdate.slice(6,8)>31 || vdate.slice(6,8)<1 || vdate.slice(0,4)<1840 || vdate.slice(0,4)>2106)
			{
				alert("日期不合法！");
				myfrm.focus();
				return false;		
			}

		}
	}
 } 
	//------------------------------------检查email---------------------------
	function CheckEmail(myfrm)
 {
  var vmail,vstr;
  vmail=myfrm.value;
  var vstr = /^(([\-\w]+)\.?)+@(([\-\w]+)\.?)+\.[a-zA-Z]{2,4}$/;
  if(vmail!=""){	  
	
		if(!vstr.test(vmail)){
		   alert("邮件地址无效!!!");
		   myfrm.focus();
		   return false;
		}
    }
 } 
	
 

function Open_NewWindow(URL,flag) //打开一个无菜单工具栏的新窗口
{ 
if (flag != "" && flag != undefined){if(ChkPurview(flag)=="1")	{	return false;	}}
var objNewWin; 
objNewWin = window.open(URL,"","fullscreen=0,toolbar=0,location=no,directories=0,status=1,menubar=0,scrollbars=1,resizable=yes,width=960,height=700,top=50,left=50")
objNewWin.focus(); 
} 

function Open_BdWindow(URL,swidth,sheight,flag) //打开一个无菜单工具栏的新窗口
{ 
	if (flag != "" && flag != undefined){if(ChkPurview(flag)=="1")	{	return false;	}}
	var objNewWin; 
	objNewWin = window.open(URL,"","fullscreen=0,toolbar=0,location=no,directories=0,status=1,menubar=0,scrollbars=1,resizable=yes,width="+swidth+",height="+sheight+",top=50,left=50")
	objNewWin.focus(); 
} 

function Open_BdWindow1(URL,swidth,sheight,flag) //打开一个无菜单工具栏的新窗口
{ 
	if (flag != "" && flag != undefined){if(ChkPurview(flag)=="1")	{	return false;	}}
	var objNewWin; 
	objNewWin = window.open(URL,"","fullscreen=0,toolbar=0,location=no,directories=0,status=1,menubar=0,scrollbars=1,resizable=yes,width="+swidth+",height="+sheight+",top=50,left=50")
	objNewWin.focus(); 
} 

function Open_BdWindow2(URL,swidth,sheight,l,t,flag) //打开一个无菜单工具栏的新窗口
{ 
	if (flag != "" && flag != undefined){if(ChkPurview(flag)=="1")	{	return false;	}}
	var objNewWin; 
	objNewWin = window.open(URL,"","fullscreen=0,toolbar=0,location=no,directories=0,status=1,menubar=0,scrollbars=0,resizable=yes,width="+swidth+",height="+sheight+",top="+t+",left="+l)
	objNewWin.focus(); 
} 
function Open_BdWindow3(URL,swidth,sheight,l,t,flag) //打开一个无菜单工具栏的新窗口,有滚动条
{
	if (flag != "" && flag != undefined){if(ChkPurview(flag)=="1")	{	return false;	}}	
	var objNewWin; 
	objNewWin = window.open(URL,"","fullscreen=0,toolbar=0,location=no,directories=0,status=1,menubar=0,scrollbars=1,resizable=no,width="+swidth+",height="+sheight+",top="+t+",left="+l)
	objNewWin.focus(); 
} 


//移动层
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='';
	  }
}//--------------end move div------

function sl(st){
	sl1=st.length;
	strLen=0;
	for(i=0;i<sl1;i++){
		if(st.charCodeAt(i)>255) strLen+=2;
	 else strLen++;
	}
	return strLen;
}

function CNullStr(nstr){//空值转换函数

	if(nstr == "null"||nstr == ""||nstr == "undefined"){
		return("");  
	}else{
		return(nstr);   
 
	}

}

function Get_Date(){//取标准八位日期
	var myDate = new Date();
	
    var vYear = myDate.getFullYear();  //获取完整的年份(4位,1970-????)
    var vMonth = myDate.getMonth();      //获取当前月份(0-11,0代表1月)	
	vMonth = vMonth += 1;	
    var vDay = myDate.getDate();      //获取当前日(1-31)	
	if(vMonth < 10){vMonth = "0" + vMonth;	}	
	if(vDay < 10){vDay = "0" + vDay;	}	
	var newDate = vYear + "" + vMonth + "" + vDay;
	return newDate;
	
}

function GetRadioValue1(name,ctlsl)//取单选按钮radio的值,改良版，加一参数，指定控件数量
{ 
      var r = document.getElementsByName(name); 
      for (i=0;i<ctlsl;i++)
      {
         if (r[i].checked) { return r[i].value; } 
       }
}

function ChangeNum(num)
	{
	if (isNaN(num)==true | num == ""){		
		return false;}
	if(num<0 || num==0){return num;}
	else{
		for (i=0;i<num.length;i++){
			if(num.substring(i,i+1)!=0){
				return num.substring(i,num.length);
				num = null;
				return false;	
				}				
			else{}
			}
		}
	}

function FillZero(num,n)
{	var str = String(num)
	var m = n-str.length;
	if(str.length < n) {for(i=0;i<m;i++){str = "0"+str;}return str;} 
	else{return Number(str);}
}

function GetRandom(n)
{
	m = Math.pow(10,n)-1;
	num1 = FillZero(parseInt(m*Math.random()),n);
	num2 = FillZero(parseInt(m*Math.random()),n);
	num = String(num1*num2);
	num = num.substring(num.length,num.length-n);
	return num
}

function MakeNum()
{
	var c = ""
	var todayDate = new Date();
	var date = String(FillZero(todayDate.getDate(),2));
	var month = String(FillZero(todayDate.getMonth() +1,2));
	var year = String(todayDate.getYear());
	var hours = String(FillZero(todayDate.getHours(),2));
	var minutes = String(FillZero(todayDate.getMinutes(),2));
	var seconds = String(FillZero(todayDate.getSeconds(),2));  
	return (year+month+date+hours+minutes+seconds+GetRandom(6))
}

function GetAjax(a){
	var request;
	try {
		request = new XMLHttpRequest();
	} 
	catch (trymicrosoft) {
		try {
			request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (othermicrosoft) {
			try {
				request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (failed) {
				request = false;
			}
		}
	}	
	if (!request){alert("Error initializing XMLHttpRequest!");}
	else{
		request.open("POST",a.a1,true);	
		//request.setrequestheader("content-length",str.length);
		request.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
		request.onreadystatechange = function(){
			if (request.readyState == 4){
				if (request.status == 200){				
					//unLoading();
					if(a.a3)a.a3(unescape(request.responseText));						
				}
				else if (request.status == 404){if(a.a3)a.a3(unescape("Request URL does not exist"));	}
				else {if(a.a3)a.a3(unescape("Error: status code is " + request.status));}
				request = null;
			}		
		}
		request.send(a.a2);		
	}	
}
/*-------------------------播放器-------------------------------*/


//播放
function play()
{
 if (player.controls.isavailable('play'))
 {
  player.controls.play();
 }
}

//暂停
function pause()
{
 if (player.controls.isavailable('pause'))
 {
  player.controls.pause();
 }
}

//停止
function stop()
{
 if (player.controls.isavailable('stop'))
 {
  player.controls.stop();
 }
}

//前首
function previous()
{
 if (player.controls.isavailable( 'previous' ))
 {
  player.controls.previous();
 }
}

//后首
function next()
{
 if (player.controls.isavailable( 'next' ))
 {
  player.controls.next();
 }
}

//？
function step()
{
 if (player.controls.isavailable( 'step' ))
 player.controls.step( 1 );
}
/*-------------------------播放器end-------------------------------*/
/*-------------------------png透明-------------------------------*/
function fixPng() {
  var arVersion = navigator.appVersion.split("MSIE")
  var version = parseFloat(arVersion[1])

  if ((version >= 5.5 && version < 7.0) && (document.body.filters)) {
    for(var i=0; i<document.images.length; i++) {
      var img = document.images[i];
      var imgName = img.src.toUpperCase();
      if (imgName.indexOf(".PNG") > 0) {
        var width = img.width;
        var height = img.height;
        var sizingMethod = (img.className.toLowerCase().indexOf("scale") >= 0)? "scale" : "image"; 
        img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + img.src.replace('%23', '%2523').replace("'", "%27") + "', sizingMethod='" + sizingMethod + "')";
        img.src = "images/blank.gif";
        img.width = width;
        img.height = height;
        }
      }
    }
  }
  /*-------------------------png透明-------------------------------*/

