if(!Prototype.Browser.IE){
	//alert("请使用Internet Explorer 浏览器!");
}
var buffalo=new Buffalo(endPoint+"/bsteel");
var alert_t=true;
function myloading(state){
	if(state){
		window.status="加载中...";
	}else{
		window.status="加载完成";
	}
}
buffalo.events["onLoading"]=myloading;
function myException(fault){
	if(fault.code=="com.bsteel.system.exception.RequiredLoginException"){
		if(alert_t){
			alert_t=false;
			alert("请先登录！");
			window.location.href=endPoint;
		}
	}
}
buffalo.events["onException"]=myException;

function myError(state){
	if(state){
		window.status="页面错误...";
	}else{
		window.status="页面错误..";
	}
}
buffalo.events["onError"]=myException;

function myTimeout(state){
	if(state){
		window.status="页面超时...";
	}else{
		window.status="页面超时..";
	}
}
buffalo.events["onTimeout"]=myTimeout;
function getAbsoluteHeight(ob){
	return ob.offsetHeight
}
function getAbsoluteWidth(ob){
	return ob.offsetWidth
}
function getAbsoluteLeft(ob){
	var s_el=0;
	el=ob;
	while(el){
		s_el=s_el+el.offsetLeft;
		el=el.offsetParent;
	}
	;
	return s_el
}
function getAbsoluteTop(ob){
	var s_el=0;
	el=ob;
	while(el){
		s_el=s_el+el.offsetTop;
		el=el.offsetParent;
	}
	;
	return s_el
}
function $N(){
	return document.getElementsByName(arguments[0]);
}
function $T(){ // $T('input','box')
	if(arguments.length==1){
		return document.getElementsByTagName(arguments[0]);
	}else if(arguments.length==2){
		if(typeof(arguments[1])=="object"){
			return arguments[1].getElementsByTagName(arguments[0]);
		}else{
			return $(arguments[1]).getElementsByTagName(arguments[0]);
		}
	}
}


function FloatDiv(arg1,arg2){    
	var t1=0,t2=0,r1,r2;    
	try{t1=arg1.toString().split(".")[1].length}catch(e){}    
	try{t2=arg2.toString().split(".")[1].length}catch(e){}    
	with(Math){    
		r1=Number(arg1.toString().replace(".",""))    
		r2=Number(arg2.toString().replace(".",""))    
		return (r1/r2)*pow(10,t2-t1);    
	}    
} 
function FloatAdd(arg1,arg2){   
	var r1,r2,m;   
	try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}   
	try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}   
	m=Math.pow(10,Math.max(r1,r2))   
	return (arg1*m+arg2*m)/m   
}
function FloatMul(arg1,arg2){    
  	var m=0,s1=arg1.toString(),s2=arg2.toString();    
  	try{m+=s1.split(".")[1].length}catch(e){}    
  	try{m+=s2.split(".")[1].length}catch(e){}    
  	return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)    
 }
var sWindowPup=null;
function showWzmsDiv(obj,gg,wzstr1,wzstr2,zyh){
	var str="<table><tr><td><b>规&nbsp;&nbsp;&nbsp;</b>&nbsp;<b>格:</b></td><td>"+gg+"</td></tr>"
						+"<tr><td><b>质量等级:</b></td><td>"+wzstr1+"</td></tr>"
						+"<tr><td><b>执行标准:</b></td><td>"+wzstr2+"</td></tr>"
						+"<tr><td><b>资&nbsp;源&nbsp;号:</b></td><td>"+zyh+"</td></tr>"
						+"</table>";
	sWindow(obj,str,'200px')
}

// 网点begin
// 最大时改变iframe的高度为最大
function dyniframesize(iframename) {
	var getFFVersion = navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
	var FFextraHeight = getFFVersion >= 0.1 ? 16 : 0;
	var pTar = null;
	if (document.getElementById) {
		pTar = document.getElementById(iframename);
	} else {
		eval('pTar = ' + iframename + ';');
	}
	if (pTar && !window.opera) {
		pTar.style.display = "block"
		if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight) {
			pTar.height = pTar.contentDocument.body.offsetHeight+ FFextraHeight;
		} else if (pTar.Document && pTar.Document.body.scrollHeight) {
			pTar.height = pTar.Document.body.scrollHeight;
		}
	}
}
//网点end

function showhzDiv(obj,str){
	sWindow(obj,str,'300px')
}
function sWindow(obj,str,widthstr){
	this.sWindowPup=$("s_window_pup");
	if(this.oProgressLayer==null){
		var el=document.createElement('DIV');
		el.setAttribute("id","s_window_pup");
		with (el.style){
			width=widthstr;
			height='100px';
			position='absolute';
			left=getAbsoluteLeft(obj) + getAbsoluteWidth(obj);
			top=getAbsoluteHeight(obj)+ getAbsoluteTop(obj);
			backgroundColor='#ffff99';//'buttonFace';
			borderLeft='solid 1px silver';
			borderTop='solid 1px silver';
			borderRight='solid 1px gray';
			borderBottom='solid 1px gray';
			fontWeight='600';
			fontSize='13px';
			opacity='0.5';
			filter='alpha(opacity=100)';
			zIndex='299999';
			color='#000000';			
		}
		el.innerHTML=str;
		document.body.appendChild(el);
		this.sWindowPup=el;
	}else{
		this.sWindowPup.style.display="block";
	}
}
function CloseDiv(){
	if(sWindowPup){
		sWindowPup.style.display="none";
		sWindowPup.removeNode(true);
		sWindowPup=null;
	}
}
function doSelectAll(str,obj){
	$A($N(str)).each(function(node){
		if(obj.checked){
			node.checked=true;
		}else{
			node.checked=false;
		}
	});
}
function doUnSelectAll(str){
	$A($N(str)).each(function(node){
		if(node.checked){
			node.checked=false;
		}else{
			node.checked=true;
		}
	});
}
function doMsg(){
	$("msg").style.cssText="color:red;font-size:8pt";
	window.setTimeout('$("msg").style.cssText="display:none"',3000);
}
function RTrim(_str){
	var whitespace=new String(" \t\n\r");
	var s=new String(_str);
	if(whitespace.indexOf(s.charAt(s.length-1))!=-1){
		var i=s.length-1;
		while(i>=0&&whitespace.indexOf(s.charAt(i))!=-1){
			i--;
		}
		s=s.substring(0,i+1);
	}
	return s.toString();
}
/*******************************************************************************
 * // 设置网页上所有元素为不可响应事件，以及设置鼠标光标为wait
 ******************************************************************************/
