//ä¯ÀÀÆ÷ÑéÖ¤
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
if (window.ActiveXObject)
    Sys.ie = ua.match(/msie ([\d.]+)/)[1]
else if (document.getBoxObjectFor)
    Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1]
else if (window.MessageEvent && !document.getBoxObjectFor)
    Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1]
else if (window.opera)
    Sys.opera = ua.match(/opera.([\d.]+)/)[1]
else if (window.openDatabase)
    Sys.safari = ua.match(/version\/([\d.]+)/)[1];
    
    //Trim space.
	function trim(value) {
	    return value.replace( /^\s*/, "" ).replace( /\s*$/, "" );
	}
	
	//Check null.
	function isNull(value){
		if(trim(value).length == 0){
			return true;
		}else{
			return false;
		}
	}
	//Check email address.
	function isEmail(mail){
		var reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
  		return  Check( reg, trim(mail) );
  	}
  	
  function isInt(value){
  	var reg = /^\d+$/;  	
  	return Check(reg,value);
  }
    
  function isPrice(value,min,max){
  	if(isNull(value)){
  		return false;
  	}
  	
  	if(isNaN(value)){
  		return false;
  	}
  	
  	if(min == null && max != null){
  		if(new Number(value)>new Number(max)){
	  		return false;
  		}
  	}else if(min != null && max == null){
  		if(new Number(value)<new Number(min)){
	  		return false;
  		}
  	}else if(min == null && max == null){
  		return true;
  	}else{
  	 if(new Number(value)<new Number(min) 
  				|| new Number(value)>new Number(max)){
	  		return false;
  		}
  	}
  	
  	return true;
  }
  	
  //Check post NO.
  function isPostNO(value){
		var reg = /^\d{6}$/;
		return  Check( reg, value );
	}
	
	function Check( reg, str ){	
		if( reg.test( str ) ){
			return true;
		}			
		return false;
	}
 
/*Ê×Ò³Ìø×ª*/
function gohome(userregion,regionsession){
	if(userregion == ""){
		if(regionsession == "" || regionsession == "1"){
			window.location = "http://www.officedepot.com.cn/buy/bj/";
		}else if(regionsession == "2"){
			window.location = "http://www.officedepot.com.cn/buy/sh/";
		}else if(regionsession == "3"){
			window.location = "http://www.officedepot.com.cn/buy/gz/";
		}else if(regionsession == "5"){
			window.location = "http://www.officedepot.com.cn/buy/tj/";
		}else if(regionsession == "6"){
			window.location = "http://www.officedepot.com.cn/buy/sz/";
		}else{
			window.location = "http://www.officedepot.com.cn";
		}
	}else{
		if(userregion == "1"){
			window.location = "http://www.officedepot.com.cn/buy/bj/";
		}else if(userregion == "2"){
			window.location = "http://www.officedepot.com.cn/buy/sh/";
		}else if(userregion == "3"){
			window.location = "http://www.officedepot.com.cn/buy/gz/";
		}else if(userregion == "5"){
			window.location = "http://www.officedepot.com.cn/buy/tj/";
		}else if(userregion == "6"){
			window.location = "http://www.officedepot.com.cn/buy/sz/";
		}else{
			window.location = "http://www.officedepot.com.cn";
		}		
	}
}   
    