function URLencode(str){
	 var encoded_str, i, char_code, padded_str;
	 encoded_str = "";
	 for (i = 0; i < str.length; i++){
	     char_code = str.charCodeAt(i);
	     if (char_code == 0x20){
		encoded_str += "+";}
	     else { // else 1
		  if ( ((char_code >= 0x30) && (char_code <= 0x39)) || ((char_code >= 0x41) && (char_code <= 0x5a)) || ((char_code >= 0x61) && (char_code <= 0x7a))){
		     encoded_str += str.charAt(i);
		  }
		  else { // else 2
		       if ( char_code > 0xffff ) {
			  // for UTF-8
			  padded_str = "0" + char_code.toString(16);
			  encoded_str += "%" + padded_str.substr(padded_str.length - 6, 2) + "%" + padded_str.substr(padded_str.length - 4, 2) + "%" + padded_str.substr(padded_str.lenght - 2, 2);
		       }
		       else if ( char_code > 0xff ) {
			  // for JIS, EUC or SJIS
			  padded_str = "0" + char_code.toString(16);
			  encoded_str += "%" + padded_str.substr(padded_str.length - 4, 2) + "%" + padded_str.substr(padded_str.lenght - 2, 2);
		       }
		       else {
			  // for ascii
			  padded_str = "0" + char_code.toString(16);
			  encoded_str += "%" + padded_str.substr(padded_str.length - 2, 2);
		       }
		    } // else 2
		} // else 1
	} // for
	return encoded_str;
}

document.write("<a href=\"http://www.platypus.st/exec/show_access_analysis.rb");
if (site.length !=0 ){
   document.write("?site=" + URLencode(site));
}
document.write("\">");

document.write("<img src=\"http://www.platypus.st/exec/access_analysis.rb");
if ((typeof(site) != "undefined") && (site.length !=0 )){
   document.write("?site=" + URLencode(site));
} else {
   document.write("?site=");
}
if (document.referrer.length !=0 ){
   document.write("&ref=" + URLencode(document.referrer));
} else {
}
if (document.URL.length !=0 ){
   document.write("&url=" + URLencode(document.URL));
} else {
}
if ((typeof(img) != "undefined") && (img.length !=0 )){
   document.write("&img=" + URLencode(img));
} else {
}
document.write("\"><br></a>");