function SetBusy(){
	$A($N('button_name')).each(function(node){
		try{
			node.style.oldCursor=node.style.cursor;
			node.style.cursor='wait';			
		}catch(e){
		}
		node.disabled=true;
	});
}
/*******************************************************************************
 * // 恢复网页上所有元素可以响应事件，以及设置鼠标光标默认光标
 ******************************************************************************/
function ReleaseBusy(){
	$A($N('button_name')).each(function(node){
		node.disabled=false;
		try{
			node.style.cursor="pointer";
		}catch(e){
		}
	});
}
var oProgressLayer=null;
/*******************************************************************************
 * // 关闭“正在处理"对话框
 ******************************************************************************/
function HideProgressInfo(t){
	if(oProgressLayer){
		if(t){
			//ReleaseBusy();
		}
		oProgressLayer.style.display="none";
		oProgressLayer=null;
	}
}
/*******************************************************************************
 * // 显示“正在处理”对话框 进度条样式
 ******************************************************************************/
function ShowProgressInfo(message,t){
	if(t){
		//SetBusy();
	}
	HideProgressInfo(true);
	this.oProgressLayer=$("jyzx_loading");
	if(this.oProgressLayer==null){
		var el=document.createElement('DIV');
		el.setAttribute("id","jyzx_loading");
		with (el.style){
			width='180px';
			height='50px';
			position='absolute';
			left=(document.body.clientWidth-180)>>1;
			top=(document.body.clientHeight-50)>>1;
			backgroundColor='buttonFace';
			borderLeft='solid 1px silver';
			borderTop='solid 1px silver';
			borderRight='solid 1px gray';
			borderBottom='solid 1px gray';
			fontWeight='700';
			fontSize='13px';
			zIndex='1999';
		}
		el.innerHTML='<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%"><tr><td align="center" valign="middle">'
				+message
				+'<br/><span style="border:solid 1px black;padding:1px;height:14px;margin-top:5px;">'
				+'<span style="width:150px;height:12px;border:none;padding:-1px;overflow:hidden;">'
				+'<marquee style="width:150px;" direction="right" scrollamount="10">'
				+'<span style="padding:1px;text-align:right;width:130px;height:10px;background-color:#0000A0;filter:Alpha(startX=0,startY=0, finishX=130, finishY=0,style=1,opacity=0,finishOpacity=100);">'
				+'</span></marquee></span></span>';
		document.body.appendChild(el);
		this.oProgressLayer=el;
	}else{
		this.oProgressLayer.style.display="block";
	}
}
function ms_dispnav(){
	if(arguments.length<2) return;
	var tell=arguments[0];
	for(var i=1;i<arguments.length;i++){
		var nav=document.getElementById(arguments[i]+"_nav");
		var content=document.getElementById(arguments[i]+"_content");
		if(!nav|!content) continue;
		if(tell==i){
			nav.className=i==arguments.length-1?"active end":"active";
			content.style.display="";
		}else{
			nav.className=i==arguments.length-1?"normal end":"normal";
			content.style.display="none";
		}
	}
}
function submitPageForm(formName,pageNo,pageSize){
	var frm=document.getElementsByName(formName)[0];
	var elmPageNo;
	if(typeof(frm.baosteel_page_no)=='undefined'){
		elmPageNo=document.createElement("<input type='hidden' name='baosteel_page_no' />");
	}else{
		elmPageNo=frm.baosteel_page_no;
	}
	var elmPageSize;
	if(typeof(frm.baosteel_page_size)=='undefined'){
		elmPageSize=document.createElement("<input type='hidden' name='baosteel_page_size' />");
	}else{
		elmPageSize=frm.baosteel_page_size;
	}
	elmPageNo.value=pageNo;
	elmPageSize.value=pageSize;
	frm.appendChild(elmPageNo);
	frm.appendChild(elmPageSize);
	frm.submit();
}

// 当前日期
function getNowDate(){
	var nn=new Date();
	year1=nn.getYear();
	mon1=nn.getMonth()+1;
	date1=nn.getDate();
	var monstr1;
	var datestr1
	if(mon1<10){
		monstr1="0"+mon1;
	}else{
		monstr1=""+mon1;
	}
	if(date1<10){
		datestr1="0"+date1;
	}else{
		datestr1=""+date1;
	}
	return year1+monstr1+datestr1;
}
// 目标日期
function getlastweekDate(){
	var nn=new Date();
	year1=nn.getYear();
	mon1=nn.getMonth()+1;
	date1=nn.getDate();

	var mm=new Date(year1,mon1-1,date1);
	var tmp1=new Date(2000,1,1);
	var tmp2=new Date(2000,1,15);
	var ne=tmp2-tmp1;
	var mm2=new Date();
	mm2.setTime(mm.getTime()-ne);

	year2=mm2.getYear();
	mon2=mm2.getMonth()+1;
	date2=mm2.getDate();

	if(mon2<10){
		monstr2="0"+mon2;
	}else{
		monstr2=""+mon2;
	}
	if(date2<10){
		datestr2="0"+date2;
	}else{
		datestr2=""+date2;
	}
	return year2+monstr2+datestr2;
}

var gdCtrl=new Object();
var goSelectTag=new Array();
var gcGray="#808080";
var gcToggle="#f7f7f7";
var gcBG="#efeff7";
var previousObject=null;
var sDateTextSize="9pt"

var gdCurDate=new Date();
var giYear=gdCurDate.getFullYear();
var giMonth=gdCurDate.getMonth()+1;
var giDay=gdCurDate.getDate();

