function ProceedForm(nameOfForm){
//  =============================================================================  
//  Purpose:  To create a querystring that checks all fields from the form.
//  Inputs:   The name of the form where the checkbox array resides.
//            The name of the checkboxes control in the form.
//  Author:   Vladimir Bakman  4/15/2002
//  Note:     This JAVASCRIPT was built to support the CompleteTaxpro order form.
//  =============================================================================
   
   var temp;
   temp=eval("document." + nameOfForm);
   
    if (temp.cname.value.length == 0){
        temp.cname.focus();  
        alert("Please enter your name.");
        return;
    } 

    if (temp.account.value.length == 0){
        temp.account.focus(); 
        alert("Please enter your account.");
        return;
    }         
    
    if (temp.email.value.length == 0){
        temp.email.focus(); 
        alert("Please enter your email.");
        return;
    }       
    if ( (temp.email.value.length < 5) || (temp.email.value.indexOf("@") < 0) || ( temp.email.value.indexOf(".") < 0 )  ){
        alert("Please enter a valid e-mail address.");
        return false;
    }
    
    if (temp.os.value.length == 0){
        temp.os.focus(); 
        alert("Please enter your operating system.");
        return;
    }                  
    if (temp.browser.value.length == 0){
        temp.browser.focus(); 
        alert("Please enter browser name.");
        return;
    }
    if (temp.connection.value.length == 0){
        temp.connection.focus(); 
        alert("Please enter your connection type/speed.");
        return;
    }                  
    if (temp.comments.value.length == 0){
        temp.comments.focus(); 
        alert("Please enter your comments.");
        return;
    }
    
    temp.submit();

}

