
tpQOSTypeArray=new Array();var tpQOScurrentPL;var tpQOSunloading;function tpRegisterQOSType(eventType,mediaType,callback)
{for(var i=1;i<tpQOSTypeArray.length;i++)
{if(tpQOSTypeArray[i].eventType==eventType&&tpQOSTypeArray[i].mediaType==mediaType&&tpQOSTypeArray[i].callback==callback)
{return;}}
var qosTypeObj={mediaType:mediaType,eventType:eventType,callback:callback}
tpQOSTypeArray.push(qosTypeObj);}
function tpUnregisterQOSType(type,callback)
{for(var i=1;i<tpQOSTypeArray.length;i++)
{if(tpQOSTypeArray[i].eventType==eventType&&tpQOSTypeArray[i].mediaType==mediaType&&tpQOSTypeArray[i].callback==callback)
{tpQOSTypeArray.splice(i,1);break;}}}
function tpReceiveQOSEvent(eventType,mediaType,obj)
{if(obj==undefined)return;if(eventType=="onClipTime"||eventType=="onPlaylistBegin")
{tpQOScurrentPL=obj;}
else if(eventType=="onPlaylistEnd")
{tpQOScurrentPL=null;}
for(var i=0;i<tpQOSTypeArray.length;i++)
{if(tpQOSTypeArray[i].eventType==eventType&&(mediaType=="ALL"||tpQOSTypeArray[i].mediaType==mediaType||tpQOSTypeArray[i].mediaType=="ALL"))
{eval(tpQOSTypeArray[i].callback)(obj);}}}
window.onunload=function()
{tpQOSUnload();}
function tpQOSUnload()
{if(tpQOScurrentPL==undefined||tpQOScurrentPL==null)return;tpQOSunloading=true;tpReceiveQOSEvent("onPlaylistEnd","ALL",tpQOScurrentPL);}
function tpQOSSendURL(url)
{var connection=new Image();connection.src=url;if(tpQOSunloading)
{for(i=0;((!connection.complete)&&(i<100000));i++)
{}}}