function fSetDate(iYear,iMonth,iDay){
	VicPopCal.style.visibility="hidden";
	if((iYear==0)&&(iMonth==0)&&(iDay==0)){
		gdCtrl.value="";
	}else{
		iMonth=iMonth+100+"";
		iMonth=iMonth.substring(1);
		iDay=iDay+100+"";
		iDay=iDay.substring(1);
		if(gdCtrl.tagName=="INPUT"){
			gdCtrl.value=iYear+iMonth+iDay;
		}else{
			gdCtrl.innerText=iYear+iMonth+iDay;
		}
	}
	for(var i=0;i<goSelectTag.length;i++){
		goSelectTag[i].style.visibility="visible";
	}
	goSelectTag.length=0;
	window.returnValue=gdCtrl.value;
}

function HiddenDiv(){
	VicPopCal.style.visibility="hidden";
	for(var i=0;i<goSelectTag.length;i++){
		goSelectTag[i].style.visibility="visible";
	}
	goSelectTag.length=0;

}
function fSetSelected(aCell){
	var iOffset=0;
	var iYear=parseInt(tbSelYear.value);
	var iMonth=parseInt(tbSelMonth.value);

	aCell.bgColor=gcBG;
	with (aCell.children["cellText"]){
		var iDay=parseInt(innerText);
		if(color==gcGray)
			iOffset=(Victor<10)?-1:1;
		iMonth+=iOffset;
		if(iMonth<1){
			iYear--;
			iMonth=12;
		}else if(iMonth>12){
			iYear++;
			iMonth=1;
		}
	}
	fSetDate(iYear,iMonth,iDay);
}

function Point(iX,iY){
	this.x=iX;
	this.y=iY;
}

function fBuildCal(iYear,iMonth){
	var aMonth=new Array();
	for(i=1;i<7;i++)
		aMonth[i]=new Array(i);

	var dCalDate=new Date(iYear,iMonth-1,1);
	var iDayOfFirst=dCalDate.getDay();
	var iDaysInMonth=new Date(iYear,iMonth,0).getDate();
	var iOffsetLast=new Date(iYear,iMonth-1,0).getDate()-iDayOfFirst+1;
	var iDate=1;
	var iNext=1;

	for(d=0;d<7;d++)
		aMonth[1][d]=(d<iDayOfFirst)?-(iOffsetLast+d):iDate++;
	for(w=2;w<7;w++)
		for(d=0;d<7;d++)
			aMonth[w][d]=(iDate<=iDaysInMonth)?iDate++:-(iNext++);
	return aMonth;
}

function fDrawCal(iYear,iMonth,iCellHeight,sDateTextSize){
	var WeekDay=new Array("日","一","二","三","四","五","六");
	var styleTD=" bgcolor='"+gcBG+"' bordercolor='"+gcBG+"' valign='middle' align='center' height='"+iCellHeight+"' style='font:arial "+sDateTextSize
			+";";

	with (document){
		write("<tr>");
		for(i=0;i<7;i++){
			write("<td "+styleTD+"color:maroon' >"+WeekDay[i]+"</td>");
		}
		write("</tr>");

		for(w=1;w<7;w++){
			write("<tr>");
			for(d=0;d<7;d++){
				write("<td id=calCell "+styleTD
						+"cursor:hand;' onMouseOver='this.bgColor=gcToggle' onMouseOut='this.bgColor=gcBG' onclick='fSetSelected(this)'>");
				write("<font id=cellText Victor='Hcy_Flag'> </font>");
				write("</td>")
			}
			write("</tr>");
		}
	}
}

function fUpdateCal(iYear,iMonth){
	myMonth=fBuildCal(iYear,iMonth);
	var i=0;
	for(w=0;w<6;w++)
		for(d=0;d<7;d++)
			with (cellText[(7*w)+d]){
				Victor=i++;
				if(myMonth[w+1][d]<0){
					color=gcGray;
					innerText=-myMonth[w+1][d];
				}else{
					color=((d==0)||(d==6))?"red":"black";
					innerText=myMonth[w+1][d];
				}
			}
}

function fSetYearMon(iYear,iMon){
	tbSelMonth.options[iMon-1].selected=true;
	for(i=0;i<tbSelYear.length;i++)
		if(tbSelYear.options[i].value==iYear)
			tbSelYear.options[i].selected=true;
	fUpdateCal(iYear,iMon);
}

function fPrevMonth(){
	var iMon=tbSelMonth.value;
	var iYear=tbSelYear.value;

	if(--iMon<1){
		iMon=12;
		iYear--;
	}

	fSetYearMon(iYear,iMon);
}

function fNextMonth(){
	var iMon=tbSelMonth.value;
	var iYear=tbSelYear.value;

	if(++iMon>12){
		iMon=1;
		iYear++;
	}

	fSetYearMon(iYear,iMon);
}

function fToggleTags(){
	with (document.all.tags("SELECT")){
		for(i=0;i<length;i++)
			if((item(i).Victor!="Won")&&fTagInBound(item(i))){
				item(i).style.visibility="hidden";
				goSelectTag[goSelectTag.length]=item(i);
			}
	}
}

function fTagInBound(aTag){
	with (VicPopCal.style){
		var l=parseInt(left);
		var t=parseInt(top);
		var r=l+parseInt(width);
		var b=t+parseInt(height);
		var ptLT=fGetXY(aTag);
		return !((ptLT.x>r)||(ptLT.x+aTag.offsetWidth<l)||(ptLT.y>b)||(ptLT.y+aTag.offsetHeight<t));
	}
}

function fGetXY(aTag){
	var oTmp=aTag;
	var pt=new Point(0,0);
	do{
		pt.x+=oTmp.offsetLeft;
		pt.y+=oTmp.offsetTop;
		oTmp=oTmp.offsetParent;
	}while(oTmp.tagName!="BODY");
	return pt;
}
function fPopCalendar(strDate){
	var popCtrl=event.srcElement;
	var dateCtrl=event.srcElement;
	if(popCtrl==previousObject){
		if(VicPopCal.style.visibility=="visible"){
			HiddenDiv();
			return true;
		}

	}
	previousObject=popCtrl;
	gdCtrl=dateCtrl;
	fInitialDate(strDate);
	fSetYearMon(giYear,giMonth);
	var point=fGetXY(popCtrl);
	with (VicPopCal.style){
		left=point.x;
		top=point.y+popCtrl.offsetHeight;
		width=VicPopCal.offsetWidth;
		width=210; //
		height=VicPopCal.offsetHeight;
		fToggleTags(point);
		visibility='visible';
	}
}