function ProceedToStore2(nameOfForm, nameOfElements, storeURL, campaignID, recordClick, wbid, looknfeel, busUnit){
//  =============================================================================  
//  Purpose:  To create a querystring that contains all the products selected by
//            the customer. If no products have been selected, nothing will 
//            happen and the customer will remain in the store. If the customer
//            has selected one or more products and the form requires server-side
//            logic, the form will be submitted to the back-end.
//  Inputs:   The name of the form where the checkbox array resides.
//            The name of the checkbox control in the form.
//  Author:   Mark Orlando  3/14/2002
//  Note:     THIS JAVASCRIPT WAS BUILT TO SUPPORT THE DPC ORDER FORM.
//  =============================================================================
    var urlToStore       = "";
    var elementsInQues   = document.forms[nameOfForm].elements[nameOfElements].value.split(",");
    var whatWasPicked    = new Array;
    var iNumberPicked    = 0;
    var itemsPicked      = "";
    
    for (var j=0; j < elementsInQues.length; j++){
        whatWasPicked[j] = ProductsPicked(nameOfForm, elementsInQues[j]);
        iNumberPicked += NumberOfProductsPicked(nameOfForm, elementsInQues[j]);  
        if (whatWasPicked[j].length > 0){
            if (itemsPicked.length > 0){
                itemsPicked = itemsPicked + "&" + whatWasPicked[j]; 
            } else {
                itemsPicked = whatWasPicked[j]; 
            }
        } 
    }
    if (iNumberPicked > 0){
        if (document.forms[nameOfForm].elements["txtFirstName"].value.length == 0){
            document.forms[nameOfForm].elements["txtFirstName"].focus();  
            alert("Please enter a first name.");
            return;
        } 
        if (document.forms[nameOfForm].elements["txtLastName"].value.length == 0){
            document.forms[nameOfForm].elements["txtLastName"].focus(); 
            alert("Please enter a last name.");
            return;
        }         
        if (document.forms[nameOfForm].elements["txtAreaCode"].value.length == 0){
            document.forms[nameOfForm].elements["txtAreaCode"].focus(); 
            alert("Please enter an area code.");
            return;
        }       
        if (document.forms[nameOfForm].elements["txtPhoneNumber"].value.length == 0){
            document.forms[nameOfForm].elements["txtPhoneNumber"].focus(); 
            alert("Please enter a phone number.");
            return;
        }                  
    }
    if (iNumberPicked > 0){
        if (iNumberPicked == 1){
            urlToStore = storeURL + "?Action=Add";
        } else {
            urlToStore = storeURL + "?Action=AddMultipleProducts";
        }
        urlToStore = urlToStore + "&" + itemsPicked;
        
        if (campaignID.length){
            urlToStore = urlToStore + "&CampaignID=" + campaignID;
        }        
        if (recordClick.length){
            urlToStore = urlToStore + "&RecordClick=" + recordClick;
        }      
        if (wbid.length){
            urlToStore = urlToStore + "&wbid=" + wbid;
        }
        if (looknfeel.length){
            urlToStore = urlToStore + "&gpalooknfeel=" + looknfeel;
        }        
        urlToStore = urlToStore + "&BU=" + busUnit;
                
        document.forms[nameOfForm].elements["URLToStore"].value = urlToStore;      
        document.forms[nameOfForm].submit();
    }
}
function ProceedToStore(nameOfForm, nameOfElement, storeURL, campaignID, recordClick, wbid, looknfeel, busUnit){
//  =============================================================================  
//  Purpose:  To create a querystring that contains all the products selected by
//            the customer. If no products have been selected, nothing will 
//            happen and the customer will remain in the store. If the customer
//            has selected one or more products, the user will be redirected to
//            the online store.
//  Inputs:   The name of the form where the checkbox array resides.
//            The name of the checkbox control in the form.
//  Author:   Mark Orlando  2/28/2002
//  =============================================================================
    var urlToStore = "";
    var whatWasPicked = ProductsPicked(nameOfForm, nameOfElement);
    var iNumberPicked = NumberOfProductsPicked(nameOfForm, nameOfElement);

    if (whatWasPicked.length == 0){
        return;
    } else {
        if (iNumberPicked == 1){
            urlToStore = storeURL + "?Action=Add";
        } else {
            urlToStore = storeURL + "?Action=AddMultipleProducts";
        }
        urlToStore = urlToStore + "&" + whatWasPicked;
        
        if (campaignID.length){
            urlToStore = urlToStore + "&CampaignID=" + campaignID;
        }        
        if (recordClick.length){
            urlToStore = urlToStore + "&RecordClick=" + recordClick;
        }      
        if (wbid.length){
            urlToStore = urlToStore + "&wbid=" + wbid;
        }
        if (looknfeel.length){
            urlToStore = urlToStore + "&gpalooknfeel=" + looknfeel;
        }        
        urlToStore = urlToStore + "&BU=" + busUnit;
        
        document.location.href=urlToStore;        
        return;
    }
}
function ProductsPicked(nameOfForm, nameOfElement){
//  =============================================================================  
//  Purpose:  To return a delimited string made up of all the products the user 
//            has selected. Products must be represented by a checkbox element 
//            array for a particular form. 
//  Inputs:   The name of the form where the checkbox array resides.
//            The name of the checkbox control in the form.
//  Author:   Mark Orlando  2/28/2002
//  =============================================================================
    var wasPicked = "";
    var prodID = "";
    var mediaFormat = "";
    var formElementLength = document.forms[nameOfForm].elements[nameOfElement].length;
    if (formElementLength > 0){
        for (var j=0; j < document.forms[nameOfForm].elements[nameOfElement].length; j++){
            if (document.forms[nameOfForm].elements[nameOfElement][j].checked == true){
                var productParts = document.forms[nameOfForm].elements[nameOfElement][j].value.split(".");
                if (productParts.length == 2){                        
                    prodID = productParts[0];
                    mediaFormat  = productParts[1];
                } 
                wasPicked = wasPicked + "ProductID=" + prodID + "&Format" + prodID + "=" + mediaFormat + "&" 
            }
        }
    } else {
        if (document.forms[nameOfForm].elements[nameOfElement].checked == true){
            var productParts = document.forms[nameOfForm].elements[nameOfElement].value.split(".");
            if (productParts.length == 2){                        
                prodID = productParts[0];
                mediaFormat  = productParts[1];
            } 
            wasPicked = wasPicked + "ProductID=" + prodID + "&Format" + prodID + "=" + mediaFormat + "&"
        }
    }
    if (wasPicked > ""){
        wasPicked = wasPicked.substring(0, wasPicked.length - 1);  
    }  
    return wasPicked; 
}
function RBPicked(nameOfForm, nameOfTextBox, allStates){
//  =============================================================================  
//  Purpose:  If the customer clicked on "All States", the allStates variable 
//            will have a value of 0.
//  Inputs:   The name of the form where the radio button array resides.
//            The name of the textbox control in the form.
//            Indicator as to whether user clicked all states or not.
//  Author:   Mark Orlando  3/21/2002
//  =============================================================================
    if (allStates == 0){
        document.forms[nameOfForm].elements[nameOfTextBox].value = "";
        document.forms[nameOfForm].elements[nameOfTextBox].disabled = true;        
    } else {
        document.forms[nameOfForm].elements[nameOfTextBox].disabled = false;   
    }
}
function NumberOfProductsPicked(nameOfForm, nameOfElement){
//  =============================================================================  
//  Purpose:  To return the number of products picked.
//  Inputs:   The name of the form where the checkbox array resides.
//            The name of the checkbox control in the form.
//  Author:   Mark Orlando  2/28/2002
//  =============================================================================
    var iNumberPicked = 0;
    var formElementLength = document.forms[nameOfForm].elements[nameOfElement].length;
    if (formElementLength > 0){
        for (var j=0; j < document.forms[nameOfForm].elements[nameOfElement].length; j++){
            if (document.forms[nameOfForm].elements[nameOfElement][j].checked == true){
                iNumberPicked = iNumberPicked + 1;
            }
        }
    } else {
        if (document.forms[nameOfForm].elements[nameOfElement].checked == true){
            iNumberPicked = 1;
        }
    }
    return iNumberPicked; 
}
