inicializovano = false;
posunutej = false;
window.defaultStatus = "GAMBRINUS.cz";

function MM_preloadImages() { //v3.0
   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_preloadImagesX(str) { 
    for(i=0,a=str.split(","),x=new Array(); i<a.length; i++) {
        x[i] = new Image();
        x[i].src = eval(a[i]);
//        x[i].onload = function() { alert(this.src) };
    }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function init(){ 
	page=new lib_doc_size();
	browser = new lib_bwcheck();
	if (houmpejdz && is_fl6) {
		tabw = 828;
		tabh = 535;
		if (browser.ie) {
    		duch = new lib_obj('duchDiv');
			duchw = 300;
			duchh = 200;
			duchx = page.x50+tabw/2-duchw-40;
			if (browser.ns4) duchx -= 8;
			duchy = tabh-duchh-50;
			if (duchx < tabw-duchw) duchx = tabw-duchw;
			duch.moveIt(duchx,duchy);
		   	writeduch('');
    		duch.showIt();
		} else {/*
    		duch = new lib_obj('duchDivX');
			duchw = 68;
			duchh = 118;
			duchx = page.x50+tabw/2-duchw-60;
			if (browser.ns4) duchx -= 8;
			duchy = tabh-duchh-50;
			if (duchx < tabw-duchw) duchx = tabw-duchw;
            duch.moveIt(duchx,duchy);
			writeduch_nosay(); */
		}
	} else {
		if (!browser.ie) return;
		if (!document.all['duchsubDiv']) return;
		duch = new lib_obj('duchsubDiv')
		posx = Math.random();
		posy = Math.random();
		posx = parseInt(posx*page.x2);
		posy = parseInt(posy*page.y2);
		duch.moveIt(posx,posy)
		writeduch();
		duch.showIt();
//		duchSay('posx = '+posx+' posy = '+posy);
		slide();
	}
	inicializovano = true;
	return;
}

function Active(obj,par){
if  (document.all && document.all != null) {
	(par==1)? obj.style.background = "#FFFFFF" : obj.style.background = "#FFC97C";
 }		
}	

function writeduch() {
	duch.writeIt('<object id="flashduch" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="300" height="200"><PARAM NAME="wmode" VALUE="transparent"><param name="swliveconnect" value="true"><param name="movie" value="'+abspath+'_swf/duch.swf"><param name="quality" value="best"><param name="play" value="true"><embed name="flashduch" src="'+abspath+'_swf/duch.swf" type="application/x-shockwave-flash" width="300" height="200" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" quality="best" play="true" swliveconnect="true"></embed></object>');
}	

function duchSay(text) {
	if (!inicializovano) return;
	else if (!browser.ie) return;
	if (browser.ie5 || browser.ie6) document.getElementById('flashduch').setVariable("duchText",text);
	else document.all['flashduch'].setVariable("duchText",text);
}

function writeduch_nosay() {
//	duch.writeIt('<object id="duch-nosay" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version5,0,0,0" width="68" height="118"><param name="swliveconnect" value="true"><param name="movie" value="_swf/duch-nosay.swf"><param name="quality" value="best"><param name="play" value="true"><embed name="duch-nosay" src="'+abspath+'_swf/duch-nosay.swf" type="application/x-shockwave-flash" width="68" height="118" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" quality="best" play="true" swliveconnect="true"> </embed></object> ');
    return true;
}	

function duchClick(arg) {
	if (arg == "nosay") alert('Pivní duch Vás bude provázet po stránkách pouze v Internet Exploreru');
//	if ((arg == "say") && inicializovano) duch.circleIt(100,5,0,360,duch.x-100,duch.y,10);
}
function duchOver(arg) {
	if (inicializovano && !houmpejdz) {
//		alert(duch.x);
		if (posunutej) {
			x = duch.x+150;
			y = duch.y+50;
		} else {
			x = duch.x-150;
			y = duch.y-50;
		}
		posunutej = !posunutej;
//		duch.circleIt(100,5,0,360,duch.x-100,duch.y,10);
		duch.slideIt(x,y,5,5);
	}
}
function duchOut(arg) {

}

function slide() {
   xxx= duch;
   posx = 450;
   posy = page.y2 + document.body.scrollTop - 230;
   if(!posunutej) xxx.slideIt(posx,posy,5,5);
   setTimeout('slide()',100);
}

idx = 0;
onloadImArr = new Array();
  onloadImArr[idx++] = "../../_clip/downlista/gcom_on.gif";
  onloadImArr[idx++] = "../../_clip/downlista/reg_on.gif";
  onloadImArr[idx++] = "../../_clip/downlista/reg_on.gif";
  onloadImArr[idx++] = "../../_clip/downlista/sub_on.gif";
  onloadImArr[idx++] = "../../_clip/toplista/piva_on.gif";
  onloadImArr[idx++] = "../../_clip/toplista/rock_on.gif";
  onloadImArr[idx++] = "../../_clip/toplista/hodpody_on.gif";
  onloadImArr[idx++] = "../../_clip/toplista/souteze_on.gif";
  onloadImArr[idx++] = "../../_clip/toplista/fotbal_on.gif";
  onloadImArr[idx++] = "../../_clip/toplista/reklama_on.gif";
  onloadImArr[idx++] = "../../_clip/toplista/zabava_on.gif";
  onloadImArr[idx++] = "../../_clip/toplista/ohlasy_on.gif";
  onloadImArr[idx++] = "../../_clip/toplista/home_on.gif";

onloadFnArr = new Array();
onloadFnArr[onloadFnArr.length] = 'init();'
onload = function () {
	for (i=0;i<onloadFnArr.length;i++) {
//        alert(onloadFnArr[i]);
		eval(onloadFnArr[i]);
	}
	preload = "\"";
	for (i=0;i<onloadImArr.length;i++) preload += abspath + onloadImArr[i] + "\",\"";
	preload = preload.substring(0,preload.length-2);
    MM_preloadImagesX(preload);
}
onresize = function () {
	location.href = location.href;	
}