function fInitialDate(strDate){
	if(strDate==null||strDate.length!=10)
		return false;

	var sYear=strDate.substring(0,4);
	var sMonth=strDate.substring(5,7);
	var sDay=strDate.substring(8,10);

	if(sMonth.charAt(0)=='0'){
		sMonth=sMonth.substring(1,2);
	}
	if(sDay.charAt(0)=='0'){
		sDay=sDay.substring(1,2);
	}

	var nYear=parseInt(sYear);
	var nMonth=parseInt(sMonth);
	var nDay=parseInt(sDay);

	if(isNaN(nYear))
		return false;
	if(isNaN(nMonth))
		return false;
	if(isNaN(nDay))
		return false;

	var arrMon=new Array(12);
	arrMon[0]=31;
	arrMon[1]=nYear%4==0?29:28;
	arrMon[2]=31;
	arrMon[3]=30;
	arrMon[4]=31;
	arrMon[5]=30;
	arrMon[6]=31;
	arrMon[7]=31;
	arrMon[8]=30;
	arrMon[9]=31;
	arrMon[10]=30;
	arrMon[11]=31;

	if(nYear<1900||nYear>2100)
		return false;
	if(nMonth<1||nMonth>12)
		return false;
	if(nDay<1||nDay>arrMon[nMonth-1])
		return false;

	giYear=nYear;
	giMonth=nMonth;
	giDay=nDay;
	return true;
}

function clearDate(){
	gdCtrl.value="";
	VicPopCal.style.visibility="hidden";
	for(var i=0;i<goSelectTag.length;i++){
		goSelectTag[i].style.visibility="visible";
	}
	goSelectTag.length=0;

}
var gMonths=new Array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月");
with (document){
	write("<style>table {font:9pt;border-collapse:collapse1}</style>")
	write("<Div id='VicPopCal' style='POSITION:absolute;VISIBILITY:hidden;z-index:100;'>");
	write("<table border='0' bgcolor='#efefef' style='font:9pt verdana'>");
	write("<TR>");
	write("<td valign='middle' align='center'><input type='button' name='PrevMonth' value='&#171' style='' onClick='fPrevMonth()'>");
	write("&nbsp;<SELECT name='tbSelYear' onChange='fUpdateCal(tbSelYear.value, tbSelMonth.value)' Victor='Won'>");
	for(i=1950;i<2015;i++){
		write("<OPTION value='"+i+"' style='9pt verdana'>"+i+" 年</OPTION>");
	}
	write("</SELECT>");
	write("&nbsp;<select name='tbSelMonth' onChange='fUpdateCal(tbSelYear.value, tbSelMonth.value)' Victor='Won'>");
	for(i=0;i<12;i++){
		write("<option value='"+(i+1)+"' style='9pt verdana'>"+gMonths[i]+"</option>");
	}
	write("</SELECT>");
	write("&nbsp;<input type='button' name='PrevMonth' value='&#187' style='' onclick='fNextMonth()'>");
	write("</td>");
	write("</TR><TR>");
	write("<td align='center'>");
	write("<DIV style='background-color:#cccccc'><table width='100%' border='0' style='9pt verdana' cellspacing='1'>");
	fDrawCal(giYear,giMonth,20,'12');
	write("</table></DIV>");
	write("</td>");
	write("</TR>");
	write("<TR>");
	write("<td align='center'>");
	write("<DIV style='background-color:#efeff7'>");
	write("&nbsp;<input type='button' name='清除' value='清除' style='BORDER-RIGHT: #000000 1px solid; border-TOP: #000000 1px solid; border-LEFT: #000000 1px solid;BORDER-BOTTOM: #283c83 1px solid; HEIGHT: 22px;BACKGROUND-COLOR: #adc1f3;' onclick='clearDate()'>");
	write("</DIV>");
	write("</td>");
	write("</TR>");
	write("</TABLE></Div>");
}
/**
 * modified by StevenHe	(stevenhe1978@163.com)
 */
/**
 * modified by badqiu (badqiu@gmail.com)
 */

/*
 * Really easy field validation with Prototype
 * http://tetlaw.id.au/view/blog/really-easy-field-validation-with-prototype
 * Andrew Tetlaw
 * Version 1.5.3 (2006-07-15)
 * 
 * Copyright (c) 2006 Andrew Tetlaw
 * http://www.opensource.org/licenses/mit-license.php
 */
Validator = Class.create();

