jQuery.extend( {
         param:function( a ) {
		var s = [];

		// If an array was passed in, assume that it is an array
		// of form elements
		if ( a.constructor == Array || a.jquery )
			// Serialize the form elements
			jQuery.each( a, function(){
				s.push( jQuery.dlmEncode(this.name) + "=" + jQuery.dlmEncode( this.value ) );
			});

		// Otherwise, assume that it's an object of key/value pairs
		else
			// Serialize the key/values
			for ( var j in a )
				// If the value is an array then the key names need to be repeated
				if ( a[j] && a[j].constructor == Array )
					jQuery.each( a[j], function(){
						s.push( jQuery.dlmEncode(j) + "=" + jQuery.dlmEncode( this ) );
					});
				else
					s.push( jQuery.dlmEncode(j) + "=" + jQuery.dlmEncode( a[j] ) );

		// Return the resulting serialization
		return s.join("&").replace(/%20/g, "+");
	},
        dlmEncode:function( el ) {
          if (typeof(document.characterSet)!="undefined")   return (document.characterSet.toUpperCase()=="ISO-8859-1") ? escape(el) : encodeURIComponent(el);
          if (typeof(document.charset)!="undefined")        return (document.charset.toUpperCase()=="ISO-8859-1") ? escape(el) : encodeURIComponent(el);
          if (typeof(document.defaultCharset)!="undefined") return (document.defaultCharset.toUpperCase()=="ISO-8859-1") ? escape(el) : encodeURIComponent(el);
          return encodeURIComponent(el);
        }
      } );
