function popupGallery(name, nextPrevLink, originalLink)
{
   myWindow = window.open("/components/gallery/show_gallery_image.jsp?src="+name+"&nextPrevLink="+nextPrevLink+"&originalLink="+originalLink, "galleryWindow", "toolbar=no,scrollbars=yes,resizable=yes,width=700,height=500;")
}

function popupGallerySetStyle(name, nextPrevLink, originalLink, styleName, sendCardLink, cyclicViewing)
{
   myWindow = window.open("/components/gallery/show_gallery_image.jsp?src="+name+"&nextPrevLink="+nextPrevLink+"&originalLink="+originalLink+"&styleName="+styleName+"&sendCardLink="+sendCardLink+"&cyclicViewing="+cyclicViewing, "galleryWindow", "toolbar=no,scrollbars=yes,resizable=yes,width=700,height=500;")
}

function popupGalleryRecursive(dir, index, nextPrevLink, originalLink, styleName, cyclicViewing, sendCardLink)
{
   myWindow = window.open("/components/gallery/show_gallery_image_recursive.jsp?dir="+dir+"&index="+index+"&nextPrevLink="+nextPrevLink+"&originalLink="+originalLink+"&styleName="+styleName+"&cyclicViewing="+cyclicViewing+"&sendCardLink="+sendCardLink, "galleryWindow", "toolbar=no,scrollbars=yes,resizable=yes,width=700,height=500;")
}

function showGalleryTooltip(imgid, desc, e)
{
   try
   {
	   if (!e && window.event) e = window.event;
	   
	   var ox=0;
	   var oy=0;
	   
	   var IE = document.all?true:false;
	   if (!IE) document.captureEvents(Event.MOUSEMOVE);
	   
	   if (IE)
	   {
	      if (document.documentElement && document.documentElement.scrollTop)
	      {
	         ox = event.clientX + document.documentElement.scrollLeft;
	         oy = event.clientY + document.documentElement.scrollTop;
	      }
	      else
	      {
	         ox = event.clientX + document.body.scrollLeft;
	         oy = event.clientY + document.body.scrollTop;
	      }
	   }
	   else
	   {
	      ox = e.pageX;
	      oy = e.pageY;
	   }
	
	   if (ox < 10){ox = 10}
	   if (oy < 10){oy = 10}
	
	   var text = "";
	   var imgEl = document.getElementById(imgid)
	   if (imgEl == null) return;
	   if (imgEl.alt)
	   {
	      imgEl.galText = imgEl.alt;
	      imgEl.alt = "";
	   }
	   text = imgEl.galText;
	   if (text == undefined || text == "undefined") text = "";
	   
	   if (text=="" && desc=="") return;
	
	   if (document.getElementById||document.all)
	   {
	      lnk = "galleryTooltipLayerAuto";
	      var curLnk = (document.getElementById)? document.getElementById(lnk): document.all[lnk];
	      
	      if (curLnk == null)
	      {
	    	  var galDiv = document.createElement('div');
	    	  galDiv.id = "galleryTooltipLayerAuto";
	    	  galDiv.style.cssText = "position:absolute; width:130px; z-index:50; display: none; background-color: white; border: 1px solid black; color: black; padding: 2px; text-align: left; filter: Alpha( Opacity=70, FinishOpacity=0, Style=0); opacity:.7;";
	    	  galDiv.setAttribute("class", "galleryTooltipDiv");
	    	  var bodyEl = document.getElementsByTagName("body")[0];
	    	  bodyEl.appendChild(galDiv);
	    	  curLnk = galDiv;
	      }
	      
	      if (curLnk != null)
	      {
	    	  //vypocitaj poziciu
		      curLnk.style.display = "block";
		      curLnk.style.top=(oy+10)+"px";
		      curLnk.style.left=(ox+10)+"px";
		      if (desc!="")
		      {
		         if (text=="")
		         {
		            text = desc;
		         }
		         else
		         {
		            text = text + "<br><br>"+desc;
		         }
		      }
		      curLnk.innerHTML = text;
	      }
	   }
   }
   catch (exception)
   {
	   
   }
}

function hideGalleryTooltip()
{
   if (document.getElementById||document.all)
   {
      lnk = "galleryTooltipLayerAuto";
      var curLnk = (document.getElementById)? document.getElementById(lnk): document.all[lnk];
      if (curLnk != null)
      {
	      curLnk.style.display = "none";	      
      }
   }
}

function highlightGalleryTD(obj,on)
{
   if (document.getElementById||document.all)
   {
      if (on==1) obj.bgColor=highlightGalleryTDColor;
      else obj.bgColor="";
   }
}
