/* ********************************************************************************************
									Vseobecne - burda
 ******************************************************************************************** */
function hide_load_warn(){ // is called onload
	if (!document.getElementById) return;
	if (document.getElementById("id_loading"))
	{
		document.getElementById("id_loading").style.visibility = "hidden";
	} // hides loading... layer
}


if (document.getElementById) {
	/*
	var obrtop = "150px";
	var obrleft = "450px";
	if (navigator.appName == "Netscape"){
	obrtop = ((window.screen.height/2)-35)+"px";//document.documentElement.clientHeight
	obrleft = ((window.screen.height/2)-77)+"px";//document.documentElement.clientWidth
	} else {
		obrtop = ((document.body.offsetHeight/2)-35+document.body.scrollTop)+"px";
	obrleft = ((document.body.offsetWidth/2)-77)+"px";
	}
	*/
	document.write('<div id="id_loading" style="position: absolute; top:48%; left:48%; z-index:256; visibility: visible; width: 154; height: 50;"><a href="#" onClick="hide_load_warn();" title="Kliknutím schováte"><img src="/gfx/nacitani_new.gif" width="154" height="50" alt="Nahravam / Loading - Kliknutím schováte" border="0"><\/a><\/div>');
}





 
function info_tip(popis,jazyky){ // zakladni informacni tip (galerie)
	Tip('' + popis + '',OFFSETY,20);
};




/* ****************************************************************************************************************************************************
												Okna funkce
**************************************************************************************************************************************************** */
function okno_zavrit(){
	window.close();
};

function printpage(){
	window.print();
}


function openWindowMessage() { // zpravy
	sirka = 675;
	vyska = 535;
	iMyWidth = (window.screen.width-sirka) /2;
	iMyHeight = (window.screen.height-vyska) /2;
	Fokus = window.open("", "JSL_mail","height=" + vyska + ",width=" + sirka + ",resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
	Fokus.focus();
};



function openWindowGalerie() { //galerie
	sirka = window.screen.width/10*6;
	vyska = window.screen.height/10*8;
	if(sirka<675) sirka = 675;
	if(vyska<535) vyska = 535;
	
	iMyWidth = (window.screen.width-sirka) /2;
	iMyHeight = (window.screen.height-vyska) /2;
	Fokus = window.open("", "JSL","height=" + vyska + ",width=" + sirka + ",resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
	Fokus.focus();
}
function openJSLWindow(){// fallback - stare clanky a novinky
	openWindowGalerie(); 
};




function openWindowWebsal() { //websal
	sirka = 800;
	vyska = 600;
	iMyWidth = (window.screen.width-sirka) /2;
	iMyHeight = (window.screen.height-vyska) /2;
	Fokus = window.open("", "SAL","height=" + vyska + ",width=" + sirka + ",resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=no");
	Fokus.focus();
}






/* ****************************************************************************************************************************************************
												Vseobecne funkce - genericke
**************************************************************************************************************************************************** */
function setCookie(key, value, days, path, domain, secure) {
	value = encodeURIComponent(value); // hodnota value by měla být minimálně escapována pomocí funkce escape()
	value+='; domain='+domain;
	value+='; path='+path;
	// expirace
	var date = new Date();
	date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
	value+='; expires=' + date.toGMTString();
	// secure
	if (secure) value+='; secure';
	document.cookie = key + '=' + value;
}//setCookie

function getCookie(c_name) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1) {
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
	    }
	}
	return "";
}//getCookie


function goToURLnavigace(selObj, goToLocation) { //navigace presuny
	eval("document.location.href = \'" + goToLocation + "/" + selObj.options[selObj.selectedIndex].value + "\'");
}



function getObj(objName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[objName] : document[objName];
};


