function Loadimg(idImgName,imgName)
{
 document.images[idImgName].src=imgName;
}

function OpenDoc (myhref,myname,x,y)
 {
  if(x==0) dx = 805; else dx=x+25;
  if(y==0) dy = 605; else dy=y+25;
  oImgView = open(myhref, myname, 'toolbar=no,menubar=no,scrollbars=no,resizable=no,left=10, top=10, width='+dx+', height='+dy+'');//
  oImgView.focus();
  return false;
 }
 
 function OpenImg (imagePath, title,x,y)
 {
  if(x==0) dx = 805; else dx=x+25;
  if(y==0) dy = 605; else dy=y+25;
  oImgView = open('', '', 'toolbar=no,menubar=no,scrollbars=no,resizable=no,left=10, top=10, width='+dx+', height='+dy+'');//
  oImgView.focus();
  oImgView.document.clear();
  oImgView.document.write("<TITLE>"+title+"</TITLE>");
  oImgView.document.write("<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>");
  oImgView.document.write("<CENTER><TABLE width="+dx+" height="+dy+" border=0 cellspacing=0 padding=0><TD align=center valign=center>");
  oImgView.document.write("<img src='"+imagePath+"' width='"+x+"' height='"+y+"'>");
  oImgView.document.write("</TD></TABLE></CENTER></BODY>");
  return false;
 }

 function IsEmpty(field) {
  if (field=='') 
  	return true
	else
	return false
}

function Clean(field) {
 field.value='';
} 
 
function Focus(control) {
  control.focus();
  control.select();
} 

function IsEmailCorrect(email) {
  return email.match(/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,3})$/)!=null;
}

function Check(form)
{
if (IsEmpty(form.name.value)) {
    alert('Name field is empty');
    Focus(form.name);
    return false;
  }
if (IsEmpty(form.betreff.value)) {
    alert('Betreff field is empty');
    Focus(form.betreff);
    return false;
  }   
if (IsEmpty(form.mail.value)) {
    alert('E-mail field is empty');
    Focus(form.mail);
    return false;
  } 
if (!IsEmailCorrect(form.mail.value)) {
    alert('Correct Your e-mail address');
    Focus(form.mail);
    return false;
  }     
if (IsEmpty(form.richt.value)) {
    alert('Nachricht field is empty');
    Focus(form.richt);
    return false;
  }
return true;
} 
