function tabClick(id) {
    clearAll();
    if(typeof id!='string') id=this.id;
    document.getElementById(id).className = "current";
    document.getElementById(id).blur();
    var i = id.split("_")[1];
    document.getElementById(arrTabTargets[i]).className = "";
}
function clearAll() {
    for (i=0; i<arrTabNames.length; i++) {
        document.getElementById("tabid_" + i).className = "";
        document.getElementById(arrTabTargets[i]).className = "hidden";
    }
}
function drawTabs() {
    for (i=0; i<arrTabNames.length; i++) {
        document.write('<li id="tabid_' + i + '"><span class="hrefClone">' + arrTabNames[i] + '</span></li>');
    }

    for (i=0; i<arrTabNames.length; i++) {
        document.getElementById("tabid_" + i).onclick = tabClick;
    }
    document.getElementById("tabid_0").className = "current";
    document.getElementById("tabid_0").style.cssText = "position:relative;";
}
function checkHash() {
    h = document.location.hash;
    if(h){
        hlist = h.split("_");
        // eg #service_02 should be i=2
        // but #career_02 should be i=1
        i = parseInt(hlist[1]);
        if(hlist[1]=='#career') i++;
        if(i)
            document.getElementById("tabid_"+i).onclick();
        if(hlist.length>2)
            document.location.hash = '#'+hlist[2];
    }
}