function najdi_pozici_elementu(oElement,vratit_co) {
	if( typeof( oElement.offsetParent ) != 'undefined' ) {
		for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
			posX += oElement.offsetLeft;
			posY += oElement.offsetTop;
		}
		var out_x = posX, out_y= posY;
	} else {
		var out_x = oElement.x, out_y= oElement.y;
	}
	
	if(vratit_co=="x"){
		return out_x;
	}else if(vratit_co=="y"){
		return out_y;
	}else{
		return [ posX, posY ];
	}
};




function changeClass(elementID, newClass) {
	var element = document.getElementById(elementID);
	if(element){
		element.setAttribute("class", newClass); //For Most Browsers
		element.setAttribute("className", newClass); //For IE; harmless to other browsers.
	};
 };



 










/* ****************************************************************************************************************************************************
													Polozky - pol_ (pl_)
**************************************************************************************************************************************************** */


function pol_info_default(texty,titulek){
	if(titulek==null){
		Tip(texty);
	}else{
		Tip(texty, TITLE, titulek);
	};
};


function pol_info_zajem(vyse){
	pol_info_default(pl_index_zajmu_text + " " + pl_index_zajmu_urovne_popis[vyse] + ' (' + vyse + '/10)', pl_index_zajmu_titulek);
};


function pol_info_navyseni(navyseno_o){
	pol_info_default('<div align="center">' + pl_navyseni_text + '<br><b>' + navyseno_o + '</b></div>');
};


function pol_info_text(ktery){
	pol_info_default(pl_info_text[ktery]);
};


function pol_info_prepocet(czk,us,eu){
	pol_info_default('<table border="0" cellpadding="0" cellspacing="0" style="font-size: 11px;" width="100%"><tr><td align="left">' + pl_info_prepocet_zcastky + '</td><td align="right">&nbsp;' + czk + '<td>&nbsp;' + glob_czk_oznaceni + '&nbsp;</td></td><td><img src="' + glob_cesta_foto + '/gfx/flag_czk.gif" width="16" height="11" border="0"></td></tr><tr><td align="left">' + pl_info_prepocet_priblizne + '</td><td align="right">&nbsp;' + eu + '</td><td>&nbsp;EUR&nbsp</td><td><img src="' + glob_cesta_foto + '/gfx/flag_eur.gif" width="16" height="11" border="0"></td></tr><tr><td align="left">' + pl_info_prepocet_priblizne + '</td><td align="right">&nbsp;' + us + '</td><td>&nbsp;USD&nbsp;</td><td><img src="' + glob_cesta_foto + '/gfx/flag_usd.gif" width="16" height="11" border="0"></td></tr><tr><td colspan="4" align="center">	<strong>&nbsp;!&nbsp;' + pl_info_prepocet_informativni + '&nbsp;!&nbsp;</strong></td></tr></table>', pl_info_prepocet_titulek);
};


function pol_info_foto_pocet(idcko,aukcni_cislo,pocet_foto){
	var i = 1, fotky = "";
	while(pocet_foto>=i && i<=21){
		fotky = fotky + '<img src="' + glob_cesta_foto + '/img/webove/miniatury/' + idcko + glob_pismena_obrazky[i] + '.jpg" border="1" width="70" style="border: 1px solid #4D1125;"> ';
		if(i==7 || i==14 || i==21 || i==28 || i==35 || i==42 || i==49 || i==56) fotky = fotky + '<br>';
		i++;
	}
	if(aukcni_cislo>0){
		var zobraz_cislo = aukcni_cislo;
	}else{
		var zobraz_cislo = idcko;
	}
	
	if(pocet_foto>21){
		var dalsich_foto = "<em>" + pl_foto_pocet_dalsich1 + " <strong>" + (pocet_foto-21) + "</strong> " + pl_foto_pocet_dalsich2 + "</em>";
	}else{
		var dalsich_foto = "";
	}
	
	Tip('<table border="0" cellspacing="0" cellpadding="0" width="100%" class="nahledovnik_foto"><tr><td align="center" height="30"><strong>' + pl_foto_pocet_dostupnych + ' ' + pocet_foto +'</strong></td></tr><tr><td valign="top" align="center">' + fotky + '</td></tr><tr><td align="center">' + dalsich_foto + '</td></tr></table>',CENTERMOUSE, false, TITLE, pl_foto_pocet_title1 + ' ' + zobraz_cislo + ' - ' + pl_foto_pocet_title2, BGCOLOR, '#000000',TEXTALIGN, 'center', TITLEALIGN, 'center',BORDERWIDTH, 3, PADDING, 3);
};



