function hide(p) {
  switch(p) {
  case "m":
if (attList!=null) {
document.getElementById("mailDiv").innerHTML=
"<div style='display:none'>"+
"<iframe name=rmfr src='_mailatt/rmatt.php?do=get'></frame></div>";
dtRm=window.setInterval('detectRm()',1000);}
else document.getElementById("mailDiv").innerHTML="";
  if (window.dtAtt) {window.clearInterval(dtAtt); dtAtt=null;} break;
  default: document.getElementById("mailDiv").innerHTML="";}
  document.onmousedown=null;}

function mailshow(x,y) {
  if (window.dtAtt) {window.clearInterval(dtAtt); dtAtt=null;}
if (!x && !y) {
  if (!Ereignis) Ereignis = window.event;
  var x = (document.all)?Ereignis.clientX+50:280,
  y = (document.all)?Ereignis.clientY-200:parseInt(window.innerHeight/3);}
  else var x=x, y=y;
  var winmsg="en", mailbtnval="Send",
  msg0="The e-mail will be sent to the webmaster and NOT to the owners.",
  msg1="Max. size of an attachment is 20MB.";
  var moveStr=(document.all)?" style='cursor:move' "+
"onMouseOver='document.onmousedown=down;' "+
"onMouseOut='document.onmousedown=null;'>":">";
  var zusatz="<span onClick=attach() style='cursor:pointer'>"+
"<img src=clip.gif width=15 height=15 border=0>"+
"<small>Attach file(s)</small></span>&nbsp;&nbsp;&nbsp;"+
"<input type='checkbox' "+
"name='txtstiln' value='normal' onClick=txtstil() checked>A "+
"<input type='checkbox' name='txtstilb' value='bold' "+
"onClick=txtstil('b')><b>A</b> <input type='checkbox' "+
"name='txtstili' value='it' onClick=txtstil('i')><i>A</i> "+
"<input type='checkbox' name='txtstilu' value='ul' "+
"onClick=txtstil('u')><u>A</u> <input type='checkbox' name='txtstils' "+
"value='small' onClick=txtstil('s')><small>A</small>&nbsp;&nbsp;&nbsp;";

if (!window.attList || window.attList==null) {
  document.getElementById("mailDiv").innerHTML=
"<div id='mailayer' style='position:absolute;top:"+y+"px;left:"+x+
"px;z-index:500'><form name='mtextform' method='post'>"+
"<table width=377 cellpadding=0 cellspacing=0 border=0>"+
"<tr><td width=377 valign=bottom><img id=mlhead src=mtl"+winmsg+
".gif width=325 height=28 border=0"+moveStr+
"<span id='btnMailClose'>"+
"<img src=tr.gif width=52 height=28 border=0 onClick=hide('m') "+
"onMouseOver=this.src='trf.gif' onMouseOut=this.src='tr.gif'></span></td></tr>"+
"<tr><td id=mtholder align=center valign=top height=154 "+
"background=rlback2.jpg style='padding-top:2'></td></tr>"+
"<tr><td align=right style='padding-right:8;padding-top:6;padding-bottom:2;'"+
" background=stback2.jpg height=34>"+zusatz+
"<input type='button' id='sndmailbtn' onClick='sendMail()' "+
"value='"+mailbtnval+"'></td></tr>"+
"<tr><td valign=top><img src=bline.jpg width=377 height=4 border=0>"+
"</td></tr><tr><td align=left valign=top style='padding:2px; "+
"padding-left:4px; padding-bottom:4px; background-image:url(metalbgs.jpg); "+
"border-width:2px; border-style:ridge; border-color:cccccc'>"+
"<img src=b2.gif width=12 height=12> <small><span id=14>"+
msg0+"</span></small><br>"+
"<img src=b2.gif width=12 height=12> <small><span id=15>"+
msg1+"</span></small><br>"+
"<div id=att></div></td></tr></table></form></div>";
  document.getElementById("mtholder").innerHTML=
"<textarea id=mtext cols='43' rows='10' wrap='hard' "+
"onFocus='document.onmousedown=null'></textarea>"+
"<br>&nbsp;<img src=clip.gif width=11 height=11>"+
"<span id=attFile style='padding-left:5;padding-right:5;"+
"font-style:italic'>[none]</span>";
  attList=null; attSize=null;
  if (frames["attfr"]&&!document.all) delete frames["attfr"];
  document.getElementById("mtext").focus();}
else hide("m");}

