/**
 * logger.js
 */
var logger = new Object(
	{
		str:'',
		navi:navigator,
		doc:document,
		
		logging:function(url, site, siteId, page, pageId, sub, subId, uid, attr,working_dir){
			this.str += 'action_logAPI=true';
			
			this.str += '&site=' + encodeURIComponent(site);
			this.str += '&siteId=' + siteId;
			this.str += '&page=' + encodeURIComponent(page);
			this.str += '&pageId=' + pageId;
			this.str += '&sub=' + encodeURIComponent(sub);
			this.str += '&subId=' + subId;
			this.str += '&uid=' + uid;
			this.str += '&attr=' + encodeURIComponent(attr);
			this.str += '&working_dir=' + encodeURIComponent(working_dir);

			this.str += '&nu=' + encodeURIComponent(this.navi.userAgent);
			this.str += '&np=' + this.navi.platform;
			this.str += '&nl=';
			this.str += this.navi.language ? this.navi.language : this.navi.browserLanguage;
			this.str += '&dr=' + encodeURIComponent(this.doc.referrer);
			this.str += '&dl=' + encodeURIComponent(this.doc.location);

			if(this.createHttpObj()){
				xmlHttpObj.open('POST', url, true);
				xmlHttpObj.onreadystatechange = function() {
					if(xmlHttpObj.readyState == 4 && xmlHttpObj.status == 200) {
					}
				}
				xmlHttpObj.setRequestHeader('Content-Type' ,'application/x-www-form-urlencoded; charset=utf-8');
				xmlHttpObj.send(this.str + '&ajax=1');
				return null;
			}else{
				return url + '?' + this.str + '&ajax=0';
			}
		},
		
		xmlHttpObj:null,
		createHttpObj:function(){
			if(window.ActiveXObject){
				try {
					xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP");
				} catch(e) {
					try{
						xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP");
					} catch(e) {
						return false;
					}
				}
			} else if (window.XMLHttpRequest){
				xmlHttpObj = new XMLHttpRequest();
			} else {
				return false;
			}
			return true;
		}
	}
);