function pol_info_foto_nahled(idcko,aukcni_cislo,wid_obrazek,hei_obrazek,count_url,pocet_foto_galerie){
	var tit = '', doplnujici_fotky = '', sirka_doplnujici = 0;

	if(pocet_foto_galerie>1){
		sirka_doplnujici = 76;
	}else{
		sirka_doplnujici = 1;
	}
	var hei_celkem = hei_obrazek*1;
	var wid_celkem = wid_obrazek*1 + sirka_doplnujici; 
		
		
	
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}

	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	
	
	var obrazek_pozice_x = najdi_pozici_elementu(document.getElementById("nobr_"+idcko+""),"x");
	var obrazek_sirka = document.getElementById("nobr_"+idcko+"").width;
	var pozice = "";
	
	if((myWidth-(obrazek_pozice_x+obrazek_sirka))>=obrazek_pozice_x){
		pozice = "prava";
		max_w = (myWidth-(obrazek_pozice_x+obrazek_sirka)) - 50;
	}else{
		pozice = "leva";
		max_w = obrazek_pozice_x - 50;
	}
	var max_h = myHeight/1.3; // max vyska pro nahled muze byt vyssi 
	if(max_w>(myWidth/2-50)) max_w = (myWidth/2-50);

	
	var delitel = 0;
	if(wid_celkem>max_w || hei_celkem>max_h){
		if(wid_celkem>max_w){
			delitel = (max_w/(wid_celkem/100))/100;
			wid_celkem = wid_celkem * delitel;
			hei_celkem = hei_celkem * delitel;
			wid_obrazek = wid_celkem - sirka_doplnujici;
			hei_obrazek = hei_celkem;
		}
		if(hei_celkem>max_h){
			delitel = (max_h/(hei_celkem/100))/100;
			wid_celkem = wid_celkem * delitel;
			hei_celkem = hei_celkem * delitel;
			wid_obrazek = wid_celkem - sirka_doplnujici;
			hei_obrazek = hei_celkem;
		}
	}
	
	var do_obrazku_zobrazit = 4;
	if(hei_celkem<330){
		do_obrazku_zobrazit = 3;
	}else if(hei_celkem>600){
		do_obrazku_zobrazit = 5;
	}
	
	if(pocet_foto_galerie>1){
		doplnujici_fotky = pl_dalsi_dostupne_fota + '<br><br>';
		var i = 2;//zacinat od druheho
		while(pocet_foto_galerie>=i && i<=do_obrazku_zobrazit){
			doplnujici_fotky = doplnujici_fotky + '<img src="' + glob_cesta_foto + '/img/webove/miniatury/' + idcko + glob_pismena_obrazky[i] + '.jpg" border="1" width="70" style="border: 1px solid #4D1125;"><br><br>';
			i++;
		}
	}
	
	
	var cen_x, cen_y;
	if(pozice=="leva"){
		cen_x = 15;
	}else{
		cen_x = myWidth - (wid_celkem+40);
	};
	cen_y = (myHeight+scrOfY) - (hei_celkem+30);


	if(aukcni_cislo) tit = pl_obrazek_nahled_titulek_aukcni + aukcni_cislo;
	if(aukcni_cislo==0) tit = pl_obrazek_nahled_titulek_polozka + idcko;
	
	wid_celkem = Math.round(wid_celkem);hei_celkem = Math.round(hei_celkem);
	wid_obrazek = Math.round(wid_obrazek);hei_obrazek = Math.round(hei_obrazek);
	cen_x = Math.round(cen_x);cen_y = Math.round(cen_y);
	
	
	Tip('<table border="0" cellspacing="0" cellpadding="0" class="nahledovnik_foto"><tr><td style="background-image: url(' + glob_cesta_foto + '/gfx/nacitani_new.gif); background-position: center; background-repeat: no-repeat;" valign="top"><img src="' + glob_cesta_foto + '/img/webove/nahledy/' + idcko + '.jpg" width="' + wid_obrazek + '" height="' + hei_obrazek + '" border="0"></td><td valign="middle" align="center" width="' + sirka_doplnujici + '">' + doplnujici_fotky + '<iframe src="' + count_url + '" width="0" height="0" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe></td></tr></table>', WIDTH, wid_celkem, TITLE, tit, DELAY, 1200, BGCOLOR, '#000000',TEXTALIGN, 'center', TITLEALIGN, 'center',BORDERWIDTH, 3, PADDING, 3, CENTERMOUSE, false, FIX, [cen_x, cen_y], FADEIN, 200, FADEOUT, 200);
}; 