Validator.messagesSourceEn = [
	['validation-failed' , 'Validation failed.'],
	['required' , 'This is a required field.'],
	['validate-number' , 'Please enter a valid number in this field.'],
	['validate-digits' , 'Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.'],
	['validate-alpha' , 'Please use letters only (a-z) in this field.'],
	['validate-alphanum' , 'Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.'],
	['validate-date' , 'Please enter a valid date.'],
	['validate-email' , 'Please enter a valid email address. For example fred@domain.com .'],
	['validate-url' , 'Please enter a valid URL.'],
	['validate-date-au' , 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.'],
	['validate-currency-dollar' , 'Please enter a valid $ amount. For example $100.00 .'],
	['validate-one-required' , 'Please select one of the above options.'],
	['validate-date-cn' , 'Please use this date format: yyyy-mm-dd. For example 2006-03-16.'],
	['validate-integer' , 'Please enter a valid integer in this field'],
	['min-value' , 'min value is %s.'],
	['max-value' , 'max value is %s.'],
	['min-length' , 'min length is %s,current length is %s.'],
	['max-length' , 'max length is %s,current length is %s.'],
	['validate-int-range' , 'Please enter integer value between %s and %s'],
	['validate-float-range' , 'Please enter number between %s and %s'],
	['validate-length-range' , 'Please enter value length between %s and %s,current length is %s'],
	['validate-file' , 'Please enter file type in [%s]'],
	['validate-pattern' , 'Validation failed.'],
	['validate-chinese','Please enter chinese'],
	['validate-ip','Please enter a valid IP address'],
	['validate-phone','Please enter a valid phone number,current length is %s.'],
	['validate-mobile-phone','Please enter a valid mobile phone,For example 13910001000.current length is %s.'],
	['validate-equals','Conflicting with above value.']
	['less-than','Input value must be less than above value.'],
	['great-than','Input value must be great than above value.']
]

Validator.messagesSourceCn = [
	['validation-failed' , '验证失败.'],
	['required' , '请输入值.'],
	['validate-number' , '请输入有效的数字.'],
	['validate-digits' , '请输入一个数字. 避免输入空格],逗号,分号等字符'],
	['validate-alpha' , '请输入英文字母.'],
	['validate-alphanum' , '请输入英文字母或是数字,其它字符是不允许的.'],
	['validate-date' , '请输入有效的日期.'],
	['validate-email' , '请输入有效的邮件地址,如 username@example.com.'],
	['validate-url' , '请输入有效的URL地址.'],
	['validate-date-au' , 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.'],
	['validate-currency-dollar' , 'Please enter a valid $ amount. For example $100.00 .'],
	['validate-one-required' , '在上面选项至少选择一个.'],
	['validate-date-cn' , '请使用这样的日期格式: yyyy-mm-dd. 例如:2006-03-17.'],
	['validate-integer' , '请输入正确的整数'],
	['min-value' , '最小值为%s'],
	['max-value' , '最大值为%s'],
	['min-length' , '最小长度为%s,当前长度为%s.'],
	['max-length', '最大长度为%s,当前长度为%s.'],
	['validate-int-range' , '输入值应该为 %s 至 %s 的整数'],
	['validate-float-range' , '输入值应该为 %s 至 %s 的数字'],
	['validate-length-range' , '输入值的长度应该在 %s 至 %s 之间,当前长度为%s'],
	['validate-file' , '文件类型应该为[%s]其中之一'],
	['validate-pattern' , '输入的值不匹配'],
	['validate-chinese','请输入中文'],
	['validate-ip','请输入正确的IP地址'],
	['validate-phone','请输入正确的电话号码,如:0920-29392929,当前长度为%s.'],
	['validate-mobile-phone','请输入正确的手机号码,当前长度为%s.'],
	['validate-equals','与上面不一至,请重新输入'],
	['less-than','应该小于前面的值'],
	['great-than','应该大于前面的值']
]

Validator.messagesSource = Validator.messagesSourceCn;
Validator.messages = {};
//init Validator.messages
Validator.messagesSource.each(function(ms){
	Validator.messages[ms[0]] = ms[1];
});

Validator.format = function(str,args) {
	args = args || [];
	Validation.assert(args.constructor == Array,"Validator.format() arguement 'args' must is Array");
	var result = str
	for (var i = 0; i < args.length; i++){
		result = result.replace(/%s/, args[i]);	
	}
	return result;
}

Validator.prototype = {
	initialize : function(className, error, test, options) {
		this.options = Object.extend({}, options || {});
		this._test = test ? test : function(v,elm){ return true };
		this._error = error ? error : Validator.messages['validation-failed'];
		this.className = className;
		this.errorArray =new Array();
	},
	test : function(v, elm) {
		if(this.options.depends && this.options.depends.length > 0) {
			var dependsResult = $A(this.options.depends).all(function(depend){
				return Validation.get(depend).test(v,elm);
			});
			if(!dependsResult) return dependsResult;
		}
		if(!elm) elm = {}
		return this._test(v,elm,Validation.getArgumentsByClassName(this.className,elm.className),this);
	},
	error : function(v,elm,useTitle) {
		var dependError = null;
		$A(this.options.depends).any(function(depend){
			var validation = Validation.get(depend);
			if(!validation.test(v,elm))  {
				dependError = validation.error(v,elm,useTitle)
				return true;
			}
			return false;
		});
		if(dependError != null) return dependError;

		var args  = Validation.getArgumentsByClassName(this.className,elm.className);
		var error = this._error;
		if(typeof error == 'string') {
			if(v) args.push(v.length);
			error = Validator.format(this._error,args);
		}else if(typeof error == 'function') {
			error = error(v,elm,args,this);
		}else {
			alert('error must type of string or function');
		}
		if(!useTitle) useTitle = elm.className.indexOf('useTitle') >= 0;
		return useTitle ? ((elm && elm.title) ? elm.title : error) : error;
	}
}

var Validation = Class.create();
Validation.prototype = {
	initialize : function(form, options){
		this.options = Object.extend({
			onSubmit : true,
			stopOnFirst : false,
			immediate : false,
			focusOnError : true,
			useTitles : false,
			onFormValidate : function(result, form) {},
			onElementValidate : function(result, elm) {}
		}, options || {});
		this.form = $(form);
		var id =  Validation.getElmID(this.form);
		Validation.validations[id] = this;
		if(this.options.onSubmit) Event.observe(this.form,'submit',this.onSubmit.bind(this),false);
		if(this.options.immediate) {
			var useTitles = this.options.useTitles;
			var callback = this.options.onElementValidate;
			Form.getElements(this.form).each(function(input) { // Thanks Mike!
				Event.observe(input, 'blur', function(ev) { Validation.validate(Event.element(ev),{useTitle : useTitles, onElementValidate : callback}); });
			});
		}
	},
	onSubmit :  function(ev){
		if(!this.validate()) Event.stop(ev);
	},
	validate : function() {
		var result = false;
		var useTitles = this.options.useTitles;
		var callback = this.options.onElementValidate;
		if(this.options.stopOnFirst) {
			result = Form.getElements(this.form).all(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); });
		} else {
			result = Form.getElements(this.form).collect(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); }).all();
		}
		if(!result && this.options.focusOnError) {
			var first = Form.getElements(this.form).findAll(function(elm){return $(elm).hasClassName('validation-failed')}).first();
			if(first.select) first.select();
			first.focus();
		}
		this.options.onFormValidate(result, this.form);
		var msg =Validation.getErrorMsg();
		if (msg !=null&&msg!=""){
			alert(msg);
		}
		
		Validation.errorArray.clear();		
		return result;
	},
	reset : function() {
		Form.getElements(this.form).each(Validation.reset);
	}
}

