function CanContentServicesDown(strVE_System){
	if(strVE_System == "DOWN"){
		document.getElementById("btnCandidateSubmit").disabled = true;
		alert("We are sorry for the inconvenience, but the site is down for maintenance. You will be unable to Search. Please try back later.");	
		var strContentText = document.getElementById("tdbottomcontent").innerHTML;
	
		strContentText = "<p>We are sorry for the inconvenience, but the site is down for maintenance. You will be unable to Search. Please try again later.</p>";
	}
}

function ComContentServicesDown(strVE_System){
	if(strVE_System == "DOWN"){
		document.getElementById("btnCommitteeSubmit").disabled = true;
		alert("We are sorry for the inconvenience, but the site is down for maintenance. You will be unable to Search. Please try back later.");	
		var strContentText = document.getElementById("tdbottomcontent").innerHTML;
	
		strContentText = "<p>We are sorry for the inconvenience, but the site is down for maintenance. You will be unable to Search. Please try again later.</p>";
	}
}

function ContentServicesDown(strVE_System){
	if(strVE_System == "DOWN"){
		alert("We are sorry for the inconvenience, but the site is down for maintenance. You will be unable to Search. Please try back later.");	
		var strContentText = document.getElementById("tdbottomcontent").innerHTML;
	
		strContentText = "<p>We are sorry for the inconvenience, but the site is down for maintenance. You will be unable to Search. Please try again later.</p>";
	}
}

function validate_null2(field){
    with (field){
        if (value == null | value == ""){
            return true;
        }else{
            return false;
        }
    }
}

function validate_CandidateSearch(){
    with (document.frmCandidateSearch){
        var isNull = true;
        if (validate_null2(selCandidateType) == false){
            isNull = false;
        }//Candidate Type
        
        if (validate_null2(txtCandidateFirstName) == false){
            isNull = false;
        }//Candidate First Name
        
        if (validate_null2(txtCandidateLastName) == false){
            isNull = false;
        }//Candidate Last Name
        
        if (validate_null2(selCounty) == false){
            isNull = false;
        }//County
        
        if (validate_null2(selOfficeTitle) == false){
            isNull = false;
        }//Office Title
        
        if (validate_null2(selDocumentType) == false){
            isNull = false;
        }//Doc Type
        
        if (validate_null2(selElectionYear) == false){
            isNull = false;
        }//Election Year
        
        if(isNull == true){
            alert("You must enter at least one field to Search.");
            return false;
            selCandidateType.focus();
        }        
    }
}


function validate_CommitteeSearch(){
    with (document.frmCommitteeSearch){
        var isNull = true;
        
        var blnCommitteeTypeSelected = false;
        
        var blnSubTypeSelected = false;
        
        var blnCountySelected = false;
        
        var blnElectionYearSelected = false;
        
        if (validate_null2(selCommitteeType) == false){
            isNull = false;
			blnCommitteeTypeSelected = true;
		}//Committee Type
		
        if (validate_null2(txtCommitteeName) == false){
            isNull = false;
        }//Committee Name
        
        if (validate_null2(selCommitteeDocType) == false){
            isNull = false;
        }//Committee Document Type
        
        if (validate_null2(selSubType) == false){
            isNull = false;
            blnSubTypeSelected = true;
        }//Sub Type
        
        if (validate_null2(selCommitteeCounty) == false){
            isNull = false;
            blnCountySelected = true;
        }//Committee County
        
        if (validate_null2(selCommitteeElectionYear) == false){
            isNull = false;
            blnElectionYearSelected = true;
        }//Election Year
        
        if(isNull == true){
            alert("You must enter at least one field to Search.");
            return false;
            txtCommitteeName.focus();
        }
        
        if (blnCommitteeTypeSelected == true){
        
            var selComType = document.getElementById("selCommitteeType");
            var selComTypeValue = selComType.options[selComType.selectedIndex].value;
            var strError = "Please select ";
            var intNumber = 0;
            
            if (selComTypeValue == "Ballot Issue" | selComTypeValue == "Incidental"){
            
				if(blnSubTypeSelected == false && blnCountySelected == false && blnElectionYearSelected == false){
					alert("Please select a Sub Type, a County, and a Year.");
					return false;
				}else{
				
					if(blnSubTypeSelected == false){
						intNumber++;
						strError = strError + "a Sub Type";
					}
					
					if(blnCountySelected == false){
						
						if(intNumber == 1){
							
							strError = strError + " and a County";
						}else{
							if(checkStateWide() == false){
								intNumber++;
								strError = strError + "a County";
							}
						}
						
					}
					
					if(blnElectionYearSelected == false){
						if(intNumber == 1){
							if(checkStateWide() == false){
								strError = strError + " and a Year";
							}else{
								strError = strError + "a Year";
							}
						}else{
							strError = strError + "a Year";
						}
						intNumber++;
					}
					
					if(intNumber != 0)
					{
						strError = strError + ".";
						alert(strError);
						return false;
					}
					
					
				
				}//End false/false/false boolean check
				
				
				
			}
			
        }
        
        
                                
    }
}

