<!--
window.onerror=new Function("return true;")
function readCookie(s){var arr=document.cookie.match(new RegExp("(^| )"+s+"=([^;]*)(;|$)"));
if(arr!=null){return unescape(arr[2]);}else{return "";}}
function writeCookie(s,v,h){var expire="";if(h!=null){expire=new Date((new Date()).getTime()+h*3600000);
expire=";expires="+expire.toGMTString();}document.cookie=s+"="+escape(v)+expire;}

var IE_all_cache = new Object();
function IE_getElementById(id){if (IE_all_cache[id] == null){IE_all_cache[id] = document.all[id];}
	return IE_all_cache[id];
}

if (document.all){if (!document.getElementById){document.getElementById = IE_getElementById;}}

function showObject(o){var obj=document.getElementById(o);if (obj.style.display=="block"){obj.style.display="none";}else{obj.style.display="block";obj.focus();}}

function isEmpty(s){return ((s == null) || (s.length == 0))}

function isWhitespace(s){
	var whitespace = " \t\n\r";var i;
	for (i = 0; i < s.length; i++){   
		var c = s.charAt(i);
		if (whitespace.indexOf(c) >= 0){return true;}
	}
	return false;
}

function rightChar(s,schar){
	if (s==null) return;
	if(schar==null) return s;
	return s.substring(s.lastIndexOf(schar)+1,s.length);
}

function isCharsInBagEx (s, bag)
{  
  var i,c;
  // Search through string's characters one by one.
  // If character is in bag, append to returnString.
  for (i = 0; i < s.length; i++)
  {   
        c = s.charAt(i);
	if (bag.indexOf(c) > -1) 
        return c;
  }
  return "";
}

function isCharsInBag (s, bag)
{  
  var i;
  // Search through string's characters one by one.
  // If character is in bag, append to returnString.

  for (i = 0; i < s.length; i++)
  {   
      // Check that current character isn't whitespace.
      var c = s.charAt(i);
      if (bag.indexOf(c) == -1) return false;
  }
  return true;
}

function isRegisterUserName(s)
{
 	var errorChar;
	var badChar = "><,[]{}?/+=|\\'\":;~!@#$%^&()`"; 
 	if (isEmpty(s))
 	{
 		alert("请输入用户名！");
 		return false;
 	}
 	//is s contain whitespace
   	if ( isWhitespace(s) )
	{
		alert("输入的用户名中不能包含空格符，请重新输入！");	
		return false;
	}
	//is s contain invalid characters
	//Validate the user name
	errorChar = isCharsInBagEx( s, badChar)
    	if (errorChar != "" )
	{
		alert("您输入的用户名" + s+"是无效的用户名,\n\n请不要在用户名中输入字符" + errorChar + "!\n\n请重新输入合法的用户名！" );
		return false;
	} 	
	
	return true;
}