Object.extend(Validation, {
	validate : function(elm, options){
		options = Object.extend({
			useTitle : false,
			onElementValidate : function(result, elm) {}
		}, options || {});
		elm = $(elm);
		var cn = elm.classNames();
		result = cn.all(function(value) {
			var test = Validation.test(value,elm,options.useTitle);
			options.onElementValidate(test, elm);
			return test;
		});
		
		return result;
	},

	errorArray : new Array(),

	setErrorMsg : function(msg) {
		Validation.errorArray.push(msg);
	},
	getErrorMsg : function() {
		var msgArray = Validation.errorArray;
		var result ="";
		msgArray.each(function(msg){
			result =result+msg+"\n";		
		});
		return result;
	},
	_getInputValue : function(elm) {
		var elm = $(elm);
		if(elm.type.toLowerCase() == 'file') {
			return elm.value;
		}else {
			return $F(elm);
		}
	},
	_getErrorMsg : function(useTitle,elm,validation) {
		return validation.error(Validation._getInputValue(elm),elm,useTitle);
	},
	test : function(name, elm, useTitle) {
		var v = Validation.get(name);
		var prop = '__advice'+name.camelize();
		if(Validation.isVisible(elm) && !v.test(Validation._getInputValue(elm),elm)) {
			//if(!elm[prop]) {
				var advice = Validation.getAdvice(name, elm);
				if(typeof advice == 'undefined' || null==advice) {
					var errorMsg = Validation._getErrorMsg(useTitle,elm,v);
					advice=errorMsg;
				}
			Validation.setErrorMsg(elm.alt+":"+advice);
			//}
			//var advice = Validation.getAdvice(name, elm);
			advice = Validation._getErrorMsg(useTitle,elm,v);				
			elm[prop] = true;
			elm.removeClassName('validation-passed');
			elm.addClassName('validation-failed');
			return false;
		} else {
			var advice = Validation.getAdvice(name, elm);
//			if(typeof advice != 'undefined') {
//				if(typeof Effect == 'undefined')
//					advice.hide()
//				else 
//					new Effect.Fade(advice, {duration : 1 });
//			}			
			elm[prop] = '';
			elm.removeClassName('validation-failed');
			elm.addClassName('validation-passed');
			return true;
		}
	},
	isVisible : function(elm) {
		while(elm && elm.tagName != 'BODY') {
			if(!$(elm).visible()) return false;
			elm = elm.parentNode;
		}
		return true;
	},
	getAdvice : function(name, elm) {
		return Try.these(
			function(){ return $('advice-' + name + '-' + Validation.getElmID(elm)) },
			function(){ return $('advice-' + Validation.getElmID(elm)) }
		);
	},
	getElmID : function(elm) {
		return elm.id ? elm.id : elm.name;
	},
	reset : function(elm) {
		elm = $(elm);
		var cn = elm.classNames();
		cn.each(function(value) {
			var prop = '__advice'+value.camelize();
			if(elm[prop]) {
				var advice = Validation.getAdvice(value, elm);
				advice.hide();
				elm[prop] = '';
			}
			elm.removeClassName('validation-failed');
			elm.removeClassName('validation-passed');
		});
	},
	add : function(className, error, test, options) {
		var nv = {};
		nv[className] = new Validator(className, error, test, options);
		Object.extend(Validation.methods, nv);
	},
	addAllThese : function(validators) {
		var nv = {};
		$A(validators).each(function(value) {
				nv[value[0]] = new Validator(value[0], value[1], value[2], (value.length > 3 ? value[3] : {}));
			});
		Object.extend(Validation.methods, nv);
	},
	get : function(name) {
		var resultMethodName;
		for(var methodName in Validation.methods) {
			if(name == methodName) {
				resultMethodName = methodName;
				break;
			}
			if(name.indexOf(methodName) >= 0) {
				resultMethodName = methodName;
			}
		}
		return Validation.methods[resultMethodName] ? Validation.methods[resultMethodName] : new Validator();
		//return  Validation.methods[name] ? Validation.methods[name] : new Validator();
	},
	// 通过classname传递的参数必须通过'-'分隔各个参数
	getArgumentsByClassName : function(prefix,className) {
		if(!className || !prefix)
			return [];
		var pattern = new RegExp(prefix+'-(\\S+)');
		var matchs = className.match(pattern);
		if(!matchs)
			return [];
		var results = [];
		var args =  matchs[1].split('-');
		for(var i = 0; i < args.length; i++) {
			if(args[i] == '') {
				if(i+1 < args.length) args[i+1] = '-'+args[i+1];
			}else{
				results.push(args[i]);
			}
		}
		return results;
	},
	assert : function(condition,message) {
		var errorMessage = message || ("assert failed error,condition="+condition);
		if (!condition) {
			//alert(errorMessage);
			throw new Error(errorMessage);
		}else {
			return condition;
		}
	},
	methods : {}
});

Validation.add('IsEmpty', '', function(v) {
				return  ((v == null) || (v.length == 0)); // || /^\s+$/.test(v));
			});

Validation.addAllThese([
	['required', Validator.messages['required'], function(v) {
				return !(Validation.get('IsEmpty').test(v) || /^\s+$/.test(v));
			}],
	['validate-number', Validator.messages['validate-number'], function(v) {
	            v = v.replace(/(^\s*)|(\s*$)/g,"");
	            return Validation.get('IsEmpty').test(v) || (!isNaN(v) && !/^\s+$/.test(v));
			}],
	['validate-digits', Validator.messages['validate-digits'], function(v) {
				return Validation.get('IsEmpty').test(v) ||  !/[^\d]/.test(v);
			}],
	['validate-alpha', Validator.messages['validate-alpha'], function (v) {
				return Validation.get('IsEmpty').test(v) ||  /^[a-zA-Z]+$/.test(v)
			}],
	['validate-alphanum', Validator.messages['validate-alphanum'], function(v) {
				return Validation.get('IsEmpty').test(v) ||  !/\W/.test(v)
			}],
	['validate-date', Validator.messages['validate-date'], function(v) {
				var test = new Date(v);
				return Validation.get('IsEmpty').test(v) || !isNaN(test);
			}],
	['validate-email', Validator.messages['validate-email'], function (v) {
				return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v)
			}],
	['validate-url', Validator.messages['validate-url'], function (v) {
				return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)
			}],
	['validate-date-au', Validator.messages['validate-date-au'], function(v) {
				if(Validation.get('IsEmpty').test(v)) return true;
				var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/;
				if(!regex.test(v)) return false;
				var d = new Date(v.replace(regex, '$2/$1/$3'));
				return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) && 
							(parseInt(RegExp.$1, 10) == d.getDate()) && 
							(parseInt(RegExp.$3, 10) == d.getFullYear() );
			}],
	['validate-currency-dollar', Validator.messages['validate-currency-dollar'], function(v) {
				// [$]1[##][,###]+[.##]
				// [$]1###+[.##]
				// [$]0.##
				// [$].##
				return Validation.get('IsEmpty').test(v) ||  /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v)
			}],
	['validate-one-required', Validator.messages['validate-one-required'], function (v,elm) {
				var p = elm.parentNode;
				var options = p.getElementsByTagName('INPUT');
				return $A(options).any(function(elm) {
					return $F(elm);
				});
			}]
]);


