﻿function SRCheckModeItem(item) {
    var item1 = document.getElementById('CheckerItem1');
    var item2 = document.getElementById('CheckerItem2');
    var hf = document.getElementById('ModeCheckerHF');
    if (hf != null) {
        if (hf.value == item) { return; }
        hf.value = item;
        this.className = 'factCaptionSelected';
        if (item1 != null) {
            if (item == 1) {
                item1.className = 'factCaptionSelected';
                item1.style.textDecoration = '';
            }
            else {
                item1.className = 'factCaptionUnSelected';
            }
        }
        if (item2 != null) {
            if (item == 2) {
                item2.className = 'factCaptionSelected';
                item2.style.textDecoration = '';
            }
            else {
                item2.className = 'factCaptionUnSelected';
            }
        }
    }
    SR2OnCheckerChanged();
}

function SR2OnCheckerChanged() {
    var hf = document.getElementById('ModeCheckerHF');
    LoadScript("reporting/RenderGetGeorgiaTourismEconomicsImpactTableScript.ashx?params=" + hf.value);
}

function StateResultsRender(containerId) {
    var container = document.getElementById(containerId);
    var res = "";
    var js = "";
    res += "<input id=\"ModeCheckerHF\" type=\"hidden\" value=\"1\"/>";
    res += "<input id=\"ModeColumnHF\" type=\"hidden\" value=\"1\"/>";
    res += "<tr height=\"10px\">";
    res += "<td>";
    res += "</td>";
    res += "</tr>";
    res += "<tr height=\"30px\">";    
    res += "<td id=\"CheckerContainer\" align=\"center\">";
    res += "<input id=\"ModeCheckerHF\" type=\"hidden\" value=\"4\"/>";
    res += "<table style=\"border-collapse: collapse\">";
    res += "<tr>";
    res += "<td style=\"padding-right: 4px; border-right-style:solid; border-right-width:1px;\" align=\"center\">";
    js = "SRCheckModeItem(1);";
    res += "<div id=\"CheckerItem1\" style=\"padding:2px;\" class=\"factCaptionSelected\"  onmouseover=\"if(this.className == 'factCaptionUnSelected') {this.style.textDecoration = 'underline';}\" onmouseout=\"this.style.textDecoration = '';\" onclick=\"" + js + "\">";
    res += "2008";
    res += "</div>";
    res += "</td>";
    res += "<td style=\"padding-right: 4px;\" align=\"center\">";
    js = "SRCheckModeItem(2);";
    res += "<div id=\"CheckerItem2\" style=\"padding:2px;\" class=\"factCaptionUnSelected\"  onmouseover=\"if(this.className == 'factCaptionUnSelected') {this.style.textDecoration = 'underline';}\" onmouseout=\"this.style.textDecoration = '';\" onclick=\"" + js + "\">";
    res += "2007";
    res += "</div>";
    res += "</td>";
    res += "</tr>";
    res += "</table><br />";
    res += "</td>";
    res += "</tr>";

    var str = "";
    str += "<tr height=\"350px\">";    
    str += "<td valign=\"top\">";
    str += GetGeorgiaTourismEconomicsImpactTableHTML();
    str += "</td>";
    str += "</tr>";
    str += "</table>";

    str += "<table height=\"350px\"  width=\"700px\">";
    str += "<tr>";
    str += "<td id=\"StackedStolbicPlace\" >";
    str += "</td>";
    str += "</tr>";
    str += "</table>";

    container.innerHTML = res + str;

    LoadGetGeorgiaTourismEconomicsImpactTable();
}

function GetGeorgiaTourismEconomicsImpactTableHTML() {
    var str = "";
    str += "<table style=\"border-collapse:collapse;\">";
    str += "<tr>";
    str += "<td align=\"center\" style=\"background-color: #323232; color: #FFFFFF; font-weight:bold; font-size: 9pt; font-family: Verdana; padding:5px;\">";
    str += "<div style=\"font-size: 14pt;\">Georgia Tourism Economic Impact</div>";
    str += "</td>";
    str += "</tr>";
    str += "<tr>";
    str += "<td style=\"padding:0px;\" id=\"GeorgiaTourismEconomicsImpactTablePlace\">";
    str += "</td>";
    str += "</tr>";
    str += "</table>";
    return (str);
}

function LoadGetGeorgiaTourismEconomicsImpactTable(column) {
    var hf = document.getElementById('ModeCheckerHF');
    if (column == null)
        LoadScript('reporting/RenderGetGeorgiaTourismEconomicsImpactTableScript.ashx?column=1&params=' + hf.value);
    else
        LoadScript('reporting/RenderGetGeorgiaTourismEconomicsImpactTableScript.ashx?column=' + column + '&params=' + hf.value);                
}

function onColumnChecked(column) {
    LoadStackedDiagram(column);
    if (document.getElementById('ModeColumnHF').value != column) {
        LoadGetGeorgiaTourismEconomicsImpactTable(column);
        //alert(document.getElementById('ModeColumnHF').value);
        document.getElementById('ModeColumnHF').value = column;
    }
}

function LoadStackedDiagram(column) {
    var hf = document.getElementById('ModeCheckerHF');
    var StolbicChart = new FusionCharts("swf/StackedColumn2D.swf", "Pie", "100%", "350px", "0", "0");
    var link = 'Reporting/StackedDiagramXML.ashx?params=' + hf.value + column;
    StolbicChart.setDataURL(link);
    StolbicChart.render("StackedStolbicPlace");
}
