String.prototype.Replace = function(oldValue,newValue){ 
	var reg = new RegExp(oldValue,"g"); 
	return this.replace(reg, newValue); 
}

String.prototype.replacesafe = function(){ 
	var str=this;
	str=str.replace("/","／");
	str=str.replace("\\","＼");
	return str;
}


//用于翻页，排序等，更换url参数
function changeUrl(urlstr,pstr,v){
	var url=urlstr;
	var p=pstr;
	var temp=url.lastIndexOf(p);
	var l='.html';
	if(temp==-1){
		url=url.substr(0,url.lastIndexOf(l))+'/'+p+'/'+v+l;
	}else{
		temp=url.substr(url.lastIndexOf(p))
		temp=temp.substr(temp.indexOf('/')+1);
		if(temp.indexOf('/')==-1){
			url=url.substr(0,url.lastIndexOf(p))+p+'/'+v+l;
		}else{
			temp=temp.substr(temp.indexOf('/'));
			url=url.substr(0,url.lastIndexOf(p))+p+'/'+v+temp;
		}
	}
	//alert(url);
	document.location.href = url;
}