//custom validate start
Validation.addAllThese([
	['validate-date-cn', Validator.messages['validate-date-cn'], function(v) {
				if(Validation.get('IsEmpty').test(v)) return true;
				var regex = /^(\d{4})-(\d{2})-(\d{2})$/;
				if(!regex.test(v)) return false;
				var d = new Date(v.replace(regex, '$1/$2/$3'));
				return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) && 
							(parseInt(RegExp.$3, 10) == d.getDate()) && 
							(parseInt(RegExp.$1, 10) == d.getFullYear() );
			}],

	['validate-integer', Validator.messages['validate-integer'], function(v) {
				return Validation.get('IsEmpty').test(v) || (/^[-+]?[\d]+$/.test(v));
			}],

	['validate-chinese', Validator.messages['validate-chinese'], function(v) {
				return Validation.get('IsEmpty').test(v) || (/^[\u4e00-\u9fa5]+$/.test(v));
			}],

	['validate-ip', Validator.messages['validate-ip'], function(v) {
				return Validation.get('IsEmpty').test(v) || (/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(v));
			}],

	['validate-phone', Validator.messages['validate-phone'], function(v) {
				return Validation.get('IsEmpty').test(v) || /^((0[1-9]{3})?(0[12][0-9])?[-])?\d{6,8}$/.test(v);
			}],

	['validate-mobile-phone', Validator.messages['validate-mobile-phone'], function(v) {
				return Validation.get('IsEmpty').test(v) || (/(^0?[1][35][0-9]{9}$)/.test(v));
			}],
	/**
	 * Usage : validate-equals-otherInputId
	 * Example : validate-equals-username or validate-equals-email etc..
	 */
	['validate-equals',Validator.messages['validate-equals'], function(v,elm,args,metadata) {
				return Validation.get('IsEmpty').test(v) || $F(args[0]) == v;
			}],
	/**
	 * Usage : less-than-otherInputId
	 */
	['less-than',Validator.messages['less-than'], function(v,elm,args,metadata) {
				if(Validation.get('validate-number').test(v) && Validation.get('validate-number').test($F(args[0])))
					return Validation.get('IsEmpty').test(v) || parseFloat(v) < parseFloat($F(args[0]));
				return Validation.get('IsEmpty').test(v) || v < $F(args[0]);
			}],
	/**
	 * Usage : great-than-otherInputId
	 */
	['great-than',Validator.messages['great-than'], function(v,elm,args,metadata) {
				if(Validation.get('validate-number').test(v) && Validation.get('validate-number').test($F(args[0])))
					return Validation.get('IsEmpty').test(v) || parseFloat(v) > parseFloat($F(args[0]));
				return Validation.get('IsEmpty').test(v) || v > $F(args[0]);
			}],
	/*
	 * Usage: min-length-number
	 * Example: min-length-10
	 */
	['min-length',Validator.messages['min-length'],function(v,elm,args,metadata) {
		return Validation.get('IsEmpty').test(v) || v.length >= parseInt(args[0]);
	}],
	/*
	 * Usage: max-length-number
	 * Example: max-length-10
	 */
	['max-length',Validator.messages['max-length'],function(v,elm,args,metadata) {
		return Validation.get('IsEmpty').test(v) || v.length <= parseInt(args[0]);
	}],
	/*
	 * Usage: validate-file-type1-type2-typeX
	 * Example: validate-file-png-jpg-jpeg
	 */
	['validate-file', function(v,elm,args,metadata) {
		return Validator.format(Validator.messages['validate-file'],[args.join(',')]);
	},function(v,elm,args,metadata) {
		return Validation.get('IsEmpty').test(v) || $A(args).any(function(extentionName) {
			return new RegExp('\\.'+extentionName+'$','i').test(v);
		});
	}],
	/*
	 * Usage: validate-float-range-minValue-maxValue
	 * Example: -2.1 to 3 = validate-float-range--2.1-3
	 */
	['validate-float-range', Validator.messages['validate-float-range'],function(v,elm,args,metadata) {
		return Validation.get('IsEmpty').test(v) || (parseFloat(v) >= parseFloat(args[0]) && parseFloat(v) <= parseFloat(args[1]))
	},{depends : ['validate-number']}],
	/*
	 * Usage: validate-int-range-minValue-maxValue
	 * Example: -10 to 20 = validate-int-range--10-20
	 */
	['validate-int-range',Validator.messages['validate-int-range'],function(v,elm,args,metadata) {
		return Validation.get('IsEmpty').test(v) || (parseInt(v) >= parseInt(args[0]) && parseInt(v) <= parseInt(args[1]))
	},{depends : ['validate-integer']}],
	/*
	 * Usage: validate-length-range-minLength-maxLength
	 * Example: 10 to 20 = validate-length-range-10-20
	 */
	['validate-length-range', Validator.messages['validate-length-range'],function(v,elm,args,metadata) {
		return Validation.get('IsEmpty').test(v) || (v.length >= parseInt(args[0]) && v.length <= parseInt(args[1]))
	}],
	/*
	 * Usage: max-value-number
	 * Example: max-value-10
	 */
	['max-value',Validator.messages['max-value'] ,function(v,elm,args,metadata) {
		return Validation.get('IsEmpty').test(v) || parseFloat(v) <= parseFloat(args[0]);
	},{depends : ['validate-number']}],
	/*
	 * Usage: min-value-number
	 * Example: min-value-10
	 */
	['min-value',Validator.messages['min-value'],function(v,elm,args,metadata) {
		return Validation.get('IsEmpty').test(v) || parseFloat(v) >= parseFloat(args[0]);
	},{depends : ['validate-number']}],
	/*
	 * Usage: validate-pattern-RegExp
	 * Example: <input id='sex' class='validate-pattern-/^[fm]$/i'>
	 */
	['validate-pattern',Validator.messages['validate-pattern'],function(v,elm,args,metadata) {
		var extractPattern = /validate-pattern-\/(\S*)\/(\S*)?/;
		Validation.assert(extractPattern.test(elm.className),"invalid validate-pattern expression,example: validate-pattern-/a/i");
		elm.className.match(extractPattern);
		return Validation.get('IsEmpty').test(v) || new RegExp(RegExp.$1,RegExp.$2).test(v);
	}],
	/*
	 * Example: <input id='email' class='validate-ajax' validateUrl='http://localhost:8080/validate-email.jsp' validateFailedMessage='email already exists'>
	 */
	['validate-ajax',function(v,elm,args,metadata) {
		return elm.getAttribute('validateFailedMessage') || Validator.messages['validation-failed'];
	},function(v,elm,args,metadata) {
		Validation.assert(elm.getAttribute('validateUrl'),'element validate by ajax must has "validateUrl" attribute');
		//Validation.assert(elm.getAttribute('validateFailedMessage'),'element validate by ajax must has "validateFailedMessage" attribute');
		
		if(elm._ajaxValidating && elm._hasAjaxValidateResult) {
			elm._ajaxValidating = false;
			elm._hasAjaxValidateResult = false;
			return elm._ajaxValidateResult;
		}

		var sendRequest = function() {
			new Ajax.Request(elm.getAttribute('validateUrl'),{
				parameters : Form.Element.serialize(elm),
				onSuccess : function(response) {
					if('true' != response.responseText.strip()  && 'false' != response.responseText.strip())
						Validation.assert(false,'validate by ajax,response.responseText must equals "true" or "false",actual='+response.responseText);
					elm._ajaxValidateResult = eval(response.responseText);
					elm._hasAjaxValidateResult = true;
					Validation.test('validate-ajax',elm);
				}
			});
			elm._ajaxValidating = true;
			return true;
		}

		return elm._ajaxValidating || Validation.get('IsEmpty').test(v) || sendRequest();
	}]
]);

