if(typeof bb_snifcode=="undefined" || bb_snifcode==0){

//vars

var bb_d = navigator.userAgent.toLowerCase();
var bb_br, bb_qp, bb_ver, bb_pl, bb_st, bb_plgv;
var bb_fl, bb_mp, bb_rp, bb_ar, bb_qt=0;

//detection functions

function bb_checkBrowser() {
	if (bb_checkIt('opera')) bb_br = "OP";
	else if (bb_checkIt('firefox')) bb_br="FF";
	else if (bb_checkIt('netscape')){
		bb_br = "NN";
		bb_ver = bb_d.substr(bb_pl+bb_st.length+1,3);
	}
	else if (bb_checkIt('mozilla/5')){
		bb_br="MO";
		bb_ver = bb_d.substr(bb_d.indexOf('rv:')+3,3);
	}
	else if (bb_checkIt('msie')) bb_br="IE";
	else if (!bb_checkIt('compatible') && bb_checkIt('mozilla')) bb_br="NN";
	else bb_br = "NA";
	if (!bb_ver) bb_ver = bb_d.substr(bb_pl + bb_st.length,3);
}


function bb_checkIt(bb_brname) {
	bb_pl=bb_d.indexOf(bb_brname)+1;
	bb_st=bb_brname;
	return bb_pl;
}


function bb_iePluginDetection(bb_classid) {
	bb_plgv=0;
  document.writeln('<SCR'+'IPT LANGUAGE=VBScript\>');
  document.writeln('on error resume next');
  for(i=1;i<10;i++) document.writeln('if (IsNull(CreateObject("'+bb_classid+'.'+i+'"))) then dummy=0 else bb_plgv='+i+' end if');
  document.writeln('</SCR'+'IPT\>');
}


function bb_nonIePluginDetection(bb_plugin,mime) {
	bb_plgv=0;
	if(navigator.plugins && navigator.plugins.length){
		bb_plugin=bb_plugin.toLowerCase();
		for(var i=0;i<navigator.plugins.length;i++) {
			if(navigator.plugins[i].name.toLowerCase().indexOf(bb_plugin)>=0) {
				bb_plgv=-1;
				if(bb_plugin.indexOf("flash")>=0) {
					var y = navigator.plugins[i].description;
					bb_plgv = y.charAt(y.indexOf('.')-1);
				}
				break;			
			} else if (navigator.plugins[i].description.toLowerCase().indexOf(bb_plugin)>=0) {
				bb_plgv=-1;
				break;
			}
		}
	}
	if (bb_plgv==-1 && navigator.mimeTypes && navigator.mimeTypes.length){
		var x = navigator.mimeTypes[mime];
		if (x && x.enabledPlugin)
			bb_plgv = -1;
	}
}


// base functions
function bb_getQueryParams(wnd) {
	var qp=new Object();
	var qs=wnd.location.search;
	qs=qs.substr(qs.indexOf("?")+1);
	var allParams=qs.split("&");
	for(var i=0;i<allParams.length;i++) {
		keyVal=allParams[i].split("=");
		qp[keyVal[0]]=unescape(keyVal[1]);
	}
	return qp;
}


function bb_showImage(qpo,wnd) {
	var hrefcode="<a href="+qpo.r+" target="+qpo.ta+">";
	var htmlcode="<img src="+qpo.u+'logos/'+qpo.im+" width="+qpo.w+" height="+qpo.h+" ";
	if (qpo.st) htmlcode+='alt="'+qpo.st+'" ';
	htmlcode+="border="+qpo.bo+" ";
	htmlcode+="/></a>";
	if (qpo.st) {
		htmlcode+="<br>"+hrefcode+qpo.st+"</a>";
	}
	wnd.document.write(hrefcode+htmlcode);
}


function bb_domCreateAnchor(qpo,dc) {
	var kotva=dc.createElement("A");
	kotva.href=qpo.r;
	kotva.target=qpo.ta;
	return kotva;
}


function bb_domCreateImg(qpo,dc) {
	var obrazek=dc.createElement("IMG");
	obrazek.src=qpo.u+'logos/'+qpo.im;
	obrazek.width=qpo.w;
	obrazek.height=qpo.h;
	if (qpo.st) obrazek.alt=qpo.st;
	obrazek.border=qpo.bo;
	return obrazek;
}


function bb_domShowImage(qpo) {
	var dc=(qpo.ii==1)? parent.document:document;
	var divref=bb_getRefTo("div"+qpo.id,dc);
	if (divref) {
		var kotva1=bb_domCreateAnchor(qpo,dc);
		var obrazek=bb_domCreateImg(qpo,dc);
		var bebo=kotva1.appendChild(obrazek);
		divref.appendChild(kotva1);
		if (qpo.st) {		
			var kotva2=bb_domCreateAnchor(qpo,dc);
			var radkovani=dc.createElement("BR");
			var subtitle=dc.createTexNode(qpo.st);
			kotva2.appendChild(subtitle);
			divref.appendChild(radkovani);
			divref.appendChild(kotva2);
		}			
	}	
}


function bb_showFlashObj(qpo,wnd) {
  var htmlcode='<OBJECT id=fls'+qpo.id+' name=fls'+qpo.id+' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width='+qpo.w+' height='+qpo.h+'>';
  htmlcode+='<PARAM NAME=movie VALUE="'+qpo.u+'logos/'+qpo.ff+'?clickthru='+escape(qpo.r)+'&clickTag='+escape(qpo.r)+'">';
  if (qpo.wm) htmlcode+='<PARAM NAME=wmode VALUE="'+(qpo.wm==1 ? 'transparent' : 'opaque')+'">';
  htmlcode+='</OBJECT>';
  wnd.document.write(htmlcode);
}


function bb_showFlashEmb(qpo,wnd) {
  var htmlcode='<embed id=fls'+qpo.id+' name=fls'+qpo.id+' src="'+qpo.u+'logos/'+qpo.ff+'?clickthru='+escape(qpo.r)+'&clickTag='+escape(qpo.r)+'"';
  if (qpo.wm) htmlcode+=' wmode='+(qpo.wm==1 ? 'transparent' : 'opaque');
  htmlcode+=' quality=high type="application/x-shockwave-flash" width='+qpo.w+' height='+qpo.h+'></embed>';
  wnd.document.write(htmlcode);
}


function bb_getRefTo(objID,dc) {
  var objRef=null;
  if (!dc) dc=document;
  if (dc.getElementById && dc.getElementById(objID) != null)
	  objRef = dc.getElementById(objID);
  else if (dc.layers && dc.layers[objID] != null)
  	objRef= dc.layers[objID];
  else if (dc.all)
  	objRef=dc.all[objID];
  return objRef;
}


function bb_resizeIframe(qpo) {
	var w,h;
	w=parseInt(qpo.w);
	h=parseInt(qpo.h);
	if (qpo.bo==1) {w+=2; h+=2;} //border
	if (qpo.st) {h+=13;} //subtitle
	var ifrref=bb_getRefTo("ifr"+qpo.id,document);
	var divref=bb_getRefTo("div"+qpo.id,document);
	if (divref.style) {
		divref.style.width=w+"px";
		divref.style.height=h+"px";
	}	
	if (ifrref.style) {
		ifrref.style.width=w+"px";
		ifrref.style.height=h+"px";
		ifrref.style.top="0px";
		ifrref.style.left="0px";
		ifrref.style.visibility="visible";
	} 

}

/**
 * 2005-03-15 ToDo: dopilovat send/target detekci
 * @param string bb_domain ... ad domena napr. 'ad2.bbmedia.cz'
 * @param string bb_id ... id ad pozice 'S/S/P/T'
 * @param bool bb_useifr ... 0/1=neifr/ifr
 * @param string bb_params ... "&par1=val1&par2=val2&..."
 **/
function bb_placeAd(bb_domain,bb_id,bb_useifr,bb_params){
  var bb_bbm='http://'+bb_domain+'/please/showit/'+bb_id+'/';
  var bbs=screen,bbn=navigator,bbh='&ubl='+bbn.browserLanguage+'&ucc='+bbn.cpuClass+'&ucd='+bbs.colorDepth+'&uce='+bbn.cookieEnabled+'&udx='+bbs.deviceXDPI+'&udy='+bbs.deviceYDPI+'&usl='+bbn.systemLanguage+'&uje='+bbn.javaEnabled()+'&uah='+bbs.availHeight+'&uaw='+bbs.availWidth+'&ubd='+bbs.bufferDepth+'&uhe='+bbs.height+'&ulx='+bbs.logicalXDPI+'&uly='+bbs.logicalYDPI+'&use='+bbs.fontSmoothingEnabled+'&uto='+(new Date()).getTimezoneOffset()+'&uti='+(new Date()).getTime()+'&uui='+bbs.updateInterval+'&uul='+bbn.userLanguage+'&uwi='+bbs.width+'&href='+escape(location.href.substr(0,64));
  
  if (bb_br=="NA" || (bb_br=="OP" && bb_ver<7) || (bb_br=='NN' && bb_ver<6) || !bb_useifr) {
	document.write('<div style="position:relative;float:none;clear:both;" id="div'+bb_id+'">');
  	document.write('<scr'+'ipt type="text/javascript" src="'+bb_bbm+'?typkodu=js&bb_ii=0&bb_id='+bb_id+bb_params+bbh+'&bust='+Math.random()+'"></scr'+'ipt>');
  } else {
	document.write('<div style="position:relative;float:none;clear:both;width:0px;height:0px;" id="div'+bb_id+'">');
  	document.write("<iframe src='/bb/bb_codeifrnew.htm?bb_domain="+escape(bb_domain)+"&bb_id="+bb_id+"&bb_par="+escape(bb_params)+"' scrolling=no vspace=0 hspace=0 name='ifr"+bb_id+"' id='ifr"+bb_id+"' style='position:absolute;visibility:hidden;width:100px;height:100px;' frameborder=0 marginheight=0 marginwidth=0 allowtransparency=true ></iframe>");
	document.write('<div style="display:inline;" id="hlp'+bb_id+'"></div>');
  }
  document.write("</div>");
}


// action
bb_checkBrowser();
//bb_plgv muze byt -1, jsou ty ify dobre?
if (bb_br=="IE"){
	bb_iePluginDetection("ShockwaveFlash.ShockwaveFlash"); if (bb_plgv) {bb_fl=1; bb_fv=bb_plgv;}
	bb_iePluginDetection("MediaPlayer.MediaPlayer"); if (bb_plgv) {bb_mp=1; bb_mv=bb_plgv;}
	bb_iePluginDetection("QuickTimeCheckObject.QuickTimeCheck");if (bb_plgv) {bb_qt=1; bb_qv=bb_plgv;}
	bb_iePluginDetection("rmocx.RealPlayer G2 Control"); if (bb_plgv) {bb_rp=1; bb_rv=bb_plgv;}
	if (!bb_rp){ bb_iePluginDetection('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)'); if (bb_plgv) {bb_rp=1; bb_rv=bb_plgv;}}
	if (!bb_rp){ bb_iePluginDetection('RealVideo.RealVideo(tm) ActiveX Control (32-bit)'); if (bb_plgv) {bb_rp=1; bb_rv=bb_plgv;}}
	bb_iePluginDetection("PDF.PdfCtrl"); if (bb_plgv) {bb_ar=1; bb_av=bb_plgv;}
} else {
	bb_nonIePluginDetection("Shockwave Flash",'application/x-shockwave-flash');  if (bb_plgv) {bb_fl=1; bb_fv=bb_plgv;} ;
	bb_nonIePluginDetection("QuickTime",'video/quicktime');if (bb_plgv) {bb_qt=1; bb_qv=bb_plgv;}
	bb_nonIePluginDetection("RealPlayer",'audio/x-pn-realaudio-plugin'); if (bb_plgv) {bb_rp=1; bb_rv=bb_plgv;}
	bb_nonIePluginDetection("Windows Media Player",'application/x-mplayer2'); if (bb_plgv) {bb_mp=1; bb_mv=bb_plgv;};
	bb_nonIePluginDetection("Acrobat",'application/pdf'); if (bb_plgv) {bb_ar=1; bb_av=bb_plgv;}
}
bb_ver=parseInt(bb_ver);
bb_qp=new Array();

bb_snifcode=1;
}