function pol_verify_nakup_hodnota(idcko){ // test vyplneni formulare
	hodnota = document.getElementById(idcko).value;
	if(hodnota==""){
		alert(pl_zadejte_vysku_nabidky);
		return false;
	}else{
		if(hodnota.search(/^[0-9]*$/) != -1){
			return true;
		}else{
			alert(pl_zadejte_pouze_cisla);
			return false;
		}		
	};	
};







function pol_changeShowSettings(typ,selObj,goToLocation,co,hodnota_input){
	var data_zobrazeni = getCookie('cookie_zobrazeni');
	var brokenstring = data_zobrazeni.split("|");
	var data_nova_cookie = "";
	var zapsan_udaj = 0;
	if(typ=="select"){
		var hodnota = selObj.options[selObj.selectedIndex].value;
	}else if(typ=="changer"){
		var hodnota = hodnota_input;
	}
	
	
	var i = 0;
	for (i in brokenstring){
		var rozdeleny_retezec = brokenstring[i].split("=");
		if(rozdeleny_retezec[0]==co){
			data_nova_cookie = data_nova_cookie + co + "=" + hodnota + "|";
			zapsan_udaj = 1;
		}else if(rozdeleny_retezec[0]!=false){
			data_nova_cookie = data_nova_cookie + brokenstring[i] + "|";
		}
	}//for
	if(zapsan_udaj==0){
		data_nova_cookie = data_nova_cookie + co + "=" + hodnota + "|";
	}//if
	//alert(data_nova_cookie);
	
	setCookie('cookie_zobrazeni',data_nova_cookie,365,'/',glob_cookie_server);
	if(goToLocation!="") eval("document.location.href = \'" + goToLocation + "\'");
	
	
	if(typ=="changer"){
		if(hodnota==1){
			document.getElementById(co + "_button_0").style.display = "none";
			document.getElementById(co + "_button_1").style.display = "";
			document.getElementById(co + "_button_0").style.display = "none";
			document.getElementById(co + "_show").style.display = "none";
		}else{
			document.getElementById(co + "_button_0").style.display = "";
			document.getElementById(co + "_button_1").style.display = "none";
			document.getElementById(co + "_show").style.display = "";
		}
		
		
	}
	
}//changeShowSettings








/* ****************************************************************************************************************************************************
									Galerie - gal_ (gv_)
**************************************************************************************************************************************************** */

 
 
 
function gal_nacten_stranka(){
	document.onkeyup = gal_key_check; //start key check
	if(gv_pocet_foto_celkem>1) fillup();//motion menu
	if(gv_zoom_aktivni=="a") gal_foto_posun(0); //------------------------------------------ZJISTIT TOHLE FUNKCNOST
	gv_nacten_stranka = 1; //obr test
	//changeClass("foto_zobrazeni","");//prepnuti polozky
	hide_load_warn();
	
	changeClass("menu_"+gv_obrazky_cislo_upresneni, "aktualni");
	if(gv_pocet_foto_celkem<=1){
		document.getElementById('img_prev').style.visibility="hidden";
		document.getElementById('img_next').style.visibility="hidden";
		changeClass("td_prev", "");
		changeClass("td_next", "");
	}else if(gv_obrazky_cislo_upresneni==""){
		document.getElementById('img_prev').style.visibility="hidden";
		changeClass("td_prev", "");
	}
	
};

