// =========== Kleinigkeiten for Prague Patchwork Meeting
// =========== created by JaryK
// =========== STUDIO SYNAPSE


//=============================================================
//=====   TEST IE6 a IE5 PROHLIZECE
//=============================================================

	//-------------------------------------------------------------
	//--- pokud se pouziva IE5 nebo IE6 nastavi se promenna
	//--- fuckingIE na true
	//-------------------------------------------------------------
	var Bprohlizec = navigator.appName.toLowerCase();
    var Bagent = navigator.userAgent.toLowerCase();
    var Bverze = navigator.appVersion.toLowerCase();
	var fuckingIE = false;
	var fuckingIE7 = false;
	if((Bverze.indexOf("msie 6")!=-1) || (Bverze.indexOf("msie 5")!=-1)) fuckingIE = true;
	if(Bverze.indexOf("msie 7")!=-1) fuckingIE7 = true;


//=============================================================
//=====   PRELOAD OBRAZKU
//=============================================================

	//-------------------------------------------------------------
	BUTTONS = new Array();
	JPGBUTTONS = new Array();
	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\"");
		}
	}


//=============================================================
//=====   GALERIE Jerome v 1.0.5
//=============================================================

	//-------------------------------------------------------------
	GalFakePic = new Image();
	GalFakePic.src = "obrazky/fake-1x1.gif";
	//-------------------------------------------------------------
	function gogo_gallery_picture(picname,xwidth,yheight,popis){

		GalleryBackground=document.getElementById('gallerybcg');
		GalleryPictureContainer=document.getElementById('gallerypicturecontainer');
		GalleryPicture=document.getElementById('gallerypicture');
		GalleryText=document.getElementById('gallerytext');
		GalleryHref=document.getElementById('galleryhref');

		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%';
		if(fuckingIE)GalleryBackground.style.width=SirkaProhlizece + 'px';
		GalleryBackground.style.height=VyskaDokumentu + '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';
		GalleryText.innerHTML='<strong>' + popis + '</strong> Kliknutím zavřete obrázek.';
		
//		GalleryHref.style.width=xwidth+2+'px';
//		GalleryHref.style.height=yheight+2+'px';
		
		GalleryBackground.style.visibility='visible';
		GalleryPictureContainer.style.visibility='visible';
		GalleryPicture.style.visibility='visible';
	}

	//-------------------------------------------------------------
	function gogo_gallery_close(){

		GalleryBackground=document.getElementById('gallerybcg');
		GalleryPictureContainer=document.getElementById('gallerypicturecontainer');
		GalleryPicture=document.getElementById('gallerypicture');
		GalleryText=document.getElementById('gallerytext');

		GalleryBackground.style.visibility='hidden';
		GalleryPictureContainer.style.visibility='hidden';
		GalleryPicture.style.visibility='hidden';

		GalleryBackground.style.width='100%';
		GalleryBackground.style.height='0px';

		GalleryText.innerHTML='';
		GalleryPicture.src=GalFakePic.src;
	}


//=============================================================
//=====   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';
	}


// =========== Kleinigkeiten for Prague Patchwork Meeting === END