//#########################################################################################################################################
// 
//  Function: AccessLog
//  Name: accesslog.js
//  Location: http://222.146.61.107/js/accesslog.js
//

//*
var host = location.hostname;
var strAccessLogURL6 = "http://" +  host + "/sys/acc/acclog.php";


/** 
 * Function:  Write tags of AccessLog
 * @param strCode ライセンスコード
 * @param strTitle ページタイトル
 * @since 2006-07-12
 */
function AccessLog2(strCode , strTitle)
{
	if( strTitle == null ) strTitle = document.title;
	document.write( "<img src=\"" + strAccessLogURL6 + "?" );
	document.write( "referer=" + document.referrer + "&" );

	document.write( "width="   + screen.width      + "&" );

	document.write( "height="  + screen.height     + "&" );
	
	document.write( "color="   + screen.colorDepth + "&" );
	
	document.write( "license=" + strCode           + "&" );
	
	document.write( "title="   + encodeURLextra2( strTitle ) );
	
	document.write( "\" width=\"1\" height=\"1\">" );

}

/** 
 * Function:  Write tags of AccessLogBookmark
 * @param strCode ライセンスコード
 * @param strTitle ページタイトル
 * @since 2006-07-12
 */
function AccessLogBookmark2( strLicenceCode , strFileName )
{
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	if( isIE )
	{
		if( getBrowserVersion() < 8)
		{
			// for Internet Explorer (WIN)
			document.write( "<link rel=\"shortcut icon\" href=\"" + strAccessLogURL6 );
			document.write( "?menu=bookmark" );
			document.write( "&license=" + strLicenceCode );
			document.write( "&file=" + strFileName + "\">" );	
		}
	}
	else
	{
	
	}
}


function getBrowserVersion() { // @return Number:
  return window.opera ? (opera.version().replace(/\d$/, "") - 0) // Opera10 shock
                      : parseFloat((/(?:IE |fox\/|ome\/|ion\/)(\d+\.\d)/.
                                   exec(navigator.userAgent) || [,0])[1]);
}


function encodeURLextra2(str){
	var i, encoded_str, 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 {
			if (((0x30 <= char_code) && (char_code <= 0x39)) || ((0x41 <= char_code) && (char_code <= 0x5a)) || ((0x61 <= char_code) && (char_code <= 0x7a))){
				encoded_str += str.charAt(i);
			}
			else if ((char_code == 0x2a) || (char_code == 0x2e) || (char_code == 0x2d) || (char_code == 0x5f)) {
				encoded_str += str.charAt(i);
			}
			else {
				if ( char_code > 0xffff ) {
					encoded_str += "%" + ((char_code >> 18) | 0xf0).toString(16).toUpperCase();
					encoded_str += "%" + (((char_code >> 12) & 0x3f) | 0x80).toString(16).toUpperCase();
					encoded_str += "%" + (((char_code >> 6) & 0x3f) | 0x80).toString(16).toUpperCase();
					encoded_str += "%" + ((char_code & 0x3f) | 0x80).toString(16).toUpperCase();
				}
				else if ( char_code > 0x7ff ) {
					encoded_str += "%" + ((char_code >> 12) | 0xe0).toString(16).toUpperCase();
					encoded_str += "%" + (((char_code >> 6) & 0x3f) | 0x80).toString(16).toUpperCase();
					encoded_str += "%" + ((char_code & 0x3f) | 0x80).toString(16).toUpperCase();
				}
				else if ( char_code > 0x7f ) {
					encoded_str += "%" + (((char_code >> 6) & 0x1f) | 0xc0).toString(16).toUpperCase();
					encoded_str += "%" + ((char_code & 0x3f) | 0x80).toString(16).toUpperCase();
				}
				else {
					padded_str = "0" + char_code.toString(16).toUpperCase();
					encoded_str += "%" + padded_str.substr(padded_str.length - 2, 2);
				}
			}
		}
	}
	return encoded_str;
}

