﻿var chinarwzj = {
    urlencode: function(str){
        var i,temp,p,q;
	    var result="";
	    for(i=0;i<str.length;i++){
		    temp = str.charCodeAt(i);
		    if(temp>=0x4e00){
			    execScript("ascCode=hex(asc(\""+str.charAt(i)+"\"))", "vbscript");
			    result+=ascCode.replace(/(.{2})/g, "%$1");
		    }else{
			    result+=escape(str.charAt(i));
		    }
	    }
	    return result;
    },
    urldecode: function(str){
	    var i,temp;
	    var result="";
	    for(i=0;i<str.length;i++){
		    if(str.charAt(i)=="%"){
			    if(str.charAt(++i)=="u"){
				    temp=str.charAt(i++) + str.charAt(i++) + str.charAt(i++) + str.charAt(i++) + str.charAt(i);
				    result += unescape("%" + temp);
			    }else{
				    temp = str.charAt(i++) + str.charAt(i);
				    if(eval("0x"+temp)<=160){
					    result += unescape("%" + temp);
				    }else{
					    temp += str.charAt(++i) + str.charAt(++i) + str.charAt(++i);
					    result += Decode_unit("%" + temp);
				    }
			    }
		    }else{
			    result += str.charAt(i);
		    }
	    }
	    return result;
    }
};

(function($){
    /* jQuery图片预加载插件
    ------------------------------*/
    $.fn.loadthumb = function(options){
	    options = $.extend({src : ""}, options);
	    var _self = this;
	    _self.hide();
	    var img = new Image();
	    $(img).load(function(){
		    _self.attr("src", options.src);
		    _self.fadeIn("slow");
	    }).attr("src", options.src);  //.attr("src",options.src)要放在load后面，
	    return _self;
    }
    
})(jQuery);