function gal_nacten_obrazek(){
	changeClass("foto_zobrazeni","");
	if(gv_nacten_stranka==1) hide_load_warn();
};
 



function gal_data_flash(cislo){
	if(getObj("GalerieZoom")) getObj("GalerieZoom").obrazek(cislo);
}




function gal_change_obrazek(dodatek,akt_obr){
	if(dodatek==undefined) dodatek = ""; //osetreni prazdneho
	var novy_obr_nazev = gv_obrazky_cislo_obrazku + dodatek + gv_obrazky_pripona_soubor;
	
	if(document.getElementById("foto_zobrazeni")){
		if(gv_obrazky_cislo_upresneni!=dodatek){
			var obj = document.getElementById("foto_zobrazeni");
			changeClass("foto_zobrazeni", "loading_sede");
			document.getElementById("id_loading").style.visibility="";
			obj.src = gv_obrazky_cesta + novy_obr_nazev; //zmena az po nastaveni, kvuli cache
		}
	}else{
		gal_data_flash(gv_obrazky_cislo_obrazku + dodatek);
	}
	
	
	
	var pole_pozice_nova = akt_obr*1;
	if(gv_foto_ktere[(pole_pozice_nova+1)]!=undefined){
		document.getElementById('img_next').style.visibility="";
		changeClass("td_next", "pointer");
	}else{
		document.getElementById('img_next').style.visibility="hidden";
		changeClass("td_next", "");
	}
	if(gv_foto_ktere[(pole_pozice_nova-1)]!=undefined){
		document.getElementById('img_prev').style.visibility="";
		changeClass("td_prev", "pointer");
	}else{
		document.getElementById('img_prev').style.visibility="hidden";
		changeClass("td_prev", "");
	}
	
	changeClass("menu_"+gv_obrazky_cislo_upresneni, "");
	changeClass("menu_"+dodatek, "aktualni");
	
	document.getElementById('foto_info').innerHTML = 'Foto: <strong>' + (gal_zjisti_cislo_pole_pro_kod(dodatek)+1) + '/' + gv_pocet_foto_celkem + '</strong>';
	if(document.getElementById('zoom_url')) document.getElementById('zoom_url').href = gv_zoom_url1 + dodatek + gv_zoom_url2;
	if(document.getElementById('spatne_url')) document.getElementById('spatne_url').href = gv_spatne_url1 + dodatek + gv_spatne_url2;
	if(document.getElementById('zadost_url')) document.getElementById('zadost_url').href = gv_zadost_url1 + dodatek + gv_zadost_url2;
	if(document.getElementById('down1_url')) document.getElementById('down1_url').href = gv_down1_url1 + novy_obr_nazev + gv_down1_url2;
	if(document.getElementById('down2_url')) document.getElementById('down2_url').href = gv_down2_url1 + novy_obr_nazev + gv_down2_url2;
	if(document.getElementById('down3_url')) document.getElementById('down3_url').href = gv_down3_url1 + novy_obr_nazev + gv_down3_url2;
	
	
	if(gal_zjisti_cislo_pole_pro_kod(dodatek)>gal_zjisti_cislo_pole_pro_kod(gv_obrazky_cislo_upresneni)){
		muj_mover("left","76");
	}else{
		muj_mover("right","76");
	}
	gv_obrazky_cislo_upresneni = dodatek; //nastav co je aktualni obrazek
	
	
	
};

function gal_change_navmenu(co,naco){
	document.getElementById('img_' + co).src = '/gfx/galerie/' + co +'_' + naco + '.gif';
};



