			function fsel(x,y)
			{
				hval = -1*document.getElementById("himage"+x+"_"+y).value;
				document.getElementById("himage"+x+"_"+y).value=hval;
				clasn = (document.getElementById("himage"+x+"_"+y).value>0)?"image_not_selected":"image_selected";
				document.getElementById("col"+x+"_"+y).className=clasn;
				document.getElementById("hcol"+x).value=hval;
				document.getElementById("hrow"+y).value=hval;
				document.getElementById("hall").value=hval;
			}
			
			function fselcol(x)
			{
				var y=0;
				document.getElementById("hcol"+x).value=-1*document.getElementById("hcol"+x).value;
				clasn = (document.getElementById("hcol"+x).value>0)?"image_not_selected":"image_selected";
				hval = (document.getElementById("hcol"+x).value>0)?1:-1;
				document.getElementById("hall").value=hval;
				while (document.getElementById("himage"+x+"_"+y) != null)
				{
					document.getElementById("hrow"+y).value=hval;
					document.getElementById("himage"+x+"_"+y).value = hval;
					document.getElementById("col"+x+"_"+y).className=clasn;
					y+=1;
				}
			}

			function fselrow(y)
			{
				var x=0;
				document.getElementById("hrow"+y).value=-1*document.getElementById("hrow"+y).value;
				clasn = (document.getElementById("hrow"+y).value>0)?"image_not_selected":"image_selected";
				hval = (document.getElementById("hrow"+y).value>0)?1:-1;
				document.getElementById("hall").value=hval;
				while (document.getElementById("himage"+x+"_"+y) != null)
				{
					document.getElementById("hcol"+x).value=hval;
					document.getElementById("himage"+x+"_"+y).value = hval;
					document.getElementById("col"+x+"_"+y).className=clasn;
					x+=1;
				}
			}
			
			function fselall()
			{
				var y=0;
				document.getElementById("hall").value=-1*document.getElementById("hall").value;
				clasn = (document.getElementById("hall").value>0)?"image_not_selected":"image_selected";
				hval = (document.getElementById("hall").value>0)?1:-1;
				while (document.getElementById("himage0_"+y)!= null)
				{
					var x=0;
					while (document.getElementById("himage"+x+"_"+y)!= null)
					{
						document.getElementById("hcol"+x).value=hval;
						document.getElementById("hrow"+y).value=hval;
						document.getElementById("himage"+x+"_"+y).value = hval;
						document.getElementById("col"+x+"_"+y).className=clasn;
						x+=1;
					}
					y+=1;
				}
			}

			function doubleclick(x,y)
			{
				fsel(x,y);
				document.getElementById("hdblcx").value=x;
				document.getElementById("hdblcy").value=y;
				var win = new Object();

//				win = window.open("index.php?module=image&image_id","Show_image2","left=0px,top=0px");
//				win = window.open("Albums/detonat/52D168F9L084w37360U585y6/ss_i212B911w08363x5k085C555.JPG","Show_image2","left=0px,top=0px");
//http://detonat.superfotky.cz/Albums/detonat/52D168F9L084w37360U585y6/ss_i212B911w08363x5k085C555.JPG


                  win = window.open("index.php?module=image&image_id","Show_image","fullscreen=yes,scrollbars=no,menubar=no,location=no,status=no,titlebar=no,toolbar=no,left=0px,top=0px,width="+(screen.availWidth)+",height="+(screen.availHeight));
//                win = window.open("index.php?module=image&image_id","Show_image","fullscreen=yes,scrollbars=no");
				win.focus();
			}

			function show()
			{
				if(document.getElementById("himage0_0") != null)
				{
					fsel(0,0)
					doubleclick(0,0)
				}
			}

			function deletealbum()
			{
				if (document.getElementById("image0_0") != null)
				{
					alert('Smazat lze pouze prázdné album!!');
				}
				else
				{
					if (confirm('Opravdu smazat album?'))
					{
						document.location.replace(strreplace);
					}
				}
			}
			
			function validation()
			{
				if (document.getElementById("image0_0") != null)
				{
					return true;
				}
				else
				{
					return false;
				}
			}