Validation.validations = {};
Validation.autoBind = function() {
	 var forms = document.getElementsByClassName('required-validate');
	 $A(forms).each(function(form){
		var validation = new Validation(form,{onSubmit : true, immediate:false,stopOnFirst : false});

	 });
};

Validation.$ = function(id) {
	return Validation.validations[id];
}

/**
 * 在下拉框之外的地方点击，自动关闭
 *   var pubSelectNotHiddenEle = [xxx,xxx];//点在这些元素上不隐藏
 *   Event.observe(document, 'click', autoClosePubSelectObserver, false);
 */
function autoClosePubSelectObserver(e){
  	var srcE = Event.element(e);
  	//如果是点的输入框，不隐藏
  	if(typeof(pubSelectNotHiddenEle) != 'undefined'){
  		for(var i=0;i<pubSelectNotHiddenEle.length;i++){
  			if(srcE == pubSelectNotHiddenEle[i]){
  				return;
  			}
  		}
  	}
  	//在div之外就隐藏
    if(!isInnerNodeOf(srcE,$("_smanDisp"))){
   		closeDivPage();
    }
}

  function isInnerNodeOf(innerElement,outerElement){
  	var isInner = false;
  	while (innerElement) {
        isInner = (innerElement == outerElement);
        if (isInner) {break;}
        innerElement = innerElement.parentNode;
    }
    return isInner;
  }
 /**
  * 记录点击量
  */
function clickCounter(param) {
	d = new Date();
	if(document.images) {
		(new Image()).src="/clickcounter/click/1.html?time=" + d.getTime() + "&" + param;
	}
	return true;
}
/**------------------------------------------
//@param  str : 传入要判断的字符串
//@Author     : gaotao
//@CreateDate : 2009-12-18
//@Deprecated : 判断字符串中是否有特殊符号和空格
-------------------------------------------**/
function checkTextinput(str){
      var iu, iuu; 
      regArray=new Array("◎","■","●","№","↑","→","↓"+
       "!","@","#","$","%","^","&","*","(",")","_","+","=","|","'","[","]","？","~","`"+
       "!","<",">","‰","→","←","↑","↓","¤","§","＃","＆","＆","＼","≡","≠"+
       "≈","∈","∪","∏","∑","∧","∨","⊥","∥","∥","∠","⊙","≌","≌","√","∝","∞","∮"+
       "∫","≯","≮","＞","≥","≤","≠","±","＋","÷","×","／","Ⅱ","Ⅰ","Ⅲ","Ⅳ","Ⅴ","Ⅵ","Ⅶ","Ⅷ","Ⅹ","Ⅻ","㈠","㈡"+
       "╄","╅","╇","┻","┻","┇","┭","┷","┦","┣","┝","┤","┷","┷","┹","╉","╇","【","】"+
       "㈢","㈣","㈤","㈥","㈦","㈧","㈨","㈩","①","②","③","④","⑤","⑥","⑦","⑧","⑨","⑩","┌","├","┬","┼","┍","┕","┗","┏","┅","─"+
       "〖","〗","←","〓","☆","§","□","‰","◇","︿","＠","△","▲","＃","℃","※",".","≈","￠"); 
      iuu=regArray.length;
      for(iu=1;iu<=iuu;iu++){
        if (str.indexOf(regArray[iu])!=-1){
		    alert("输入内容不能包含非法字符!");
			return false;
        }
      }
      //判断前后或中间是否有空格
      var p = /\s/; 
	  if(p.test(str))
	  {
	   	alert("输入内容不能包含空格");
		return false;
	  }
      return true;
}