
    // Slider used for the Bulk Order Pad
    function simpleslide()
    {
    
        var div_orderpad = document.getElementById("orderpad");
        var div_orderpad_container = document.getElementById("orderpad_container");
        
        if(div_orderpad!=null)
        {
            if(div_orderpad.style.display=="block")
            {
                //div_orderpad.style.display="none";
                //slide up
                new VerticalSlide('orderpad');
            }
            else {
                new VerticalSlide('orderpad');
                //get data and slide down
                //getorderpad();
                //new VerticalSlide('orderpad')
            }
        }
    }



// Below are functions for the actual AJAX cart


function createXMLHttpRequest() {
        try { return new XMLHttpRequest(); } catch(e) {}
        try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
        try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
        alert("XMLHttpRequest not supported");
        return null;
    }
    
    var requestTimer;
    var xhReq;
    var MAXIMUM_WAITING_TIME = 3000;
    var TimerId = 0;
    
    function getMinicart()
    {
        xhReq = createXMLHttpRequest();
        xhReq.open("GET", "/restarting.htm?r1=" + Math.floor(Math.random() * 10001) + "&r2=" + Math.floor(Math.random() * 10001), true);
        requestTimer = setTimeout(function() {
            xhReq.abort();
            alert("Timeout occured.");
        }, MAXIMUM_WAITING_TIME);

        xhReq.onreadystatechange = onResponse;
        xhReq.send(null);
    }
    
    function onResponse() 
    {
        if (xhReq.readyState != 4)  { return; }
        clearTimeout(requestTimer);
        
        if (xhReq.status != 200)  {
            alert("Error occured.");
            return;
        }

        var serverResponse = xhReq.responseText;
        var div_minicart_container = document.getElementById("minicart_container");
                
        if(div_minicart_container!=null)
        {
            div_minicart_container.innerHTML = serverResponse;
            //slide down
            new VerticalSlide('minicart');
        }
    }
    
    function swapMinicart()
    {
    
        var div_minicart = document.getElementById("minicart");
        var div_minicart_container = document.getElementById("minicart_container");
        
        if(div_minicart!=null)
        {
            if(div_minicart.style.display=="block")
            {
                //div_minicart.style.display="none";
                //slide up
                new VerticalSlide('minicart');
            }
            else {
                new VerticalSlide('minicart');
                //get data and slide down
                //getMinicart();
                //new VerticalSlide('minicart')
            }
        }
    }
    
    function hideAfter(time)
    {
        clearTimeout(TimerId);
        TimerId = setTimeout ( "swapMinicart()", 10000 );
    }




