function getCookie(name) {
    var cookie = " " + document.cookie;
    var search = " " + name + "=";
    var setStr = null;
    var offset = 0;
    var end = 0;
    if (cookie.length > 0) {
        offset = cookie.indexOf(search);
        if (offset != -1) {
            offset += search.length;
            end = cookie.indexOf(";", offset)
            if (end == -1) {
                end = cookie.length;
            }
            setStr = unescape(cookie.substring(offset, end));
        }
    }
    return(setStr);
}

$(document).ready(function() {
    var temp = getCookie("visible_tab");
    $('div.selector ul li.tab a').click(function() {
        var visibleClass = $(this).attr('rel');
        
        $('div.t1, div.t2').hide();
        $('div.selector ul li.tab a').removeClass('actmenu');
        
        document.cookie = "visible_tab=" + visibleClass + "; path=/";
      
        $('div.' + visibleClass).show();
        $(this).addClass('actmenu');

        return false;
    });
    
    $('div.selector ul li.tab a[rel=' + temp + ']').click();
});


