function update_table(contract1, contract2)
{
    $(".abstract_tables").hide();
    $("#abstract_" + contract1).show();
    $("#abstract_" + contract2).show();
}

function update_chart(url) {
    flashvars["xmlURL"] = url;

    
    swfobject.embedSWF ( "/webroot/TGE_abstract.swf",
                         "flashcontent",
                         "100",
                         "100",
                         "10.0.0",
                         "expressInstall.swf",
                         flashvars,
                         params,
                         attributes
                         );

    }
    
function cycle_table_data(tables) {
    var len = tables.length;
    var i = 0;
    update_table(tables[++i % len], tables[++i % len]);
    setInterval(function () {
        update_table(tables[++i % len], tables[++i % len]);
        }, 4000);
    
}
function cycle_chart_data(locations) {
    var len = locations.length;
    var i = 0;
    setInterval(function () {
        update_chart(locations[++i % len]);
        }, 4000);
}

$(function () {

    var tooltip = $(".tooltip")
    if (tooltip.length > 0) {
        tooltip.simpletooltip(); 
        }

    if(typeof locations != 'undefined') {
        cycle_chart_data(locations);
    }

    if(typeof tables != 'undefined') {
        cycle_table_data(tables);
    }
})

