//¹«¹²º¯Êý
var usernav=new function(){
	this.isOpera=(window.opera&&navigator.userAgent.match(/opera/gi))?true:false;
	this.isIE=(!this.isOpera&&document.all&&navigator.userAgent.match(/msie/gi))?true:false;
	this.isSafari=(!this.isIE&&navigator.userAgent.match(/safari/gi))?true:false;
	this.isGecko=(!this.isIE&&navigator.userAgent.match(/gecko/gi))?true:false;
	this.isFirefox=(!this.isIE&&navigator.userAgent.match(/firefox/gi))?true:false;
}
Date.prototype.addDay = function(num){if(!isNaN(num))this.setDate(this.getDate() + parseInt(num));return this;}
Date.prototype.addMonth = function(num){if(!isNaN(num))this.setMonth(this.getMonth() + parseInt(num));return this;}
function DateTime2Str(date){
	var y=date.getFullYear()+"";
	var m=(date.getMonth()+1)+"";
	var d=date.getDate()+"";
	if(m.length==1)m="0"+m;
	if(d.length==1)d="0"+d;
	return y+"-"+m+"-"+d;
}
function getCookie(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); 
	if (document.cookie.match(re)){return document.cookie.match(re)[0].split("=")[1];}
	return "";
}

function setCookie(name,value,expiry,path,domain,secure){
	var nameString = name + "=" + value;
	var expiryString = (expiry == null) ? "" : " ;expires = "+ expiry.toGMTString();
	var pathString = (path == null) ? "" : " ;path = "+ path;
	var domainString = (domain == null) ? "" : " ;domain = "+ domain;
	var secureString = (secure) ?";secure" :"";
	document.cookie = nameString + expiryString + pathString + domainString + secureString;
}

if(typeof(Number.prototype.toFixed)!="function"){
    Number.prototype.toFixed = function(d){
        var s=this+"";if(!d)d=0;
        if(s.indexOf(".")==-1)s+=".";s+=new Array(d+1).join("0");
        if (new RegExp("^(-|\\+)?(\\d+(\\.\\d{0,"+ (d+1) +"})?)\\d*$").test(s)){
            var s="0"+ RegExp.$2, pm=RegExp.$1, a=RegExp.$3.length, b=true;
            if (a==d+2){a=s.match(/\d/g); if (parseInt(a[a.length-1])>4){
                for(var i=a.length-2; i>=0; i--) {a[i] = parseInt(a[i])+1;
                if(a[i]==10){a[i]=0; b=i!=1;} else break;}
            }
            s=a.join("").replace(new RegExp("(\\d+)(\\d{"+d+"})\\d$"),"$1.$2");
        }if(b)s=s.substr(1);return (pm+s).replace(/\.$/, "");} return this+"";
		return d;
    };
}
function $(el){return document.getElementById(el)}
function getPosition(obj) {
	var top=0;
	var left=0;
	var width=obj.offsetWidth;
	var height=obj.offsetHeight;
	while (obj.offsetParent) {
		top += obj.offsetTop;
		left += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return {"top":top,"left":left,"width":width,"height":height};	
}
function GetVal(src,name){
	var len=name.length;
	var from=src.indexOf(name);
	if(from==-1){return '';}
	to=src.indexOf('&',from);
	if(to==-1){return src.substring(from+len);}
	else{return src.substring(from+len,to);}
}
