function hideshow(which) {
    var oWhich = getElement(which);
    var state = getElement(which + '_State');
    window.focus();
    if (oWhich.style.display == "none") {
        state.value = "True";
        oWhich.style.display = (sessvars.navigatorType == MSIE && sessvars.navigatorVersion < 7) ? "block" : "inline";
    }
    else {
        state.value = "False";
        oWhich.style.display = "none";
    }
}
function waitOnClick(e) {
    sessvars.showExitDialog = false;
    var ph = getElement("waitMessage");
    if (ph != null)
        ph.style.display = (sessvars.navigatorType == MSIE && sessvars.navigatorVersion < 7) ? "block" : "inline";
    var command;
    if(sessvars.navigatorType==MSIE){
        command=getCommand(window.event);
        window.event.returnValue = false;
    }else{
        command=getCommand(e);
        e.preventDefault();
    }
    eval(command);
}
function waitOnClickConfirm(e) {
    sessvars.showExitDialog = false;
    var button = (sessvars.navigatorType==MSIE) ? event.srcElement : e.target;
    if (show_confirmation("confirmation_placeorder")) {
        var ph = getElement("waitMessage");
        if (ph == null)
            ph.style.display = (sessvars.navigatorType == MSIE && sessvars.navigatorVersion < 7) ? "block" : "inline";
        var command;
        if(sessvars.navigatorType==MSIE){
            command=getCommand(window.event);
            window.event.returnValue = false;
        }else{
            command=getCommand(e);
            e.preventDefault();
        }
        if (button.id == 'buttonConfirm'){
            sessvars.ordersCount = null;
            setOrdersCount();
            eval(command);
            classifyVisitors("ConfirmAll");
        }else{
            getElement('PaymentCommand').value = 'pay';
            sessvars.ordersCount = null;
            setOrdersCount();
            eval(command);
            classifyVisitors("PayedAndConfirmAll");
        }
    }else{
        if (button.id == 'buttonConfirm')
            getElement('PaymentCommand').value = 'cancel';
    }
}
function waitOnClickConfirmExtra(e) {
    sessvars.showExitDialog = false;
    var button = (sessvars.navigatorType==MSIE) ? event.srcElement : e.target;
    if (show_confirmation("confirmation_placeorder_retail")) {
        var ph = getElement("waitMessage");
        if (ph == null)
            ph.style.display = (sessvars.navigatorType == MSIE && sessvars.navigatorVersion < 7) ? "block" : "inline";
        var command;
        if(sessvars.navigatorType==MSIE){
            command=getCommand(window.event);
            window.event.returnValue = false;
        }else{
            command=getCommand(e);
            e.preventDefault();
        }
        if (button.id == 'buttonConfirm'){
            sessvars.ordersCount = null;
            setOrdersCount();
            eval(command);
            classifyVisitors("ConfirmAll");
        }else{
            getElement('PaymentCommand').value = 'pay'
            sessvars.ordersCount = null;
            setOrdersCount();
            eval(command);
            classifyVisitors("PayedAndConfirmAll");
        }
    }else{
        if (button.id == 'buttonConfirm')
            getElement('PaymentCommand').value = 'cancel';
    }
}
function waitOnClickCancel(e) {
    sessvars.showExitDialog = false;
    if (show_confirmation("confirmation_cancelorder")) {
        var ph = getElement("waitMessage");
        if (ph == null)
            return;
        ph.style.display = (sessvars.navigatorType == MSIE && sessvars.navigatorVersion < 7) ? "block" : "inline";
        var command;
        if(sessvars.navigatorType==MSIE){
            command=getCommand(window.event);
            window.event.returnValue = false;
        }else{
            command=getCommand(e);
            e.preventDefault();
        }
        eval(command);
        sessvars.ordersCount = null;
        setOrdersCount();
    }
}
function getCommand(e){
    var element = (sessvars.navigatorType==MSIE) ? e.srcElement : e.target;
    return element.href;
}