var eqhGroups=new Array();
var idUnique=1;

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


var processingForm=false;

function vContactForm()
{var msg="";
 var obj;
 var form=document.f_contact;
 if(processingForm)
   {alert('The form is being processed.');
    return false;
   }
 processingForm=true;
 if(trim(form.vName.value)=="")
   {msg="Please tell us your name!";
    obj=form.vName;
   }
 else if(!emailCheck(form.vEmail.value))
   {msg="Please provide a valid e-mail address where you want to receive the 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();
    processingForm=false;
    return false;
   }
 return true;
}

function vSendpageForm()
{var msg="";
 var obj;
 var form=document.f_sendpage;
 if(processingForm)
   {alert('The form is being processed.');
    return false;
   }
 processingForm=true;
 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 enter your e-mail address and make sure it is correct.\nThis is useful if your friend wants to reply to your invitation.";
    obj=form.vFromEmail;
   }
 else if(trim(form.vToName.value)=="")
   {msg="Please enter your friend's name.\nThe invitation will be addressed to this name.";
    obj=form.vToName;
   }
 else if(!emailCheck(form.vToEmail.value))
   {msg="Please enter your friend's e-mail address and make sure it is correct.\nThe invitation will be sent to this address.";
    obj=form.vToEmail;
   }
 if(msg!="")
   {alert(msg);
    obj.focus();
    processingForm=false;
    return false;
   }
 return true;
}

function vSignUpForm()
{var msg="";
 var obj;
 var form=document.f_signup;
 if(processingForm)
   {alert('The form is being processed.');
    return false;
   }
 processingForm=true;
 if(trim(form.vFirstName.value)==""&&trim(form.vLastName.value)=="")
   {msg="Please tell us your name!";
    obj=form.vFirstName;
   }
 else if(!emailCheck(form.vEmail.value))
   {msg="Please provide a valid e-mail address where you want to receive the confirmation code!";
    obj=form.vEmail;
   }
 else if(trim(form.vPass.value)=="")
   {msg="Please choose a password!";
    obj=form.vPass;
   }
 else if(trim(form.vPass.value)!=trim(form.vPass2.value))
   {msg="The password and the password confirmation do not match.";
    obj=form.vPass;
   }
 if(msg!="")
   {alert(msg);
    obj.focus();
    processingForm=false;
    return false;
   }
 return true;
}

function clearField(o,t)
{if(typeof(o)=='undefined'||o==null) return;
 if(typeof(o.value)=='undefined') return;
 if(typeof(t)=='undefined'||o.value==t) o.value='';
}

function fillField(o,t)
{if(typeof(o)=='undefined'||o==null) return;
 if(typeof(o.value)=='undefined') return;
 if(typeof(t)!='undefined'&&o.value=='') o.value=t;
}

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;
}