function sendMail() {
if (trim(document.getElementById("mtext").value).length==0) {
  alert("No text to send");
  document.getElementById("mtext").focus();
  return;}
document.getElementById("sndmailbtn").disabled=true;
if (window.dtAtt) {window.clearInterval(dtAtt); dtAtt=null;}
mailStr=document.getElementById("mtext").value;
var sndmsg="Sending...";
if (frames["mailframe"]&&!document.all) delete frames["mailframe"];
document.getElementById("mailDiv").innerHTML=
"<span class=blink style='position:absolute;left:2;top:2;font-family:Tahoma;"+
"background-color:maroon;color:white;z-index:1000;'>"+
sndmsg+"</span>"+
"<div style='position:absolute;left:0;top:0;visibility:hidden'>"+
"<iframe name=mailframe src='sendmail.php'></frame></div>";
detectSent();}

function detectSent() {
if (!frames["mailframe"].document.getElementById("sent")) {
window.setTimeout('detectSent()',500); return;}
document.getElementById("mailDiv").innerHTML="";
if (!document.all) delete frames["mailframe"];
if (frames["attfr"]&&!document.all) delete frames["attfr"];
attList=null; attSize=null;
alert("Sent an e-mail to webmaster");}

function attach() {
if (window.dtAtt) {window.clearInterval(dtAtt); dtAtt=null;}
if (document.getElementById("att").innerHTML=="")
if (parseInt(document.getElementById("mailayer").style.top)>80)
document.getElementById("mailayer").style.top=
parseInt(document.getElementById("mailayer").style.top)-80;
else document.getElementById("mailayer").style.top=0;
if (frames["attfr"]&&!document.all) delete frames["attfr"];
document.getElementById("att").innerHTML=
"<iframe name='attfr' src=attach_en.php frameborder=0 "+
"height=80 width=360></iframe>";
document.getElementById("att").style.display="block";
if (!window.dtAtt) dtAtt=window.setInterval('detectAtt()',1000);}

function detectAtt() {
if (!frames["attfr"].document.getElementById("done")) return;
window.clearInterval(dtAtt); dtAtt=null;
if (document.getElementById("attFile").innerHTML=="[none]"){
  document.getElementById("attFile").style.fontStyle="normal";
  document.getElementById("attFile").innerHTML=
attfr.document.getElementById("progress").innerHTML+
attfr.document.getElementById("fsize").innerHTML;
attList=new Array(attfr.document.getElementById("progress").innerHTML);
attSize=new Array(attfr.document.getElementById("fsize").innerHTML);}
else {
  document.getElementById("attFile").innerHTML+=
"; "+attfr.document.getElementById("progress").innerHTML+
attfr.document.getElementById("fsize").innerHTML;
attList.push(attfr.document.getElementById("progress").innerHTML);
attSize.push(attfr.document.getElementById("fsize").innerHTML);}
document.getElementById("att").style.display="none";
document.getElementById('btnMailClose').innerHTML=
"<img src='tr.gif' width=52 height=28 border=0 onClick=hide('m') "+
"onMouseOver=this.src='trf.gif' onMouseOut=this.src='tr.gif'>";
document.getElementById("mtext").focus();}

function detectRm() {
if (!frames["rmfr"].document.getElementById("done")) return;
window.clearInterval(dtRm); attList=null;
document.getElementById("mailDiv").innerHTML="";
if (!document.all) delete frames["rmfr"];}

function attDivHide() {
window.clearInterval(dtAtt); dtAtt=null;
document.getElementById("att").style.display="none";
if (frames["attfr"]&&!document.all) delete frames["attfr"];
document.getElementById("mtext").focus();}

function detectRm2() {
if (!frames["rmfr2"].document.getElementById("done")) return;
window.clearInterval(dtRm2); attList2=null;
document.getElementById("attRm").innerHTML="";
if (!document.all) delete frames["rmfr2"];}
