﻿function _kflashc(handly)
{
	var url=('https:' == document.location.protocol ? 'https://' : 'http://') + "as.kejet.net/cookie.swf";
	this.rid= this.getRandid();
	this.handly = handly;
	
	this.LINESPLIT = "\n";
	this.FIELDSPLIT = "\t";
	
	this.flashcount  = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='0' height='0' id='"+this.rid+"' align='middle'><param name='movie'  value='" +  url + "' /><param name='allowScriptAccess' value='always' /><param name='loop' value='false' /><embed src='" + url + "' id='"+this.rid+"' name='"+this.rid+"'  width='0' height='0' loop='false' allowScriptAccess='always'></embed></object>";
	
	document.write(this.flashcount);
	
	this.flash  = this.getF(this.rid);
}

_kflashc.prototype.getRandid=function()
{
	var rc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ_";
	var buf = "";
	for (var i=0; i <12 ; i++)
	{
		buf += rc.substr(Math.random()*rc.length,1);
	}
	
	return buf;
};

_kflashc.prototype.getF=function(f)
{
	  if (navigator.appName.indexOf("Microsoft") > -1)
	  { 
	  	return document.getElementById(f); 
	  }
	  else
	  {
	  	return document[f];
	  }
}

_kflashc.prototype.addShow=function(admid,orderid,placeid)
{
	this.flash.addShowlist(admid,orderid,placeid);
	//this.flash.setS("showlist",admid+this.FIELDSPLIT+orderid+this.FIELDSPLIT+placeid+this.FIELDSPLIT+new Date().getTime()+this.LINESPLIT+str);
}

_kflashc.prototype.getShow=function(admid)
{
	var str = this.flash.getS("showlist");
	//alert(this.flash+str)
	var list =  str.split(this.LINESPLIT);
	var rearr = new Array();
	rearr["order_id"]="";
	rearr["media_place_id"]="";
	rearr["time"]="";
	
	for (var i=0,len=list.length; i<len; i++)
	{
		var t = list[i].split(this.FIELDSPLIT);
		if (t.length ==4  && admid==t[0])
		{
			rearr["order_id"]=t[1];
			rearr["media_place_id"]=t[2];
			rearr["time"]=t[3];
			break;
		}
	}
	return rearr;
}

//flash loaded
_kflashc.prototype.fover=function()
{
	if (this.handly!=null)
	{
		eval(this.handly);
	}
}
