/*Candidate Class*/
function CandidateValidation()
{
    this.displayErrorMessage = false;
    this.validationSuccessful = true;
    this.validationMessage = "";
}

CandidateValidation.prototype.ValidateLocation = function(source)
{
    
    var sourcePath = source.id.substring(0,source.id.lastIndexOf("_"));
    var locations = this.GetThisFormControl(sourcePath,"lstLocation");
    if(locations.options.length<1)
    {
        this.validationSuccessful = false;
    }  
}
CandidateValidation.prototype.GetThisFormControl = function(sourcePath,control) 
{
    return document.getElementById(sourcePath + "_" + control);
}
/*****************************************************************/

function validateLocation(source,arguments)
{
    
    var candidate = new CandidateValidation();
    candidate.ValidateLocation(source);
    arguments.IsValid = candidate.validationSuccessful;
}

function verifyToMonthForEmployment(monthControl)
{    
    var sourcePath = monthControl.id.substring(0,monthControl.id.lastIndexOf("_"));  
      
    var toMonth = document.getElementById(sourcePath + "_ddDurationToMonth");
    var toYear = document.getElementById(sourcePath + "_ddDurationToYear");
    if("-2" == toMonth.value)
    {
        toYear.disabled = true;
        return;
    }
    toYear.disabled = false;
    return;
}
function verifyCurrentToMonthForEmployment(monthControl)
{    
    var sourcePath = monthControl.id.substring(0,monthControl.id.lastIndexOf("_"));  
      
    var toMonth = document.getElementById(sourcePath + "_ddlCurrentDurationToMonth");
    var toYear = document.getElementById(sourcePath + "_ddlCurrentDurationToYear");
    if("-2" == toMonth.value)
    {
        toYear.disabled = true;
        return;
    }
    toYear.disabled = false;
    return;
}
