var hideC=null;
var showC=null;
var holdC=null;
var holdHide=false;
var holdShow=false;
var Delay=300;

function showCart(flag) {
    if (holdC) clearTimeout(holdC);

    if (!holdHide) {
        if (showC) clearTimeout(showC);
        showC=setTimeout("$('mini-cart').addClassName('showCart')", Delay);
    }

    if (flag) {
        hideC=setTimeout("$('mini-cart').removeClassName('showCart')", 5000);
    }
}

function hideCart() {
    if (showC) clearTimeout(showC);

    if (holdHide) {
        if (holdC) clearTimeout(holdC);
        holdC=setTimeout("clearHold()", Delay);
    }

    if (!holdShow) {
        if (hideC) clearTimeout(hideC);
        hideC=setTimeout("$('mini-cart').removeClassName('showCart')", Delay);
    }
}

function toogleCart() {
    if (!holdShow) {
        holdHide = false;
        holdShow = true;
        $('mini-cart').addClassName('showCart');
    } else {
        holdHide = true;
        holdShow = false;
        $('mini-cart').removeClassName('showCart');
    }
}

function clearHold() {
    holdHide = false;
}

function holdCart(flag) {
    if (flag) {
        if (hideC) clearTimeout(hideC);
        if (showC) clearTimeout(showC);
        if (holdC) clearTimeout(holdC);
        holdHide = false;
        holdShow = true;
    } else {
        holdHide = true;
        holdShow = false;
    }
}



function toggleSubMenu(el, over)
{
    if (Element.childElements(el)) {
    var uL = Element.childElements(el)[1];
    var iS = true;
    }
    if (over) {
        Element.addClassName(el, 'over');
    }
    else {
        //  setTimeout(function(){
            Element.removeClassName(el, 'over');
        //}, 1000); 
    }
}