function gal_zjisti_aktualni_priponu(){
	return gv_obrazky_cislo_upresneni;
};


function gal_zjisti_cislo_pole_pro_kod(co) {
	var n = gv_foto_ktere.length;
	for (var i=0; i<n; i++) {
		if (gv_foto_ktere[i]==co) {
			return i;
		}
	}
	return false;
}




function gal_foto_posun(okolik){
	var polozka = gal_zjisti_aktualni_priponu();
	var i = 0;
	var vyhledane = 0;
	while(vyhledane==0 && i in gv_foto_ktere){
		if(gv_foto_ktere[i]==polozka){
			vyhledane = i;
		}
		i++;
	}//while
	var ktera_pol = vyhledane*1 + okolik*1;
	if(gv_foto_ktere[ktera_pol]!=undefined) gal_change_obrazek(gv_foto_ktere[ktera_pol],ktera_pol);
};





function gal_check_cursor_position_relative(event,id_objekt,click_yes){
	var obj = document.getElementById(id_objekt);
	
	if(obj.x>0){//mozilla
		var objekt_x = obj.x;
		var objekt_y = obj.y;
	}else{//ie
		var objekt_x = obj.offsetParent.offsetLeft;
		var objekt_y = obj.offsetParent.offsetTop;
	}
	
	var objekt_sirka = obj.width;
	var objekt_vyska = obj.height;
	var client_x=event.clientX;
	var client_y=event.clientY;
	var relativni_x = client_x - objekt_x;
	var relativni_y = client_y - objekt_y;
	
	if(relativni_x<(objekt_sirka/3)){//prev cast
		gal_change_navmenu('prev','1');
		if(click_yes==1) gal_foto_posun(-1);
		if(document.getElementById('img_prev').style.visibility==""){
			obj.style.cursor="pointer";
		}else{
			obj.style.cursor="";
		}
	}else if(relativni_x>(objekt_sirka/3*2)){//next cast
		gal_change_navmenu('next','1');
		if(click_yes==1) gal_foto_posun(+1);
		if(document.getElementById('img_next').style.visibility==""){
			obj.style.cursor="pointer";
		}else{
			obj.style.cursor="";
		}
	}else{
		obj.style.cursor="";
		gal_change_navmenu('next','0');
		gal_change_navmenu('prev','0');
	}
	
}



function gal_tip_motion_foto(popis,jazyky){
	Tip('Foto: <strong>' + popis + '</strong>/' + gv_pocet_foto_celkem + '',OFFSETY,20);
};



function gal_nastav_motion_menu(){
	document.getElementById("motioncontainer").style.height = gv_motion_obrazky_vyska + "px";
	if(gv_motion_obrazky_sirka<document.body.offsetWidth){
		document.getElementById("motioncontainer").style.width = gv_motion_obrazky_sirka + "px";
	}else{
		document.getElementById("motioncontainer").style.width = "98%";
	}
};




function gal_key_check(e){
	var KeyID = (window.event) ? event.keyCode : e.keyCode;
	switch(KeyID) {
		//case 16:document.Form1.KeyName.value = "Shift";break; 
		//case 17:document.Form1.KeyName.value = "Ctrl";break;
		//case 18:document.Form1.KeyName.value = "Alt";break;
		//case 19:document.Form1.KeyName.value = "Pause";break;
		case 27:okno_zavrit();break;//Escape
		case 37:gal_foto_posun(-1);break;//Arrow Left
		// case 38:alert("arrow up");break;
		case 39:gal_foto_posun(1);break;//Arrow Right
		//case 40:document.Form1.KeyName.value = "Arrow Down";break;
	}
}//func keyCheck







function gal_okno_maximilizace(){
	var wide = screen.availWidth;
	var high = screen.availHeight;
	window.moveTo(0,0);
	window.resizeTo(wide,high);
	gal_nastav_motion_menu();
};


















/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}