function checkComType(){
	var selComType = document.getElementById("selCommitteeType");
	
	var txtRequired = document.getElementById("required");
	var selSubType = document.getElementById("selSubType");
	var selCounty = document.getElementById("selCommitteeCounty");
	var selElectionYear = document.getElementById("selCommitteeElectionYear");
	
	var tdSubType = document.getElementById("tdSubType");
	var tdCounty = document.getElementById("tdCounty");
	var tdElectionYear = document.getElementById("tdElectionYear");
	
	var selComTypeValue = selComType.options[selComType.selectedIndex].value;
	var selSubTypeValue = selSubType.options[selSubType.selectedIndex].value;
	
	
	if (selComTypeValue == "Ballot Issue" | selComTypeValue == "Incidental"){

			if(selSubTypeValue == "Statewide"){
					selCounty.style.background="#ffffff";
					tdCounty.innerHTML = "County";
			}else{
					selCounty.style.background="#e0f5ff";
					tdCounty.innerHTML = "*County";
			}
		selSubType.style.background='#e0f5ff';
		selElectionYear.style.background='#e0f5ff';
		txtRequired.innerHTML = "* - Indicates the field is required.";
		tdSubType.innerHTML = "*Sub Type";
		

		
		tdElectionYear.innerHTML = "*Election Year";
		
	}else{
	
		selSubType.style.background='#ffffff';
		selCounty.style.background='#ffffff';
		selElectionYear.style.background='#ffffff';
		
		tdSubType.innerHTML = "Sub Type";
		tdCounty.innerHTML = "County";
		tdElectionYear.innerHTML = "Election Year";
		txtRequired.innerHTML = "";
	}
}

function checkStateWide(){
	var selComType = document.getElementById("selCommitteeType");
	var selSubType = document.getElementById("selSubType");
	var selCounty = document.getElementById("selCommitteeCounty");
	var txtRequired = document.getElementById("required");
	var tdCounty = document.getElementById("tdCounty");
	
	var selSubTypeValue = selSubType.options[selSubType.selectedIndex].value;
	var selComTypeValue = selComType.options[selComType.selectedIndex].value;
	
	if(selSubTypeValue == "Statewide"){
			if(selComTypeValue == "Ballot Issue" | selComTypeValue == "Incidental"){
				selCounty.style.background="#ffffff";
				tdCounty.innerHTML = "County";
				return true;
			}
	}else{
		if(selComTypeValue == "Ballot Issue" | selComTypeValue == "Incidental"){
			selCounty.style.background="#e0f5ff";
			tdCounty.innerHTML = "*County";
			txtRequired.innerHTML = "* - Indicates the field is required.";
			
			return false;
		}else{
			selCounty.style.background="#ffffff";
			tdCounty.innerHTML = "County";
			txtRequired.innerHTML = "";
			return true;
		}
	}
	
}

