<!-- HIDE
//  Copyright (c) 2001 WinWriters
//  You are free to use or modify this code only if you reference the
//  WinWriters web site http://www.winwriters.com
//  Coded by Rick Schlamp

//Script to check for missing required form information before server submission

function chkFormtest(salarysurvey) {
alert('h3er');
alert(salarysurvey.StateProv.selectedIndex == 0);
alert(document.forms[0].StateProv.selectedIndex==0
);
}


function chkForm(salarysurvey,anyAll) {

var AlertText = "We need you to respond to each question. You did not respond to the following:\n\n";
var ErrFlag = 0;
var ChkFlag, i;
var numButtons;
var numBoxes;
// Regular expression patterns
//   ZIP/Postal Code
// var Zpattern = /^\d{5}(-\d{4})?$|^[a-zA-Z]\d{1}[a-zA-Z]\s\d{1}[a-zA-Z]\d{1}$/;
//   3-digit U.S. ZIP Code
var Zpattern = /^\d{3,5}$/;
//   Salary
var Spattern1 = /(^\d{4,7}$)|(^\$\d{4,7}$)/;
var Spattern2 = /^\$\d{4,7}$/;
var Hpattern = /^\d{1,3}$/;


//populate browser detection fields

var screenW = 640, screenH = 480;
if (parseInt(navigator.appVersion)>3) {
 salarysurvey.ScrWidth.value = screen.width;
 salarysurvey.ScrHeight.value = screen.height;
}
else if (navigator.appName == "Netscape" 
    && parseInt(navigator.appVersion)==3
    && navigator.javaEnabled()
   ) 
{
 var jToolkit = java.awt.Toolkit.getDefaultToolkit();
 var jScreenSize = jToolkit.getScreenSize();
 salarysurvey.ScrWidth.value = jScreenSize.width;
 salarysurvey.ScrHeight.value = jScreenSize.height;
}
 salarysurvey.JavaEnabled.value = navigator.javaEnabled();


// Set variable for Canada/Other locations (Nav doesn't recognize change "value" 
//  property change through selection, see below; works for IE)
// var NotUS = (salarysurvey.StateProv.value == "AB" || salarysurvey.StateProv.value == "BC" || salarysurvey.StateProv.value == "MB" || salarysurvey.StateProv.value == "NB" || salarysurvey.StateProv.value == "NW" || salarysurvey.StateProv.value == "NT" || salarysurvey.StateProv.value == "NS" || salarysurvey.StateProv.value == "NU" || salarysurvey.StateProv.value == "ON" || salarysurvey.StateProv.value == "PE" || salarysurvey.StateProv.value == "QU" || salarysurvey.StateProv.value == "SA" || salarysurvey.StateProv.value == "YU" || salarysurvey.StateProv.value == "Other");

// Set variable for Canada/Other locations (works for Navigator and IE)
var NotUS = (salarysurvey.StateProv.selectedIndex == 3 || salarysurvey.StateProv.selectedIndex == 7 || salarysurvey.StateProv.selectedIndex == 23 || salarysurvey.StateProv.selectedIndex == 32 || salarysurvey.StateProv.selectedIndex == 33 || salarysurvey.StateProv.selectedIndex == 42 || salarysurvey.StateProv.selectedIndex == 43 || salarysurvey.StateProv.selectedIndex == 44 || salarysurvey.StateProv.selectedIndex == 47 || salarysurvey.StateProv.selectedIndex == 50 || salarysurvey.StateProv.selectedIndex == 51 || salarysurvey.StateProv.selectedIndex == 53 || salarysurvey.StateProv.selectedIndex == 65 || salarysurvey.StateProv.selectedIndex == 1);

//Reset generic respondent name to email address
//document.forms[0].realname.value = document.forms[0].email.value;

// Check for no selection in dropdown list box
if (salarysurvey.StateProv.selectedIndex == 0) {
    AlertText += "           Your work location\n";
    ErrFlag = 1;
    }

// Check for missing information in text boxes

if (NotUS == false) {
	var vz = salarysurvey.ZIP.value;
	var testResultz = Zpattern.test(vz);

	if (testResultz == false) {
		AlertText += "           The first 3 digits of your ZIP Code\n";
		ErrFlag = 1;
	}
}
else {
	salarysurvey.ZIP.value = "";
}

// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 2;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.Gender[i].checked == true)
        ChkFlag += 1;
    }
    
if (ChkFlag == 0) {
    AlertText += "           Your gender\n";
    ErrFlag = 1;
    }
    
// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 4;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.Education[i].checked == true)
        ChkFlag += 1;
    }
    
if (ChkFlag == 0) {
    AlertText += "           Your highest level of education\n";
    ErrFlag = 1;
    }

// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 2;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.TechCommEd[i].checked == true)
        ChkFlag += 1;
    }
    
if (ChkFlag == 0) {
    AlertText += "           Relationship of your education to technical communication\n";
    ErrFlag = 1;
    }

// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 5;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.WhereLearnedUA[i].checked == true)
        ChkFlag += 1;
    }

// Check for "Other" text without button selected (or another button selected)
//   Commented out since it's possible that he/she selected an option that's
//   not "Other" but typed something in the text box;
//   Force them to check "Other" if typing text to avoid possible confusion
/* if (salarysurvey.WhereLearnedUAOther.value != "" && !salarysurvey.WhereLearnedUA[numButtons-1].checked) {
    salarysurvey.WhereLearnedUA[numButtons-1].checked = true;
    ChkFlag += 1;
    }
    
if (salarysurvey.WhereLearnedUA[numButtons-1].checked == true && salarysurvey.WhereLearnedUAOther.value == "")
    ChkFlag = 0; */
    
if (ChkFlag == 0) {
    AlertText += "           Where you learned your Help skills\n";
    ErrFlag = 1;
    }

// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 8;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.TechCommExp[i].checked == true)
        ChkFlag += 1;
    }

if (ChkFlag == 0) {
    AlertText += "           How long in technical communication\n";
    ErrFlag = 1;
    }

// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 8;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.UAExp[i].checked == true)
        ChkFlag += 1;
    }

if (ChkFlag == 0) {
    AlertText += "           How long developing software user assistance\n";
    ErrFlag = 1;
    }

// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 8;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.WHExp[i].checked == true)
        ChkFlag += 1;
    }

if (ChkFlag == 0) {
    AlertText += "           How long developing Windows Help\n";
    ErrFlag = 1;
    }

// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 7;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.WebExp[i].checked == true)
        ChkFlag += 1;
    }

if (ChkFlag == 0) {
    AlertText += "           How long developing Web content\n";
    ErrFlag = 1;
    }

// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 4;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.ManagePct[i].checked == true)
        ChkFlag += 1;
    }

if (ChkFlag == 0) {
    AlertText += "           Percentage of work in management\n";
    ErrFlag = 1;
    }

// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 4;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.NumDev[i].checked == true)
        ChkFlag += 1;
    }

if (ChkFlag == 0) {
    AlertText += "           Number of people in Help development at your company\n";
    ErrFlag = 1;
    }

// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 5;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.NumEmp[i].checked == true)
        ChkFlag += 1;
    }

if (ChkFlag == 0) {
    AlertText += "           Number of people in your organization\n";
    ErrFlag = 1;
    }

// Check for checkbox questions with nothing checked
ChkFlag = 0;
numBoxes = 6;
salarysurvey.WorkingConditions[numBoxes].value = ".";
for (i = 0; i < numBoxes; i++) {
    if (salarysurvey.WorkingConditions[i].checked == true)
        ChkFlag += 1;
    }

if (ChkFlag == 0) {
    salarysurvey.WorkingConditions[numBoxes].value = "Nothing checked";
    }

// Check for missing information in text boxes
var vs = salarysurvey.Salary.value;
var testResults1 = Spattern1.test(vs);

if (testResults1 == false) {
    AlertText += "           Annual salary as a whole number\n";
    ErrFlag = 1;
    }
else {
	var testResults2 = Spattern2.test(vs);
	if (testResults2 == true && vs.substr(0,1) == "$") {
		salarysurvey.Salary.value=vs.substr(1);
		}
	}

// Check for missing information in text boxes
var vh = salarysurvey.NumHours.value;
var testResulth = Hpattern.test(vh);

if (testResulth == false) {
    AlertText += "           Average weekly hours as a whole number\n";
    ErrFlag = 1;
    }

// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 4;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.CompSatis[i].checked == true)
        ChkFlag += 1;
    }

if (ChkFlag == 0) {
    AlertText += "           Satisfaction with overall compensation\n";
    ErrFlag = 1;
    }

// Check for radio button questions with nothing checked
ChkFlag = 0;
numButtons = 4;
for (i = 0; i < numButtons; i++) {
    if (salarysurvey.NonMonSatis[i].checked == true)
        ChkFlag += 1;
    }

if (ChkFlag == 0) {
    AlertText += "           Satisfaction with non-monetary benefits\n";
    ErrFlag = 1;
    }




if (anyAll=="all")	{

// If no missing required info, return a true and pass form to server

if (ErrFlag == 0) {
	return true;
	salarysurvey.submit();
}

// Otherwise, return a false with an alert box
    
AlertText += "\nPlease supply the missing information and click Send Form.";
    
alert(AlertText);
return false;
}
else	{
salarysurvey.submit();
}

}

//STOP HIDING -->

