var tabdata = new Array();
var _tab;
var _loc;
function doTab(tab,loc) {

    var obj = $(tab+'_'+loc);
    if (Element.hasClassName(obj, tab+'_active')) return;

    setCookie(tab+'_loc', loc);
    _tab = tab+'_c'; _loc = loc;
    tabdata[_loc] ? $(_tab).innerHTML = tabdata[_loc] : new Ajax.Request('tab/'+loc+'.shtml', {method: 'get', onSuccess:doTab_r});

    var nodes = $A(document.getElementsByClassName(tab+'_active'));
    nodes.each(function(node){
        Element.removeClassName(node, tab+'_active');
        Element.addClassName(node, tab+'_unactive');
    });
    var obj = $(tab+'_'+loc);
    if (obj) {
        Element.removeClassName(obj, tab+'_unactive');
        Element.addClassName(obj, tab+'_active');
    }
}
function doTab_r(t) {
    tabdata[_loc] = $(_tab).innerHTML = t.responseText;
}