function msg_preload() {   
   var cont = document.getElementById("content");   
   var img=document.createElement("img");
   img.src="message_top.png";
   img.style.position="absolute"; img.style.left="-1000px"; img.style.width="1px";
   cont.appendChild(img);
   img=document.createElement("img"); img.style.width="1px";
   img.src="message_bg.png";
   img.style.position="absolute"; img.style.left="-1000px";
   cont.appendChild(img);
   img=document.createElement("img"); img.style.width="1px";
   img.src="message_roll.png";
   img.style.position="absolute"; img.style.left="-1000px";
   cont.appendChild(img);
   img=document.createElement("img"); img.style.width="1px";
   img.src="messagedark.png";
   img.style.position="absolute"; img.style.left="-1000px";
   cont.appendChild(img);
}

setTimeout("msg_preload()", 100);

function showMsg(id, title, boldtext, normtext, normtext2, button1text, button2text, button1fct, button2fct) { 

      var div1 = document.createElement("div");
      div1.className="message";
      div1.id=id;
      var div1a = document.createElement("div");
      div1.appendChild(div1a);
      var div1b = document.createElement("div");
      div1a.appendChild(div1b);
      var div2 = document.createElement("div");
      div2.className="messageIn";
      div1b.appendChild(div2);
      var div3 = document.createElement("div");
      div2.appendChild(div3);
      var div4 = document.createElement("div");
      div3.appendChild(div4);

      var h2 = document.createElement("h2");
      h2.appendChild(document.createTextNode(title));
      div3.appendChild(h2);
      if(boldtext != null) {
         var p3 = document.createElement("p");
         p3.style.fontWeight="bold";
         p3.appendChild(document.createTextNode(boldtext));      
         div3.appendChild(p3);
      }
      if(normtext != null) {      
         var p1 = document.createElement("p");
         p1.appendChild(document.createTextNode(normtext));
         div3.appendChild(p1);
      }
      if(normtext2 != null) {      
         var p4 = document.createElement("p");
         p4.appendChild(document.createTextNode(normtext2));
         div3.appendChild(p4);
      }
      var p2 = document.createElement("p");
      p2.style.textAlign="right";
      p2.style.paddingTop="10px";
      p2.style.paddingBottom="10px";
      div3.appendChild(p2);
      if(button1text != null) {      
         var a1 = document.createElement("a");
         a1.className="button";
         a1.href="#";
         a1.appendChild(document.createTextNode(button1text));
         addEventHandler(a1, "click", button1fct);
         //addEventHandler(a1, "mousemove", function(evt) { if(evt.) prevDef(evt); });
         p2.appendChild(a1);
      }
      if(button2text != null) {      
         p2.appendChild(document.createTextNode("   "));
         var a2 = document.createElement("a");
         a2.className="button";
         a2.href="#";
         a2.style.fontWeight="bold";
         a2.appendChild(document.createTextNode(button2text));
         addEventHandler(a2, "click", button2fct);
         p2.appendChild(a2);
      }

      div2.style.display="none";
      document.getElementById("content").appendChild(div1);

      //prepareForFadeDown(div2);
      aniFadeDown(div2, 10, null,easeInOutAni);
      //new fadeDown(div2);            

}

function hideMsg(id) {
   em = document.getElementById(id);   
   aniFadeUp(em.firstChild.firstChild.firstChild,8, function() {         
      document.getElementById("content").removeChild(em);
   },quadraticAni);
}

function hideMsgNoAni(id) {
   em = document.getElementById(id);   
   document.getElementById("content").removeChild(em);
}

function hideMsg2(id, onFinish) {
   em = document.getElementById(id);   
   aniFadeUp(em.firstChild.firstChild.firstChild,8, function() {         
      document.getElementById("content").removeChild(em);
      onFinish();
   },quadraticAni);
}