function $(id) {
  return document.getElementById(id);
}
function checkContact() {
  var allOk = true;
  $('contact-message')["style"]["display"] = "none";
  $("companyname-label")["className"] = "";
  $("lastname-label")["className"] = "";
  $("firstname-label")["className"] = "";
  $("telephone-label")["className"] = "";
  $("email-label")["className"] = "";
  
  if($("companyname")["value"] == "") {
    $("companyname-label")["className"] = "red";
    allOk = false;
  }
  if($("lastname")["value"] == "") {
    $("lastname-label")["className"] = "red";
    allOk = false;
  }
  if($("firstname")["value"] == "") {
    $("firstname-label")["className"] = "red";
    allOk = false;
  }
  if($("telephone")["value"] == "") {
    $("telephone-label")["className"] = "red";
    allOk = false;
  }
  if($("email")["value"] == "") {
    $("email-label")["className"] = "red";
    allOk = false;
  }
  var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
  if(!filter.test($("email")["value"])) {
    $("email-label")["className"] = "red";
    allOk = false;
  }
  if(allOk) {
    document.contactform.submit();
  } else {
    $('contact-message')["style"]["display"] = "block";
    return false;
  }
}
function closePainter() {
  $('buttonblocker')["style"]["display"] = "none";
  $('chameleonpainter-container')["style"]["display"] = "none";
  $('chameleonpainter')["innerHTML"] = "";  
}
function showPainter() {
  $('buttonblocker')["style"]["display"] = "block";
  $('chameleonpainter-container')["style"]["display"] = "block";
  var newH = Number($('content')["offsetHeight"]) + 49;
  $('buttonblocker')["style"]["height"] = Math.round(newH) + "px";
  var newT = 200 - (605 - newH)/2;
  $('chameleonpainter-container')["style"]["top"] = Math.round(newT) + "px";
  var so = new SWFObject("../flash/chameleon_painter.swf", "chameleonpainter", "760px", "465px", "8", "#000");
  so.addParam("wmode", "transparent");
  so.addVariable("lang", ses_lang);
  so.write("chameleonpainter");
}
function closeEcard() {
  $('buttonblocker')["style"]["display"] = "none";
  $('ecard-container')["style"]["display"] = "none";
}
function showEcard() {
  $('buttonblocker')["style"]["display"] = "block";
  $('ecard-container')["style"]["display"] = "block";
  var newH = Number($('content')["offsetHeight"]) + 49;
  $('buttonblocker')["style"]["height"] = Math.round(newH) + "px";
  var newT = 200 - (605 - newH)/2;
  $('ecard-container')["style"]["top"] = Math.round(newT) + "px";
  so2.write("ecard");
}
function PopupCenter(pageURL, title,w,h) {
  var left = (screen.width/2)-(w/2);
  var top = (screen.height/2)-(h/2);
  var targetWin = window.open (pageURL, title, 'toolbar=no, location=yes, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}