function PopupHandler(name,link,aobj,hide) {
   if (document.getElementById)
      if (document.getElementById(name)) {
         if (aobj) {
            var oA = Position.cumulativeOffset(aobj)
            var oP = Position.cumulativeOffset(document.getElementById(name).parentNode)
            var oH = Math.round(parseInt(document.getElementById(name).style.height,10)/2)
            document.getElementById(name).style.top = (oA[1]-oP[1]-oH>0) ? oA[1]-oP[1]-oH : 0
         }
         if (link) {
            if (typeof DetectFlashVer == "function")
               link += (link.indexOf("?") == -1 ? "?" : "&") + "webFlashEnabled=" + DetectFlashVer(4,0)
            document.getElementById(name).contentWindow.location.replace(link)
            if (!hide) {
               document.getElementById(name).style.visibility = 'visible';
            }
         } else
            document.getElementById(name).style.visibility = 'hidden'
            if ($('overlay-gallery')){
               $('overlay-gallery').hide();
            }
      }
}
function PopupHandlerShow(obj) {
   if (String(obj.contentWindow.location).indexOf("http://")>-1) {
      obj.style.visibility = 'visible';
      if ($('overlay-gallery')){
         $('overlay-gallery').show();
         if ($('text-gallery')) {
            if ($('text-gallery').offsetHeight > 600) {
               $('overlay-gallery').style.height = $('text-gallery').offsetHeight + "px";
            } else {
               $('overlay-gallery').style.height = '600px';
            }
         }
      }
   }
}
var globalfile
var popups = new Array()
function open_preview(title,cont,width,height,type) {
   if (type=='image') {
      var content_doc = '\r\n'
      content_doc += '<html><head ><title>'+title+'</title></head>\r\n'
      content_doc += '<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">\r\n'
      content_doc += '<img src="'+cont+'" alt="'+title+'">\r\n';	
      content_doc += '</body></html>\r\n'
      if (popups.length)
         if (!popups[popups.length-1].closed)
            popups[popups.length-1].close()
      popups[popups.length] = window.open('','','status=no,width='+width+',height='+height+',resizable=no,scrollbars=auto,toolbar=no');
      var preview=popups[popups.length-1]
      preview.document.open()
      preview.document.write(content_doc)
      preview.document.close()
      preview.focus()
   } else {
      globalfile = cont
      if (!width) width = 630
      if (!height) height = 400
      var temp = window.open('/cgi-bin/evoweb.dll/wheels?form=getfileopener','DRUCKVERSION','toolbar=yes,status=no,width='+width+',height='+height+',resizable=yes,scrollbars=yes');
   }
}
