function echomail(acc,dom){document.write(acc+"@"+dom)}
function mail2(acc,dom){location.href="mailto:"+acc+"@"+dom}


function showWin(u,n)
{f=(n=="gmg2"?"top=20,left=20":"top=0,left=0")
  +",width=750,height=600,location=no,menubar=no,titlebar=no,status=no,toolbar=no,"
  +"scrollbars=yes,"
  +"resizable=yes";
 if(typeof(n)=="undefined") n="gmg";
 hwnd=window.open(u,n,f);
 //hwnd.focus();
}
function popup(url){showWin(url,"gmg")}



function vContactForm()
{var msg="";
 var obj;
 var form=document.f_contact;
 form.submit.disabled=true;
 if(trim(form.vName.value)=="")
   {msg="Please enter your name.";
    obj=form.vName;
   }
 else if(!emailCheck(form.vEmail.value))
   {msg="Please provide a valid e-mail address where we can send a reply.";
    obj=form.vEmail;
   }
 else if(trim(form.vSubject.value)==""||form.vSubject.value[0]=="-")
   {msg="Please choose a subject for your message.";
    obj=form.vSubject;
   }
 else if(trim(form.vMsg.value)=="")
   {msg="Please type in the message you want to send to us.";
    obj=form.vMsg;
   }
 if(msg!="")
   {alert(msg);
    obj.focus();
    form.submit.disabled=false;
    return false;
   }
 return true;
}

function vTellafriendForm()
{var msg="";
 var obj;
 var form=document.f_tellafriend;
 if(trim(form.vFromName.value)=="")
   {msg="Please enter your name.\nThe invitation will be signed using this name.";
    obj=form.vFromName;
   }
 else if(!emailCheck(form.vFromEmail.value))
   {msg="Please specify your e-mail address and make sure it's correct.\nThe invitation will appear to be sent from this address.\nIt is also useful if your friend wants to reply to you.";
    obj=form.vFromEmail;
   }
 else if(trim(form.vToName.value)=="")
   {msg="Please specify your friend's name.\nThe invitation will be addressed to this name.";
    obj=form.vToName;
   }
 else if(!emailCheck(form.vToEmail.value))
   {msg="Please specify your friend's e-mail address and make sure it's correct.\nThe invitation will be sent to this address.";
    obj=form.vToEmail;
   }
 if(msg!="")
   {alert(msg);
    obj.focus();
    return false;
   }
 return true;
}

function vAssessmentForm()
{var msg="";
 var obj;
 var form=document.f_assessment;
 form.submit.disabled=true;
 if(trim(form.vName.value)=="")
   {msg="Please enter your name.";
    obj=form.vName;
   }
 else if(trim(form.vPhone.value)=="")
   {msg="Please specify your phone number.";
    obj=form.vPhone;
   }
 else if(trim(form.vCity.value)=="")
   {msg="Please specify your city.";
    obj=form.vCity;
   }
 else if(trim(form.vProv.value)=="")
   {msg="Please specify your province.";
    obj=form.vProv;
   }
 else if(trim(form.vCountry.value)=="")
   {msg="Please specify your country.";
    obj=form.vCountry;
   }
 else if(!emailCheck(form.vEmail.value))
   {msg="Please provide a valid e-mail address where we can send your assessment.";
    obj=form.vEmail;
   }
 if(msg!="")
   {alert(msg);
    obj.focus();
    form.submit.disabled=false;
    return false;
   }
 return true;
}



function trim(str)
{var first,last;
 for (first=0; first<str.length&&str.charCodeAt(first)==32; first++);
 for (last=str.length; last>first&&str.charCodeAt(last-1)==32; last--);
 return (last>first?str.substr(first,last-first):'');
}

function emailCheck(emailStr) {
emailStr=trim(emailStr);
if(emailStr=='')return false;
var emailPat=/^(.+)@(.+)\.(.{2,})$/;
var matchArray=emailStr.match(emailPat);
if (matchArray==null) return false;
return true;
}

