
var currentBrand = 0;
var rotateBrands = true;

$(document).ready(function() {

    // set initial appearance of brand tabs
    $("#titleTotal").hide();
    $("#titleCosIn").hide();
    $("#titleMyDep").hide();
    $("#contentCosIn").hide();
    $("#contentMyDep").hide();
    $("#tabsTotal").show();

    // handle click of Total Landlord tab
    $(".areatotal").click(function() {
        rotateBrands = false;
        fnTotalLandlordShow();
    });


    // handle click of Cosmetic tab
    $(".areacosmetic").click(function() {
        rotateBrands = false;
        fnCosmeticShow();
    });

    // handle click of my|deposits tab
    $(".areamydeposits").click(function() {
        rotateBrands = false;
        fnMyDepositsShow();
    });

    $("#contentTotal, #contentCosIn, #contentMyDep").click(function() {
        rotateBrands = false;
    });

    setTimeout("fnBrandsRotate()", 5000);
});


// handles rotation of brands
function fnBrandsRotate() {
    if (rotateBrands)
    {
        currentBrand = ((currentBrand+1) % 3);
        if (currentBrand == 0)
            fnTotalLandlordShow();
        else if(currentBrand == 1)
            fnCosmeticShow();
        else if(currentBrand == 2)
            fnMyDepositsShow();
        setTimeout("fnBrandsRotate()", 5000);
    }
}

function fnTotalLandlordShow() {
    $("#tabsCosIn").hide();
    $("#contentCosIn").hide();
    $("#tabsMyDep").hide();
    $("#contentMyDep").hide();
    $("#tabsTotal").show();
    $("#contentTotal").show();
}

function fnCosmeticShow() {
    $("#tabsMyDep").hide();
    $("#contentMyDep").hide();
    $("#tabsTotal").hide();
    $("#contentTotal").hide();
    $("#tabsCosIn").show();
    $("#contentCosIn").show();
}

function fnMyDepositsShow() {
    $("#tabsCosIn").hide();
    $("#contentCosIn").hide();
    $("#tabsTotal").hide();
    $("#contentTotal").hide();
    $("#tabsMyDep").show();
    $("#contentMyDep").show();
}
