// --- helpmaster.js
// --- by Josef Becker, Mediendidaktische Beratung
// --- http://www.helpmaster.com

// --- popupon and popupoff base on a script written by Andrew Castles bound to use with Dreamweaver 1.2
// --- http://www.arrakis.es/~andrewc/downloads/archives/tooltipdemo.htm

function popupon(ad,yol, eventObj) 
{ 
  ieLayer = 'document.all[\'popup\']';
  nnLayer = 'document.layers[\'popup\']';

  //-- Start Editable Area --
  borderColor = '#000000';
  bgColor = '#ffffcc';
  border = 1;
  padding = 3;
  //window.alert(eventObj.x);
  xOffset =  250+document.body.scrollLeft;
  yOffset =   document.body.scrollTop;
  
  Font = 'face="Verdana, Arial, Helvetica, sans-serif" size=1';
  //-- End Editable Area --

  if (!(document.all || document.layers)) return;
  if (null != document.all) document.popup = eval(ieLayer); else document.popup = eval(nnLayer);

  var table = "";
  var bigTable = ""; // Workaround for Netscape

  if (null != document.all) 
    { // If IE4+


    table += "<table bgcolor= "+ bgColor +" border= "+ border +" cellpadding= "+ padding +" cellspacing=0>";
    table += "<tr><td>";
    table += "<table cellspacing=0  cellpadding="+ padding +">";
    table += "<tr><td  bgcolor= "+ bgColor +">"
	table += "<img width=\"200\" height\"150\" src='"+yol+ad+"'>";
	table += "</td></tr>";
    table += "</table></td></tr></table>"
    } 
  else 
    { // If NN4+
    table += "<table cellpadding="+ padding +" border="+ border +" cellspacing=0 bordercolor="+ borderColor +">";
    bigTable += "<table width="+(document.width - xOffset - eventObj.layerX - 30)+"cellpadding="+ padding +" border="+ border +" cellspacing=0 bordercolor="+ borderColor +">";
    table += "<tr><td bgcolor="+ bgColor +"><font "+ Font +">" +ad + "</font></td></tr></table>";
    bigTable += "<tr><td bgcolor="+ bgColor +"><font "+ Font +">" + ad + "</font></td></tr></table>";
    }

  if (eventObj.x < 96){
    xpos= 96;
  }
  else if(eventObj.x > 342){
    xpos=342;
  }
  else{
     xpos=eventObj.x;
  }
  
  if (ad.length < 100){
     space = 50;
  }else{
     space = 100; 
  } 


   if (eventObj.y < space+20){
     ypos = eventObj.y+space+10;
  }
  else{
     ypos = eventObj.y 
  }
     
  
  if (null != document.all) 
    { // If IE4+
    document.popup.innerHTML = table;
    document.popup.style.left = xpos + xOffset-95;
    document.popup.style.top  = ypos + yOffset-space;
    document.popup.style.visibility = "visible";
    document.popup.style.height ="100";
    document.popup.style.width = "100";
    } 
  else 
    { // If NN4+
    document.popup.document.open();
    document.popup.document.write(table);
    document.popup.document.close();
    if ((document.popup.document.width + xOffset + eventObj.layerX) > document.width)
    { // If the layer runs off the right hand side
      document.popup.document.open();
      document.popup.document.write(bigTable);
      document.popup.document.close();
    }
    document.popup.left = eventObj.layerX + xOffset;
    document.popup.top  = eventObj.layerY + yOffset;
    document.popup.visibility = "visible";
  }
}


function popupoff() 
{ 
  if (!(document.all || document.layers)) return;
  if (null == document.popup) {
  } else if (null != document.all)
    document.popup.style.visibility = "hidden";
  else
    document.popup.visibility = "hidden";
    document.popup = null;
}