﻿function switchChart()
{
    var val = parseInt(document.getElementById("selectGage").value);
    switch (val)
    {
        case 1:
            document["flowChart"].src = "/images/charts/08167700_00062.jpg";
            break;
        case 2: 
            document["flowChart"].src = "/images/charts/08167800_00060.jpg";
            break;
        case 3: 
            document["flowChart"].src = "/images/charts/08169000_00060.jpg";
            break;
        case 4: 
            document["flowChart"].src = "/images/charts/08170500_00060.jpg";
            break;
        case 5: 
            document["flowChart"].src = "/images/charts/08169792_00060.jpg";
            break;
        case 6: 
            document["flowChart"].src = "/images/charts/08173900_00060.jpg";
            break;
        case 7: 
            document["flowChart"].src = "/images/charts/08175800_00060.jpg";
            break;
        case 8: 
            document["flowChart"].src = "/images/charts/08176500_00060.jpg";
            break;
        case 9: 
            document["flowChart"].src = "/images/charts/08177400_00062.jpg";
            break;
        case 10: 
            document["flowChart"].src = "/images/charts/08188800_00060.jpg";
            break;
        default:
            document["flowChart"].src = "/images/charts/08167700_00062.jpg";
    }
}

function getFileName(path) 
{
    var filename = path.match(/[-_\w]+[.][\w]+[#\w]*$/i)[0];
    return filename.substr(0, filename.lastIndexOf('.')) || filename;
}

function switchChartAjax()
{
    $.ajax({
        type: "POST",
        url: "Chart.aspx/GetChart",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "",
        success: function(msg) 
        {
            alert('success');
            // Replace the div's content with the page method's return.
            //alert(msg.d);
        },
        error: function(req, status, err)
        {
            alert(req.statusText);
        }
    });
}
    
$(document).ready(function() 
{
    var elem = document.getElementById("selectGage");
    if (elem != null)
    {
        elem.selectedIndex = 0;
    }
    // Add the page method call as an onclick handler for the div.
//    $("#Result").click(function() 
//    {
//        $.ajax({
//            type: "POST",
//            url: "Default.aspx/GetCurrentDate",
//            data: "{}",
//            contentType: "application/json; charset=utf-8",
//            dataType: "json",
//            success: function(msg) 
//            {alert('hi');
//                // Replace the div's content with the page method's return.
//                $("#Result").text(msg.d);
//            }
//        });
//    });
});

