function imageSwap(daImage, daSrc){
  var objStr,obj;
  
  // Check to make sure that images are supported in the DOM.
  if(document.images){
    // Check to see whether you are using a name, number, or object
    if (typeof(daImage) == 'string') {
      // This whole objStr nonesense is here solely to gain compatability
      // with ie3 for the mac.
      objStr = 'document.' + daImage;
      obj = eval(objStr);
      obj.src = daSrc;
    } else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
      daImage.src = daSrc;
    }
  }
}

function Validate(formName) {
	switch (formName) {
		case "frmLogin":
			var errMsg = "";
			var email = document.all[formName][0].value;
			var password = document.all[formName][1].value;

			if (!email) {
				errMsg = errMsg + "\nUser Name";
			}
			
			if (!password) {
				errMsg = errMsg + "\nPassword";
			}
			
			if ( (email.indexOf(".") > 2) && (email.indexOf("@") > 0) ) {
			} else {
				alert("User Name doesn't appear to be valid.");
				return false;
			}
			
			if (errMsg != "") {
				errMsg = "The following fields are required:\n" + errMsg;
				alert (errMsg);
				return false;
			}
		break;
        
        case "frmEditAtt":
            if (document.all.frmEditAtt.selAtt.selectedIndex == 0) {
                return false;
            } else {
                location.href="add_edit_att.php?id="+document.all.frmEditAtt.selAtt.options[document.all.frmEditAtt.selAtt.selectedIndex].value;
            }
        break;
        
        case "frmEditCarOpp":
            if (document.all.frmEditCarOpp.selCarOpp.selectedIndex == 0) {
                return false;
            } else {
                location.href="add_edit_job.php?id="+document.all.frmEditCarOpp.selCarOpp.options[document.all.frmEditCarOpp.selCarOpp.selectedIndex].value;
            }
        break;
        
        case "frmJob":
			var errMsg = "";
			var job_type = document.all[formName][0].selectedIndex;
			var job_title = document.all[formName][1].value;
			var o_location = document.all[formName][2].selectedIndex;
			var email = document.all[formName][3].value;
			var description = document.all[formName][4].value;

            if (job_type==0) {
                errMsg = errMsg + "\nJob Type";
            }
            
			if (!job_title) {
				errMsg = errMsg + "\nJob Title";
			}
			
            if (o_location==0) {
                errMsg = errMsg + "\nLocation";
            }
            
			if (!email) {
				errMsg = errMsg + "\nEmail";
			}
			
			if ( (email.indexOf(".") > 2) && (email.indexOf("@") > 0) ) {
			} else {
				alert("Email doesn't appear to be valid.");
				return false;
			}
			
			if (!description) {
				errMsg = errMsg + "\nDescription";
			}
			
			if (errMsg != "") {
				errMsg = "The following fields are required:\n" + errMsg;
				alert (errMsg);
				return false;
			}
        break;
        
        case "frmAtt":
			var errMsg = "";
			var first_name = document.all[formName][0].value;
			var last_name = document.all[formName][2].value;
			var a_position = document.all[formName][3].selectedIndex;
			var title = document.all[formName][4].value;
			var o_location = document.all[formName][5].selectedIndex;
			var email = document.all[formName][6].value;
			var phone = document.all[formName][7].value;

            if (first_name==0) {
                errMsg = errMsg + "\nFirst Name";
            }
            
			if (!last_name) {
				errMsg = errMsg + "\nLast Name";
			}
			
            if (a_position==0) {
                errMsg = errMsg + "\nPosition";
            }
            
			if (!title) {
				//errMsg = errMsg + "\nTitle";
			}
			
            if (o_location==0) {
                errMsg = errMsg + "\nLocation";
            }
            
			if (!email) {
				errMsg = errMsg + "\nEmail";
			}
			
			if (!phone) {
				errMsg = errMsg + "\nPhone";
			}
			
			if ( (email.indexOf(".") > 2) && (email.indexOf("@") > 0) ) {
			} else {
				alert("Email doesn't appear to be valid.");
				return false;
			}
			
			if (errMsg != "") {
				errMsg = "The following fields are required:\n" + errMsg;
				alert (errMsg);
				return false;
			}
        break;
    }
}