function isEmail (s)
{
   	// is s Empty?
    if (isEmpty(s))
	{
		alert("输入的E-mail地址不能为空，请输入！");	
		return false;
	}
	//is s contain whitespace
    if (isWhitespace(s))
	{
		alert("输入的E-mail地址中不能包含空格符，请重新输入！");	
		return false;
	}

   // there must be >= 1 character before @, so we
   // start looking at character position 1
   // (i.e. second character)
   var i = 1;
   var len = s.length;

	if (len > 30)
	{
		alert("email地址长度不能超过30位!");
		return false;
	}
	
	pos1 = s.indexOf("@");
	pos2 = s.indexOf(".");
	pos3 = s.lastIndexOf("@");
	pos4 = s.lastIndexOf(".");
	//check '@' and '.' is not first or last character
	if ((pos1 <= 0)||(pos1 == len)||(pos2 <= 0)||(pos2 == len))  
	{
		alert("请输入有效的E-mail地址！");
		return false;
	}
	else
	{
		//check @. or .@
		if( (pos1 == pos2 - 1) || (pos1 == pos2 + 1) 
		  || ( pos1 != pos3 )  //find two @
		  || ( pos4 < pos3 ) ) //. should behind the '@'  		
		{
			alert("请输入有效的E-mail地址！");
			return false;
		}
	}

	if ( !isCharsInBag( s, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@"))
	{
		alert("email地址中只能包含字符ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@\n" + "请重新输入" );
		return false;
	}
	//is s contain invalid characters
	/*
	var badChar = "><,[]{}?/+=|\\'\":;!#$%^&()`"; 
	if ( isCharsInBag( s, badChar))
	{
		alert("请不要在email地址中输入字符 " + badChar + "\n" );
		alert("请重新输入" );
		return false;
	}
	*/
	return true;
}
function isTelNumber(s, item)
{

	//is s contain invalid characters
	var goodChar = "0123456789-*()"; 
   //Validate the user name
   if (isEmpty(s))
   {    alert("电话号码不能为空！");
		return false;
   }

   if ( !isCharsInBag( s, goodChar))
	{  
	    alert(item+"号码里只能有0123456789-*()！");
		return false;
	}
	//check user length 
	if ((s.length>12)||(s.length<6))
	{
		alert(item+"号码不能超过12位也不能少于6位！");
		return false;
	}
	return true;
}

function isMPNumber(s)
{
	//is s contain invalid characters
	var goodChar = "0123456789-*()"; 
   //Validate the user name
   if (!isEmpty(s)){
		if ( !isCharsInBag( s, goodChar)){  
			alert("移动电话号码里只能有0123456789-*()！");
			return false;
		}
		//check user length 
		if (s.length!=11){
			alert("移动电话号码位数不对！");
			return false;
		}
   }
   return true;
}

function isAddress(s)
{
   	// is s Empty?
   	if ( isEmpty(s) )
	{
		alert("联系地址不能为空，请重新输入！");	
		return false;
	}
	//is s contain invalid characters
	var badChar = "><,[]{}?/+=|\\'\":;~!@$%^&`"; 
	var len = s.length;
	var errorChar

   	errorChar = isCharsInBagEx( s, badChar)
   	if (errorChar != "" )
	{
	    alert("联系地址中不能含有字符 "+badChar + " !");
		return false;
	}
	//check user length 
	if ((len>100)||(len<5))
	{
		alert("联系地址不能超过50个汉字也不能少于五个汉字！");
		return false;
	}
	return true;
}

function isInt(s, item)
{
  if (isEmpty(s))
  {
	alert(item + "不能为空，请输入！");
	return false;
  }
      	
  var validChar = "0123456789"; 
  if (!isCharsInBag(s, validChar))
  {
	alert("您输入的" + item + s +"是无效的" + item + "，\n\n请输入合法的" + item + "！");
	return false;
  }

  return true;
}


 function isKeyword(s)
 {
 	var a, errorChar;
	var badChar = "><,[]{}?/+=|\\'\":;~!@#$%^&()`"; 
	// is s Empty?
   	if ( isEmpty(s) )
	{
		a = confirm("如果您不输入任何查询关键字，您可能会得到太多的查询结果。\n\n您确定要进行查询吗？");	
		if (a == false)
			return false;
	}
	else
	{
		//is s contain invalid characters
		//Validate the user name
		errorChar = isCharsInBagEx( s, badChar)
	    	if (errorChar != "" )
		{
			alert("请不要在查询关键字中输入字符" + errorChar + "\n\n请重新输入！" );
			return false;
		} 	
	}
	return true;
 }
 
 function isItemNum(s)
 {
 	if (isEmpty(s))
	{
		alert("请输入物品编号进行查询！");
 		return false;
	}
	var validChar = "0123456789"; 
	if (!isCharsInBag(s, validChar))
	{
		alert("您输入的物品编号" + s +"是无效的物品编号，\n\n请输入合法的物品编号！");
 		return false;
	}
	return true;		
 }
 
 function isUserName(s){
 	var errorChar;
	var badChar = "><,[]{}?/+=|\\'\":;~!#$%()`"; 
 	if (isEmpty(s))
 	{
 		alert("Empty！");
 		return false;
 	}

    if ((s.length<2)||(s.length>18))
    {
	   	alert("用户名长度为2~18位！");
 		return false;
    }
   	if ( isWhitespace(s) )
	{
		alert("输入的用户名中不能包含空格符，请重新输入！");	
		return false;
	}
	//is s contain invalid characters
	//Validate the user name
	errorChar = isCharsInBagEx( s, badChar)
    	if (errorChar != "" )
	{
		alert(s+" invalid,\n\n" + badChar + " is bad Char!\n\n" );
		return false;
	} 	
	return true;
}
 
 function isName(s)
 {
 	var errorChar;
	var badChar = "><,[]{}?/+=|\\'\":;~!#$%()`"; 
 	if (isEmpty(s))
 	{
 		alert("请输入姓名！");
 		return false;
 	}

    if ((s.length<=1)||(s.length>21))
    {
	   	alert("姓名长度要大于1位小于20位！");
 		return false;
    }
 	//is s contain whitespace
   	if ( isWhitespace(s) )
	{
		alert("输入的姓名中不能包含空格符，请重新输入！");	
		return false;
	}
	//is s contain invalid characters
	//Validate the user name
	errorChar = isCharsInBagEx( s, badChar)
    	if (errorChar != "" )
	{
		alert("您输入的姓名" + s+"是无效的姓名,\n\n请不要在姓名中输入字符" + errorChar + "!\n\n请重新输入合法的姓名！" );
		return false;
	} 	
	
	return true;
 }

function isSource(s)
{
   if (s=='选择')
   {
      alert("信息来源不能为空，请你选择");
      return false;
   }
   return true;
}

function isSex(s)
{
   if (s=='选')
   {
      alert("性别信息不能为空，请你选择");
      return false;
   }
   return true;
}


function isCity(s)
{
   if (s=='选择')
   {
      alert("城市信息不能为空，请你选择");
      return false;
   }
   return true;
}

function isPassword (s)
{
  if (isEmpty(s))
  {
	alert("密码不能为空，请输入！");
	return false;
  }
//is s contain whitespace
  if ( isWhitespace(s) )
  {
	alert("密码中不能包含空格符，请重新输入！");	
	return false;
  }

  if ((s.length>16)||(s.length<4))
  {
 	alert("口令不能超过16位也不能少于4位！");
	return false;
  }
  return true;
}


function isIntEx(s, item, len, bCompare)
{
  if (isEmpty(s))
  {
	alert(item + "不能为空，请输入！");
	return false;
  }
      	
  var validChar = "0123456789"; 
  if (!isCharsInBag(s, validChar))
  {
	alert("您输入的" + item + s +"是无效的" + item + "，\n\n请输入合法的" + item + "！");
	return false;
  }
  
  if (bCompare == "=") 
  {
    if (s.length != len)
    {
	alert("您输入的" + item + s +"是无效的" + item + "，\n\n必须等于" + len + "位！");
	return false;
    }
  }
  else if (bCompare == "<")
  {
    if (s.length >= len) 
    {
	alert("您输入的" + item + s +"是无效的" + item + "，\n\n必须小于" + len + "位！");
	return false;
    }
  }
    
  return true;
}

function isRealnumber(s,item)
{
    if (isEmpty(s))
  {
	alert(item + "不能为空，请输入！");
	return false;
  }
      	
  var validChar = "0123456789."; 
  if (!isCharsInBag(s, validChar))
  {
	alert("您输入的" + item + s +"是无效的" + item + "，\n\n请输入合法的" + item + "！");
	return false;
  }

 return true;
}
function isValidString(s, des)
{
 	var errorChar;
	var badChar = "><,[]{}?/+=|\\'\":;~!@#$%^&()`"; 
 	if (isEmpty(s))
 	{
 		alert("请输入"+ des +"！");
 		return false;
 	}
	//is s contain invalid characters
	//Validate the user name
	errorChar = isCharsInBagEx( s, badChar)
    	if (errorChar != "" )
	{
		alert("您输入的" + des +"是无效的"+des +",\n\n请不要在"+des+"中输入字符" + errorChar + "!\n\n请重新输入合法的"+des+"！" );
		return false;
	} 	
	
	return true;
 }
 
 function checknum(obj){
	if (isNaN(obj.value)){
	obj.value='';
	alert('error');
	obj.focus();
	}
}

function isPrice(s, item)
{
  if (isEmpty(s))
  {
	alert(item + "不能为空，请输入！");
	return false;
  }
      	
  var validChar = "0123456789."; 
  if (!isCharsInBag(s, validChar))
  {
	alert("您输入的" + item + s +"是无效的" + item + "，\n\n请输入合法的" + item + "！");
	return false;
  }
  if (s.indexOf(".") == -1)
  	return true;
  	
  if (s.indexOf(".") != s.lastIndexOf("."))
  {
	alert("您输入的" + item + s +"是无效的" + item + "，\n\n请输入合法的" + item + "！");
	return false;
  }
  var opart = s.substr(s.indexOf(".")+1)
  if (parseInt(opart) != 0)
  {
	alert(item+"的最小单位是1元！");
	return false;
  }
  return true;
}

function checkContent(strInput,length,Item){
    if (isEmpty(strInput))
 	{
 		alert("您输入的"+Item+"为空！");
 		return false;
 	}
 	
    if (strInput.length > length) {
        alert("您输入的"+Item+"超过了"+length+"位");
      return false;
  }

   //ind2=isCharsInBagEx(strInput, "/");
   ind3=isCharsInBagEx(strInput, "<");
   ind4=isCharsInBagEx(strInput, ">");
   ind5=isCharsInBagEx(strInput, "'");
   if (ind3 || ind4 || ind5) {
      alert("请勿使用 <, >, '等特殊字符 ");
      return false;
  }
  return true;
} 

function NewWindow(url,windowName,width,height)
{
	
	if (window.showModelDialog){
		var windowFeature="dialogWidth="+width+"px;dialogHeight="+height+"px;status=no;scrollbars=no,resizable=yes;help=no;edge=raised";
		if (width==null||height==null)windowFeature="status=no;scrollbars=no,resizable=yes;help=no;edge=raised";
		var popup=window.showModelDialog(url,windowName,windowFeature);
		popup.focus();
	}
	else{

		var windowFeature="width="+width+",height="+height+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes";
		if (width==null||height==null)windowFeature="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes";
		var popup = window.open(url, windowName, windowFeature);
		popup.focus();
	}
}

function newBrowse(url,windowName,width,height)
{
	
	if (window.showModelDialog){
		var windowFeature="dialogWidth="+width+"px;dialogHeight="+height+"px;status=no;scrollbars=yes;resizable=yes;help=no;edge=raised";
		if (width==null||height==null)windowFeature="status=no;scrollbars=yes;resizable=yes;help=no;edge=raised";
		var popup=window.showModelDialog(url,windowName,windowFeature);
		popup.focus();
	}
	else{

		var windowFeature="width="+width+",height="+height+"";
		if (width==null||height==null)windowFeature="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes";
		var popup = window.open(url, windowName, windowFeature);
		popup.focus();
	}
}

function AddToCart(quantity,pieceCode,action)
{
	if (!isInt(quantity,"数量")) 
	   return false;
	if (quantity=="0"){
		alert ("定购数量需要大于0");
		return false;
	}
	alert("您已经把商品号为"+pieceCode+"的商品添加进购物车了");
//	var strHref="mycart.asp?quantity="+quantity+"&piececode="+pieceCode+"&act="+action;
//	NewWindow('','cart',580,400);
}

 function isRightInput(s)
 {
 	var a, errorChar;
	var badChar = "><,[]{}?/+=|\\'\":;~!@$%^&()`"; 
	// is s Empty?
		//is s contain invalid characters
		//Validate the user name
		errorChar = isCharsInBagEx( s, badChar)
	    	if (errorChar != "" )
		{
			alert("请不要输入字符" + errorChar + "\n\n请重新输入！" );
			return false;
		} 	

	return true;
 }

function CreateRND(low,high){with (Math){return (floor(random() * (1 + high - low) + low));}}

function CheckLogin(o){
	if (o.usercode.value==""){o.usercode.focus();return false;}
	if (o.password.value==""){o.password.focus();return false;}
	if (o.ValidCode.value==""){o.ValidCode.focus();return false;}
	return true;
}

/*
'---------------------------本文件说明------------------------------------------------------------
' Projectname: DisplayPageCount
' Filename: DisplayPageCount
' File version: v1.0
' Author : LittleYu.com
' Start date: 2000-5-28
' LastEdit date : 2006-1-1
' Purpose :  
' Include file : no
' Input parameters :
'		CurrentPage-----------
'		TotalPage-------------
'		StrUrl--------
' -------------------------------文件说明结束--------------------------------------------------
*/
function DisplayPageCount(CurrentPage,TotalPage,StrUrl){
	var i ;
	var strHref ;
	if (StrUrl.indexOf("?")<0)
		strHref="?Page=" ;
	else
		strHref = StrUrl + "&Page=" ;
	if (parseInt(TotalPage)<1) return;
	if (CurrentPage<1) CurrentPage=1;
	if (CurrentPage>TotalPage) CurrentPage=TotalPage;
	if (CurrentPage > 1){
		document.write ("<a href='" + strHref + "1'><font face='webdings' title=''>9</font></a>&nbsp;");
		document.write ("<a href='" + strHref + (TotalPage-1) +"'><font face='webdings' title=''>7</font></a>&nbsp;");
	}
	else{
		document.write ("<font face='webdings' title=''>9</font>&nbsp;") ;
		document.write ("<font face='webdings' title=''>7</font>&nbsp;") ;
	}

	if (TotalPage <= 15){
		for (i=1; i<=TotalPage; i++){
			if (i!=CurrentPage) document.write ("<a href='" + strHref + i + "' class='p_num'>"+i+"</a>&nbsp;")
			else document.write ("<a class='p_curpage'>["+i+"]</a>&nbsp;") ;
		}

	}
	else{
		if (CurrentPage<9){
			for (i=1; i<=15; i++){
			if (i!=CurrentPage) document.write ("<a href='"+strHref+i+"' class='p_num'>"+i+"</a>&nbsp;");
			else document.write ("<a class='p_curpage'>["+i+"]</a>&nbsp;");
			}
			document.write ("... ");
		}
		if (CurrentPage>TotalPage-8){
			document.write ("... ");
			for (i=TotalPage-15;i<=TotalPage;i++){
			if (i!=CurrentPage) document.write ("<a href='"+strHref+i+"'>"+i+"</a>&nbsp;");
			else document.write ("["+i+"]&nbsp;");
			}
		}

		if (CurrentPage-7>0 && CurrentPage+7<TotalPage && CurrentPage>8 && CurrentPage<TotalPage-7){
			document.write ("... ");
			for (i=CurrentPage-7;i<=CurrentPage+7;i++){
			if (i!=CurrentPage) document.write ("<a href='"+strHref+i+"'>"+i+"</a>&nbsp;");
			else document.write ("<a class='p_curpage'>["+i+"]</a>&nbsp;");
			}
			document.write ("... ");
		}
	}
	if (CurrentPage<TotalPage){
		document.write ("<a href='"+ strHref + (CurrentPage+1) +"'><font face='webdings' title=''>8</font></a>");
		document.write ("<a href='"+ strHref + (TotalPage) +"'><font face='webdings' title=''>:</font></a>");
	}
	if (TotalPage>0) document.write ("  &nbsp;&nbsp;&nbsp;<font color='#FF0000'>"+ CurrentPage +"</font>/"+TotalPage+"");
	document.write ('<input style="border:1px solid #808080;font-size:9pt;width:25px;" type="text" id="GotoPages" name="GotoPages" size="1" value="">');
	document.write ('<input style="border:1px solid #808080;font-size:9pt;" type="button" value="Go" onclick="gotoPage(\''+strHref+'\');">');
}

function gotoPage(u){var p;if (document.getElementById('GotoPages')){p=document.getElementById('GotoPages').value;if (isNaN(p)){ return;}if(p==""){return;}}else{p="1";}document.location.href=u+p;}

function checkEmail(emailStr)
{
	var re = /^(([^()<>@,;:\\\"".[\]\ ]+)|(\""[^\r\""]+\""))((\.[^()<>@,;:\\\"".[\]\ ]+)|(\.\""[^\r\""]+\""))*@((([a-zA-Z0-9\-]+\.)*([a-zA-Z0-9][a-zA-Z0-9\-]+)*[a-zA-Z0-9]+\.[a-zA-Z]{2,})|(\[(25[0-4]|2[0-4]\d|1\d{2}|[1-9]\d?)(\.(25[0-4]|2[0-4]\d|1\d{2}|[1-9]\d|\d)){2}(\.(25[0-4]|2[0-4]\d|1\d{2}|[1-9]\d?)))\])$/
	if (!re.test(emailStr)){
		alert("Email address format is not valid.")
		
	}
	return re.test(emailStr);
}

function showSeleColor(){
var c=new Array('#ffffff','#FAFBE6','#FFF2E2','#FDE6E0','#F3FFE1','#DAFAFE','#E9EBFE','#EAEAEF','#9DFF9D');
if(readCookie("newsColor")!=""){document.getElementById('newcnt').style.backgroundColor=readCookie("newsColor");}
for (var i=0;i<c.length-1;++i){document.write('<button style="margin-right:2px;;height:15px;width:15px;border:1px solid #cccccc;;background-color:'+c[i]+'" onclick="javascript:document.getElementById(\'newcnt\').style.backgroundColor=\''+c[i]+'\';writeCookie(\'newsColor\',\''+c[i]+'\',24000);">&nbsp;</button> ');}}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
//    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    if (obj.style) { obj=obj.style; v=(v=='show')?'':(v=='hide')?'none':v; }
//    obj.visibility=v; }
    obj.display=v; }
}
//document.write ("<script language='JavaScript' src='include/menu.js'></script>")
//-->
