function resetForm(argForm){
    parent.countyframe.document.countyform.county.value = "";
    parent.countyframe.document.selectcountyform.selectcounty.options[0].selected=true;
 }
function setJobcatdesc(argForm, selecttext1, selectvalue1){
    if(selectvalue1.length < 1){
        argForm.jobcategorydesc.value = " ";
    }else{
        argForm.jobcategorydesc.value = selecttext1;
    }
}
function setFacname(argForm, selecttext2, selectvalue2){
    if(selectvalue2 < 1){
        argForm.facname.value = " ";
    }else{
        argForm.facname.value = selecttext2;
    }        
}
function checkForHtml(argField){
    var strVal = argField.value;
    if( strVal.search("<") >=0 || strVal.search(">") >=0 || strVal.search("%") >=0){
        alert("You cannot use HTML elements in your text!");
        argField.focus();
        return false;
    }
    return true;
}
function checkForNumber(argField){
    if( isNaN(argField.value)){
            alert("Please enter numeric data only!");	
            argField.focus();						
            return false; 
    }
    return true;
}
function checkForDate(argField){
    var strVal = argField.value;
    if(strVal.length > 0){
        if(strVal.length < 8 || strVal.length > 10 || strVal.search("/") < 0){
            alert("Please enter a valid Date!");
            argField.focus();
            return false;
        }
    }
    return true;
}
function checkForm(argForm){
    //validate fromDate
    if(!checkForDate(argForm.posting_date_from)){ return false; }
    if(!checkForHtml(argForm.posting_date_from)){ return false; }
    
    //validate toDate    
    if(!checkForDate(argForm.posting_date_to)){ return false; }    
    if(!checkForHtml(argForm.posting_date_to)){ return false; }

    //validate positionnum
    if(!checkForNumber(argForm.positionnum)){ return false; }
    if(!checkForHtml(argForm.positionnum)){ return false; }
    
    //validate jobcode
    if(!checkForNumber(argForm.jobcode)){ return false; }    
    if(!checkForHtml(argForm.jobcode)){ return false; }
    
    //validate jobtitle
    if(!checkForHtml(argForm.jobtitle)){ return false; }
    
    document.queryform.county.value = parent.countyframe.document.countyform.county.value;

    return true;
} 
