function SFMag(crc,vname,contractid,flag_f){
	
	var _this = this;
	this.q = new Object();
	this.add = function (k, v) {
		this.q[k] = v;
	};
	
	this.in_array = function (str, arr){
		var max = arr.length;
		for(var i=0;i<max;i++){
			if (str == arr[i])
				return 1;
		}
		return 0;
	};

	this.set1n4 = function(k, v){
		var t=new Date();
		var e=0;
		if(k=='s'){e=300;k='magSc';}
		else if(k=='m'){k='magMc';}
		else if(k=='l'){e=3650*86400;k='magLc';}
		
		var cv=k+'='+escape(v)+'; path=/;';
		
		if (e > 0) {
			t.setTime(t.getTime() + e*1000);
			cv += ' expires='+ t.toGMTString();
		}
	
		document.cookie = cv;
	};
	
	this.get1n4 = function(k){
		var tmp = document.cookie + ';';
		var index1 = tmp.indexOf(k, 0);
		if(index1 != -1){
			tmp = tmp.substring(index1,tmp.length);
			var index2 = tmp.indexOf('=',0) + 1;
			var index3 = tmp.indexOf(';',index2);
			return(unescape(tmp.substring(index2,index3)));
		}
		return '';
	};

	this.getTime = function(){
		var now = new Date();
		return Math.floor(now.getTime()/1000);
	};
	
	this.getUTime = function(){
		var t = new Date();
		return t.getTime() + '.' + t.getMilliseconds();
	};
	
	this.debug = function(){
		var v = new Array();
		for (k in this.q) {
			if (this.q[k]=='undefined'||!this.q[k]||this.q[k]==null) {
				this.q[k] = '';
			}
			//v.push(k + '=' + encodeURIComponent(this.q[k]));
			v.push(k + '=' + this.q[k]);
		}
		//alert(v.join("\n"));
	};

	this.sendLog = function (){
		var v = new Array();
		for (k in this.q) {
			if (this.q[k]=='undefined'||!this.q[k]||this.q[k]==null) {
				this.q[k] = '';
			}
			v.push(k + '=' + encodeURIComponent(this.q[k]));
		}
		
		var t =  new Date();
		v.push('t=' + this.getUTime());
		
		//test
		//alert('<sc'+'ript type="text/javasc'+'ript" charset="utf-8" src="http://localhost/api/getlog.php?'+v.join('&')+'"></sc'+'ript>');
		
		document.write('<sc'+'ript type="text/javasc'+'ript" charset="utf-8" src="http://nsm.shinobi.jp/getlog/?'+v.join('&')+'"></sc'+'ript>');
		//document.write('<sc'+'ript type="text/javasc'+'ript" charset="utf-8" src="http://nagatani.xd1.shinobi.jp:8080/lpo/GetStart?'+v.join('&')+'"></sc'+'ript>');
		return;
	};

	this.getLocation = function(){
		var dl = document.location;
		var p = dl.protocol;
		if (p != 'http:' && p != 'https:') {
			return false;
		}
		this.add('referrer', document.referrer);
		this.add('url', location.href);
		this.add('title', document.title);
		if (document.charset) {
			this.add('cset', document.charset);
		}else{
			this.add('cset', document.characterSet);
		}
		
		return true;

	}
	if (!this.getLocation()) {
		return;
	}

	//this.getFlashVersion();
	//this.getScreen();
	//this.debug();
	this.add('crc', crc);
	this.add('vname', 'mag' + vname);
//	this.add('magSc', this.get1n4('magSc'));
	this.add('magMc', this.get1n4('magMc'));
	this.add('magLc', this.get1n4('magLc'));
	this.add('tzo', (new Date()).getTimezoneOffset()/60);
	this.add('contractid', contractid);
	this.add('f',flag_f);
	this.sendLog();
}
//(function(){

	if(document.ninjasitemastercode){
		
	}else{
		document.ninjasitemastercode = 1;
		var mag2440293402 = new SFMag(859769135,2440293402,'77','1');

	}
	

//})();



