
var errorarray= new Array()
var errorindex = 0

function IsEmpty(aTextField, adesc) {
   if ((aTextField.value.length==0) ||
   (aTextField.value==null)) {
   errorindex=errorindex+1
      errorarray[errorindex] = adesc
   }
   else { return false; }
}
function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 
}





function validateQA(){

var testvar =''
errorindex = 0

IsEmpty(document.Ask.fullname, 'Name is blank');
IsEmpty(document.Ask.antispam, 'Please fill out the anti-spam question');
IsEmpty(document.Ask.tel, 'Telephone Number is blank');
IsEmpty(document.Ask.question, 'Question is blank');


if (document.Ask.antispam.value.toLowerCase() != "racecar"){
errorindex=errorindex+1
errorarray[errorindex] = 'To help prevent spam please type "racecar" into the anti-spam box.'
}


testvar = isValidEmail(document.Ask.email.value)
if (testvar == false){
errorindex=errorindex+1
errorarray[errorindex] = 'Email address is not valid or is blank'
}

var errorstring = ''
if (errorindex>0){
for(var i=1; i<=errorindex; i++){
errorstring = errorstring + '- ' + errorarray[i] + '\n'
}
}


if (errorindex==0){
return true

} else {
alert('Please correct the following problems:\n'+errorstring)
return false
}


}




function validateReview(){

var testvar =''
errorindex = 0

IsEmpty(document.Review.fullname, 'Name is blank');
IsEmpty(document.Review.antispam, 'Please fill out the anti-spam question');
IsEmpty(document.Review.tel, 'Telephone Number is blank');
IsEmpty(document.Review.reviewtext, 'Review Text is blank');


if (document.Review.antispam.value.toLowerCase() != "racecar"){
errorindex=errorindex+1
errorarray[errorindex] = 'To help prevent spam please type "racecar" into the anti-spam box.'
}


testvar = isValidEmail(document.Review.email.value)
if (testvar == false){
errorindex=errorindex+1
errorarray[errorindex] = 'Email address is not valid or is blank'
}

var errorstring = ''
if (errorindex>0){
for(var i=1; i<=errorindex; i++){
errorstring = errorstring + '- ' + errorarray[i] + '\n'
}
}


if (errorindex==0){
return true

} else {
alert('Please correct the following problems:\n'+errorstring)
return false
}


}








function validatePP(){

var testvar =''
errorindex = 0

IsEmpty(document.project.YourName, 'Name is blank');
IsEmpty(document.project.YourTel, 'Telephone Number is blank');
IsEmpty(document.project.ProjectName, 'Project Name is blank');
IsEmpty(document.project.DeliveryDate, 'Delivery Date is blank');
IsEmpty(document.project.Quantity, 'Quantity is blank');
IsEmpty(document.project.antispam, 'Please fill out the anti-spam question');


if (document.project.antispam.value.toLowerCase() != "racecar"){
errorindex=errorindex+1
errorarray[errorindex] = 'To help prevent spam please type "racecar" into the anti-spam box.'
}


testvar = isValidEmail(document.project.YourEmail.value)
if (testvar == false){
errorindex=errorindex+1
errorarray[errorindex] = 'Email address is not valid or is blank'
}

var errorstring = ''
if (errorindex>0){
for(var i=1; i<=errorindex; i++){
errorstring = errorstring + '- ' + errorarray[i] + '\n'
}
}


if (errorindex==0){
closeprojectdiv();
return true

} else {
alert('Please correct the following problems:\n'+errorstring)
return false
}


}



function showTab(DIVID){

if(document.getElementById("QA1").style.display!="none"){
document.getElementById("QA1").style.display="none";
document.getElementById("QA2").style.display="";
document.getElementById("QADESC").style.display="none";
}

if(document.getElementById("RV1").style.display!="none"){
document.getElementById("RV1").style.display="none";
document.getElementById("RV2").style.display="";
document.getElementById("RVDESC").style.display="none";
}

if(document.getElementById("DS1").style.display!="none"){
document.getElementById("DS1").style.display="none";
document.getElementById("DS2").style.display="";
document.getElementById("DSDESC").style.display="none";
}

document.getElementById(DIVID+"1").style.display="";
document.getElementById(DIVID+"2").style.display="none";
document.getElementById(DIVID+"DESC").style.display="";


}