if(typeof current_swf=="undefined")
{
current_swf = 'none';
}
var old_req_percent=-1;
function getUpdate(typ,pr1,pr2,swf) { 

var client = new XMLHttpRequest();
if(typ == 'state' && pr1 == 2) {
s = getDuration(swf);
setStopPoints(swf, s);
sp = getStopPoints(swf);
//alert(sp);
//test.innerHTML = sp;
}
if(typ == 'time')
{
//test.innerHTML = sp.length;
for(i=0;i<sp.length;i++)
{
if(pr1 == sp[i])
{
var percent = (sp[i]/s)*100;
percent = Math.round(percent);

if(old_req_percent == percent)
{
//test.innerHTML = old_req_percent + " return\n";
return;
}
else
{
old_req_percent = percent;
//test.innerHTML = old_req_percent + "NOT return\n";
}

//test.innerHTML = percent;
client.open("GET", '/system/loficount.php?st=0&percent=' + percent + '&trackid=' + swf);
client.send();
}
}   
}

if(typ == 'state' && pr1 == 2)
{
if(swf!=current_swf)
{
if(current_swf !='none')
{
stopCurrent(current_swf);
}
current_swf=swf;
}

}
};
function stopCurrent(current_swf) { 
//alert(current_swf);
thisMovie(current_swf).sendEvent("stop"); 
};
function thisMovie(swf) {
if(navigator.appName.indexOf("Microsoft") != -1) {
return window[swf];
} else {
return document[swf];
}
};
var lenghtArr = Array();
	var stopPoints = Array();
	function getDuration(swf)
	{
	var tmp = swf.replace("p", "");
	return lenghtArr[tmp];
	}
	function setDuration(id, duration)
	{
	lenghtArr[id] = duration;
	}
	function setStopPoints(swf, curDuration)
	{
	 var points = new Array();
	 var j=0;
	 for(i=0;i<=curDuration;i+=10)
	 {
	  points[j]=i;
	  
	  j++;
	 }
	 stopPoints[swf]=points;
	}
	function getStopPoints(swf)
	{
	 return stopPoints[swf]
	}
