function RegisterNamespaces(){
for(var i=0;i<arguments.length;i++){
var p=arguments[i].split("."),w=window;
for(var j=0;j<p.length;j++){
if(!w[p[j]]){
w[p[j]]=new Object();
}
w=w[p[j]];
}
}
}
RegisterNamespaces("Inpl.Stream");
Inpl.Stream=new function(){
var _5=this,_6=[],fn="Inpl.Stream.",_8=null,_9=0,_a=0,_b=128;
this.SPEED_56=1;
this.SPEED_128=2;
this.SPEED_300=3;
this.InsertVideo=function(id,_d,w,h,s,t,n,a){
try{
speedDetectFinish();
var p=$(id);
if(_8&&!a){
a=_8;
_8=null;
}
if(blockStream&&blockStream==1){
p.innerHTML="<p class=\"error\"><strong>W tej chwili zbyt wiele osób łączy się z serwerem.</strong><br />Spróbuj ponownie za chwilę.</p>";
}else{
_6[id]=[_d,w,h,s||3,n,t,a];
p.innerHTML=GetPlayer(id,s);
}
if($(id+"NoScript")){
$(id+"NoScript").removeNode(true);
}
}
catch(e){
}
};
this.InsertAudio=function(id,url,w,s){
try{
speedDetectFinish();
var p=$(id);
_6[id]=[url,w,45,s||3];
if(p){
p.innerHTML=GetPlayer(id,s);
}
if($(id+"NoScript")){
$(id+"NoScript").removeNode(true);
}
}
catch(e){
}
};
this.ChangeSpeed=function(id,_1b){
try{
var u,p,r;
if(_6[id]){
p=$(id+"Player");
if(p&&p.URL){
p.URL=GetUrl(id,_1b);
}else{
$(id).innerHTML=GetPlayer(id,_1b);
}
window.setTimeout(fn+"SetBitrateCookie("+_1b+")",10);
}
}
catch(e){
}
return false;
};
function GetPlayer(id,s){
var l,u=GetUrl(id,s);
if(u){
if(document.all&&!window.opera){
html="<object id=\""+id+"Player\" classid=\"CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,5,0803\" standby=\"Trwa ładowanie komponentów Microsoft Windows Media Player...\" type=\"application/x-oleobject\""+(_6[id][1]?" width=\""+_6[id][1]+"\"":"")+(_6[id][2]?" height=\""+_6[id][2]+"\"":"")+">"+"<param name=\"url\" value=\""+u+"\" />"+"<param name=\"uiMode\" value=\"full\" />"+"<param name=\"wmode\" value=\"opaque\" />"+"</object>";
return html;
}else{
return "<embed type=\"application/x-mplayer2\" wmode=\"opaque\" pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" src=\""+u+"\" id=\""+id+"Player\""+(_6[id][1]?" width=\""+_6[id][1]+"\"":"")+(_6[id][2]?" height=\""+_6[id][2]+"\"":"")+"></embed>";
}
}
}
function speedDetectFinish(){
if(_a){
var _23;
_9=(new Date()).getTime();
if(_9==_a){
_23=1;
}else{
_23=(_9-_a)/1000;
}
var _24=(Math.round(((_b/_23)*8)*10*1.024))/10;
if(_24<130){
bitrate=1;
}else{
if(_24<260){
bitrate=2;
}else{
bitrate=3;
}
}
_5.SetBitrateCookie(bitrate);
}
}
function speedDetect(){
var _25=parseInt(INTPL("getCookie","__INT_BITRATE"));
if(!_25||_25<1||_25>3){
_25=_5.SPEED_300;
}
return _25;
}
this.SetBitrateCookie=function(_26){
INTPL("setCookie","__INT_BITRATE",_26,3600*3,"/",".interia.pl");
};
function GetUrl(id,s){
var b=s||speedDetect(),u,i;
if(b){
b--;
}
if(_6[id][0][b]){
u=_6[id][0][b];
}
if(!u){
for(i in _6[id][0]){
if(_6[id][0][i]){
b=i;
u=_6[id][0][i];
break;
}
}
}
l=$(id+"Speed").getElementsByTagName("DD")[_6[id][3]-1];
l.className=l.className.replace("selected","");
_6[id][3]=parseInt(b)+1;
$(id+"Speed").getElementsByTagName("DD")[b].className+=" selected";
if(_6[id][6]){
u="http://clips.interia.pl/stm/getAdClipPlaylist.html?clipID="+_6[id][4]+"&clipType="+_6[id][5]+"&adClipID="+_6[id][6]+"&bitrate="+(b+1);
}
if(!_6[id][6]&&-1!=navigator.userAgent.indexOf("Firefox/1.5.0.5")){
u="/playlist/?url="+escape(u);
}
return u;
}
this.writeSpeedDetectInfo=function(s,a){
document.write("<p>Trwa detekcja prędkości połączenia...</p><p>Proszę czekać.</p>");
document.write("<script type=\"text/javascript\" src=\"http://clips.interia.pl/checkStream.js.html\"></script>");
var _2e=parseInt(INTPL("getCookie","__INT_BITRATE"));
if(!_2e||_2e<1||_2e>3){
_a=(new Date()).getTime();
document.write("<script type=\"text/javascript\" src=\"http://x.interia.pl/stream/speed_detect.js?t="+_a+"\"></script>");
}
};
this.FullScreen=function(id){
try{
if($(id+"Player").playState==3){
alert("By wyjść z trybu pełnoekranowego naciśnij ESC");
$(id+"Player").fullScreen=true;
}
}
catch(e){
}
};
this.PlayPause=function(id){
try{
if($(id+"Player").playState==3){
$(id+"Player").controls.pause();
}else{
if($(id+"Player").playState==2||$(id+"Player").playState==1){
$(id+"Player").controls.play();
}
}
return $(id+"Player").playState;
}
catch(e){
}
};
this.addAd=function(id){
_8=id;
};
function $(n){
return document.getElementById(n);
}
};


