// =========== Kleinigkeiten for UNIMILLS
// =========== created by JaryK
// =========== STUDIO SYNAPSE


//=============================================================
//=====   PRELOAD OBRAZKU
//=============================================================

	//-------------------------------------------------------------
	BUTTONS = new Array('logo_unimills','butt_lang_cestina','butt_lang_english','butt_lang_deutsch','butt_kontakt','butt_kontakt_en','butt_zpatky','butt_mapa','butt_mapa_en','butt_mapa_de');
	JPGBUTTONS = new Array('home_mlyny','home_vyrobci','home_vykup','home_doprava_de','home_mlyny_de','home_vyrobci_de','home_vykup_de','home_doprava_de','home_mlyny_en','home_vyrobci_en','home_vykup_en','home_doprava_en');
	IMGS = new Array('');
	preload_buttons();
	preload_jpg_buttons();
//	preload_imgs();


//=============================================================
//=====   FUNKCE PRO PRELOAD OBRAZKU
//=============================================================

	//-------------------------------------------------------------
	function preload_buttons(){
		for(i=0;i<BUTTONS.length;i++){
			eval("BUTT_" + BUTTONS[i] + "_out=new Image()");
			eval("BUTT_" + BUTTONS[i] + "_out.src=\"obrazky/" + BUTTONS[i] + ".gif\"");
			eval("BUTT_" + BUTTONS[i] + "_over=new Image()");
			eval("BUTT_" + BUTTONS[i] + "_over.src=\"obrazky/" + BUTTONS[i] + "_over.gif\"");
		}
	}
	//-------------------------------------------------------------
	function preload_jpg_buttons(){
		for(i=0;i<JPGBUTTONS.length;i++){
			eval("BUTT_" + JPGBUTTONS[i] + "_out=new Image()");
			eval("BUTT_" + JPGBUTTONS[i] + "_out.src=\"obrazky/" + JPGBUTTONS[i] + ".jpg\"");
			eval("BUTT_" + JPGBUTTONS[i] + "_over=new Image()");
			eval("BUTT_" + JPGBUTTONS[i] + "_over.src=\"obrazky/" + JPGBUTTONS[i] + "_over.jpg\"");
		}
	}
	//-------------------------------------------------------------
	function preload_imgs(){
		for(i=0;i<IMGS.length;i++){
			eval("IMG_" + i + "=new Image()");
			eval("IMG_" + i + ".src=\"obrazky/" + IMGS[i] + ".gif\"");
		}
	}


//=============================================================
//=====   INTERAKCE V NAVIGACI
//=============================================================

	//-------------------------------------------------------------
	function butt_over(jmeno,obj){
		obj.src=eval("BUTT_" + jmeno + "_over.src");
	}
	function butt_out(jmeno,obj){
		obj.src=eval("BUTT_" + jmeno + "_out.src");
	}


//=============================================================
//=====   OTEVIRANI EXTERNICH OKEN
//=============================================================

	//-------------------------------------------------------------
	function ext_window(adresa){
		w1=window.open(adresa,"noveokno");
		w1.focus();
	}


//=============================================================
//=====   Oprava dementniho IE6
//=============================================================

	//-------------------------------------------------------------
	function gogo_ie6_fix(){
		document.body.style.height=document.documentElement.scrollHeight + 'px';
	}


//=============================================================
//=====   GALERIE v.1.0.3
//=============================================================

	//-------------------------------------------------------------
	GalLoading = new Image();
	GalLoading.src = "obrazky/ref-loading.gif";
	//-------------------------------------------------------------
	function gogo_gallery_picture(picname,xwidth,yheight){

		GalleryBackground=document.getElementById('gallerybcg');
		GalleryPictureContainer=document.getElementById('gallerypicturecontainer');
		GalleryPicture=document.getElementById('gallerypicture');

		GalleryBackground.style.visibility='visible';
		GalleryPictureContainer.style.visibility='visible';
		GalleryPicture.style.visibility='visible';

		GalleryPicture.src=picname;

		VyskaDokumentu=document.all ? document.body.offsetHeight : document.height;

		if( typeof( window.innerWidth ) == 'number' ) {
			SirkaProhlizece = window.innerWidth;
			VyskaProhlizece = window.innerHeight;
		}
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			SirkaProhlizece = document.documentElement.clientWidth;
			VyskaProhlizece = document.documentElement.clientHeight;
		}
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			SirkaProhlizece = document.body.clientWidth;
			VyskaProhlizece = document.body.clientHeight;
		}

		PosunY=document.body.scrollTop;
		if(PosunY == 0){
		    if (window.pageYOffset) PosunY = window.pageYOffset;
		    else PosunY = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
		}

		GalleryBackground.style.width='100%';
		GalleryBackground.style.height=VyskaDokumentu + 'px';
		if(VyskaDokumentu<VyskaProhlizece)GalleryBackground.style.height=VyskaProhlizece + 'px';
		
		PictureXPosition=(SirkaProhlizece-xwidth)/2;
		PictureYPosition=(VyskaProhlizece-yheight)/2+PosunY;
		if(VyskaProhlizece<yheight)PictureYPosition=PosunY+30;
		
		GalleryPictureContainer.style.left=PictureXPosition-15+'px';
		GalleryPictureContainer.style.top=PictureYPosition-15+'px';
	}

	//-------------------------------------------------------------
	function gogo_gallery_close(picname,xwidth,yheight){

		GalleryBackground=document.getElementById('gallerybcg');
		GalleryPictureContainer=document.getElementById('gallerypicturecontainer');
		GalleryPicture=document.getElementById('gallerypicture');

		GalleryBackground.style.visibility='hidden';
		GalleryPictureContainer.style.visibility='hidden';
		GalleryPicture.style.visibility='hidden';

		GalleryBackground.style.width='100%';
		GalleryBackground.style.height='0px';

		GalleryPicture.src=GalLoading.src;
	}


// =========== Kleinigkeiten for UNIMILLS === END
