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


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="abc";
 hwnd=window.open(u,n,f);
 //hwnd.focus();
}
function popup(url){showWin(url,"pss")}


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 vCCCLoginForm()
{var msg="";
 var obj;
 var form=document.f_CCC;
 if(processingForm)
   {alert('The form is being processed.');
    return false;
   }
 processingForm=true;
 if(trim(form.vUser.value)=="")
   {msg="Please enter your user name.";
    obj=form.vUser;
   }
 else if(trim(form.vPassword.value)=="")
   {msg="Please enter your password.";
    obj=form.vPassword;
   }
 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 toggleReqEstFormDetails()
{
 var form=document.f_reqEstimate;
 var sectYes=getObj('ReqYes');
 var sectNo=getObj('ReqNo');
 var sectAll=getObj('ReqAll');
 if(form.vNeedStrategy[0].checked)
   {
     if(sectYes) sectYes.style.display="block";
     if(sectNo) sectNo.style.display="none";
     if(sectAll) sectAll.style.display="block";
   }
 else if(form.vNeedStrategy[1].checked)
   {
     if(sectYes) sectYes.style.display="none";
     if(sectNo) sectNo.style.display="block";
     if(sectAll) sectAll.style.display="block";
   }
 else
   {
     if(sectYes) sectYes.style.display="none";
     if(sectNo) sectNo.style.display="none";
     if(sectAll) sectAll.style.display="none";
   }
}

function toggleREProjTypeOther()
{
 var form=document.f_reqEstimate;
 var divOther=getObj('ProjTypeOther');
 if(form.vProjType[0].checked||form.vProjType[1].checked||form.vProjType[2].checked||form.vProjType[3].checked)
   {
     if(divOther) divOther.style.display="none";
   }
 else
   {
     if(divOther) divOther.style.display="block";
   }
}

function vReqEstimateForm()
{var msg="";
 var obj;
 var form=document.f_reqEstimate;
 if(processingForm)
   {alert('The form is being processed.');
    return false;
   }
 processingForm=true;
 if(form.vNeedStrategy[0].checked)
   {
     if(trim(form.vProjVision1.value)=="")
       {msg="Please tell us about your vision for the project.";
        obj=form.vVision1;
       }
     else if(trim(form.vProjImpact1.value)=="")
       {msg="Please tell us about the impact on your business if you decided not to implement this project.";
        obj=form.vImpact1;
       }
   }
 else if(form.vNeedStrategy[1].checked)
   {
     if(trim(form.vProjVision.value)=="")
       {msg="Please tell us about your vision for the project.";
        obj=form.vVision;
       }
     else if(trim(form.vProjImpact.value)=="")
       {msg="Please tell us about the impact on your business if you decided not to implement this project.";
        obj=form.vImpact;
       }
     else if(trim(form.vProjTarget.value)=="")
       {msg="Please tell us about the target audience of your project.";
        obj=form.vTarget;
       }
     else if(trim(form.vProjInteraction.value)=="")
       {msg="Please tell us how would the target market interact with your website.";
        obj=form.vInteraction;
       }
   }
 else
   {
     msg="Please tell us whether you need on-line business strategy consulting or not.";
     obj=form.vAccepted;
   }
 if(msg=="")
   {
     if(trim(form.vProjBudget.value)=="")
       {msg="Please select the budget range for your project.";
        obj=form.vProjBudget;
       }
     else if(trim(form.vProjTime.value)=="")
       {msg="Please specify the time frame for your project.";
        obj=form.vProjTime;
       }
     else if(trim(form.vContFirstName.value)=="")
       {msg="Please tell us your name.";
        obj=form.vContFirstName;
       }
     else if(trim(form.vContLastName.value)=="")
       {msg="Please tell us your name.";
        obj=form.vContLastName;
       }
     else if(!emailCheck(form.vContEmail.value))
       {msg="Please provide a valid e-mail address where we can contact you.";
        obj=form.vContEmail;
       }
     else if(trim(form.vContPhone.value)=="")
       {msg="Please provide a phone number where we can contact you.";
        obj=form.vContPhone;
       }
     else if(trim(form.vContOrgName.value)=="")
       {msg="Please tell us the name of your organization.";
        obj=form.vContOrgName;
       }
     else if(trim(form.vContPosition.value)=="")
       {msg="Please tell us what is your position within the organization.";
        obj=form.vContPosition;
       }
     else if(trim(form.vContIndustry.value)=="")
       {msg="Please tell us what industry is your organization mainly active in.";
        obj=form.vContIndustry;
       }
     else if(trim(form.vContProv.value)=="")
       {msg="Please tell us where are you located.";
        obj=form.vContProv;
       }
     else if(trim(form.vContCity.value)=="")
       {msg="Please tell us where are you located.";
        obj=form.vContCity;
       }
//      else if(form.vAccepted.checked==false)
//        {msg="You have to confirm that you read, understood and accepted the Terms of Use and the Privacy Policy, before continuing.";
//         obj=form.vAccepted;
//        }
   }
 if(msg!="")
   {alert(msg);
    obj.focus();
    processingForm=false;
    return false;
   }
 return true;
}


function vReqReviewForm()
{var msg="";
 var obj;
 var form=document.f_reqReview;
 if(processingForm)
   {alert('The form is being processed.');
    return false;
   }
 processingForm=true;
 if(trim(form.vWebURL.value)=="")
   {msg="Please tell us the address of your website.";
    obj=form.vWebURL;
   }
 else if(trim(form.vWebProblems.value)=="")
   {msg="Please tell us what are your concerns about the performance of your website.";
    obj=form.vWebProblems;
   }
 else if(trim(form.vContFirstName.value)=="")
   {msg="Please tell us your name.";
    obj=form.vContFirstName;
   }
 else if(trim(form.vContLastName.value)=="")
   {msg="Please tell us your name.";
    obj=form.vContLastName;
   }
 else if(!emailCheck(form.vContEmail.value))
   {msg="Please provide a valid e-mail address where we can contact you.";
    obj=form.vContEmail;
   }
 else if(trim(form.vContPhone.value)=="")
   {msg="Please provide a phone number where we can contact you.";
    obj=form.vContPhone;
   }
 else if(trim(form.vContOrgName.value)=="")
   {msg="Please tell us the name of your organization.";
    obj=form.vContOrgName;
   }
 else if(trim(form.vContPosition.value)=="")
   {msg="Please tell us what is your position within the organization.";
    obj=form.vContPosition;
   }
 else if(trim(form.vContIndustry.value)=="")
   {msg="Please tell us what industry is your organization mainly active in.";
    obj=form.vContIndustry;
   }
 else if(trim(form.vContProv.value)=="")
   {msg="Please tell us where are you located.";
    obj=form.vContProv;
   }
 else if(trim(form.vContCity.value)=="")
   {msg="Please tell us where are you located.";
    obj=form.vContCity;
   }
 else if(form.vOwner.checked==false)
   {msg="We can only provide the review to the website owner or the manager responsible for the website within the business that owns it.";
    obj=form.vOwner;
   }
 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;
}

function getObj(id,d)
{var i,o,d; if(!d) d=document;
 if(!(o=d[id])&&d.all) o=d.all[id];
 if(!o&&d.getElementById) o=d.getElementById(id);
 for(i=0;!o&&i<d.forms.length;i++) o=d.forms[i][id];
 for(i=0;!o&&d.layers&&i<d.layers.length;i++) o=getObj(id,d.layers[i].document);
 return o;
}

function preloadImages()
{var d=document;
 if(d.images)
   {if(!d._pi) d._pi=new Array();
    var i,j=d._pi.length,a=preloadImages.arguments;
    for(i=0;i<a.length;i++)
      {d._pi[j]=new Image; d._pi[j++].src=a[i];
      }
   }
}

function swapImages()
{var i,j=0,io,a=swapImages.arguments; document._soi=new Array;
 for(i=0;i<(a.length-1);i+=2)
   if((io=getObj(a[i]))!=null)
     {document._soi[j++]=io; if(!io.oSrc) io.oSrc=io.src; io.src=a[i+1];}
}

function restoreSwapImages()
{var i,io,a=document._soi;
 for(i=0;a&&i<a.length&&(io=a[i])&&io.oSrc;i++) io.src=io.oSrc;
}

// if(top.location.hostname.indexOf('xentage')<0) top.location.href='http://www.xentage.ca/';