﻿function startevaluation() {
    alert("test");
    window.location.href = "http://www.google.com";
}

function valueChange(sender, args) {

    var i = sender.get_value();
    for (var x = 0; x <= i; x++) {
        var y; 
        if (x > 0)
            y = x - 1; 
        else 
            y = x;
            
        var cookieName = "evalComplete_" + x;
        var previousCookie = "evalComplete_" + y;

        var cookieValue = get_cookie(cookieName);
        var previousCookieValue = get_cookie(previousCookie);
        var oldValue = args.get_oldValue();
        
        if (cookieValue == "incomplete") 
        {
            //alert("Sorry, but you must complete the preceding sections of the evaluation before proceeding.");
            sender.set_value(oldValue); 
            return;
        }
        else if (cookieValue == null) {
            alert(cookieName + " is null");
            //sender.set_value(oldValue); 
            return; 
        }
    }
    window.location = "Evaluation.aspx?index=" + i;


}

function clientSlideStart(sender, eventArgs) {
    alert('Value before the slide starts is: ' + sender.get_value());
}

function get_cookie(cookie_name) 
{
    var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');

    if (results)
        return (unescape(results[2]));
    else
        return null;
}

function goto_previous() {
    var qry = window.location.search;
    qry = qry.substring(1);
    var arrQry = qry.split('&');
    var i = arrQry[0].indexOf('=');
    var key1Val = arrQry[0].substring(i + 1);
    var index = parseInt(key1Val) - 1; 
    window.location = "Evaluation.aspx?index=" + index;
}

function getcertificate() {

    var evaluatorName = get_cookie("EvaluatorName");
    var location = "Coa.aspx?name=" + evaluatorName; 
    window.open (location, "mywindow","menubar=0,location=1,resizable=1,toolbar=0,width=600,height=600");
}

