var CartWnd = {
    Req         : null,
    SizeSet     : false,

    Send : function()
    {
        var t = this;

        if(window.XMLHttpRequest){
            t.Req = new XMLHttpRequest();
        }
        else if(window.ActiveXObject){
            t.Req = new ActiveXObject('Msxml2.XMLHTTP');
            if(!t.Req){
                t.Req = new ActiveXObject('Microsoft.XMLHTTP');
            }
        }

        t.Req.onreadystatechange = CartWnd.Receive;
        t.Req.open("GET", "cart.php", true);
        t.Req.send(null);
    },

    Receive : function()
    {
        if(CartWnd.Req.readyState == 4){
            if(CartWnd.Req.status == 200){
                try {
                    var rXML = CartWnd.Req.responseXML;
                    var Name = rXML.documentElement.nodeName;
                    var List, Val, Obj;
                }
                catch(e){ return; }
/*
                if(Name == 'response'){
                    // HTML data processing
                    List = rXML.getElementsByTagName('html');
                    if(List.length > 0){
                        for(i = 0; i < List.length; i++){
                            Val = List[i].childNodes[0].nodeValue;
                            if(Ajax.ResultIDs[i]){
                                Obj = document.getElementById(Ajax.ResultIDs[i]);
                                if(Obj.tagName == "INPUT") Obj.value = Val;
                                else Obj.innerHTML = Val;
                            }
                        }
                    }
                   Ajax.SetWndPos();
                }
*/
            }
        }
    },

    Show : function(url)
    {
        var Div = document.getElementById('PopupCartContainer');
        if(!Div){
            Div                  = document.createElement('div');
            Div.id               = 'PopupCartContainer';
            Div.style.position   = 'absolute';
            Div.style.left       = '0px';
            Div.style.top        = '0px';
            Div.style.width      = '100%';
            Div.style.height     = '1500px';
            Div.style.visibility = 'hidden';
            document.body.appendChild(Div);
        }

        Div.innerHTML  = '<div id="PopupBG" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; opacity: .40; filter: alpha(opacity = 40); z-index: 6; background: #000000;"></div>'+
                         '<div id="PopupWD" style="position: absolute; z-index: 10; width: 100%; align="center">'+
                         '<table id="PopupCartWnd" cellspacing="0" cellpadding="0" align="center" style="width: 459px; background: #ECECEC;">'+
                         '<tr>'+
                           '<td style="background: url(/images/cart_head.gif) no-repeat 0% 0%; height: 42px;" align="right">'+
                             '<div style="width: 20px; height: 24px; cursor: pointer; font: 20px Arial; color: #FFFFFF; text-align: left;" onclick="o = document.getElementById(\'PopupCartContainer\'); o.innerHTML = \'\'; o.style.zindex = \'-100\'; o.style.visibility = \'hidden\';">X</div>'+
                           '</td>'+
                         '</tr>'+
                         '<tr><td valign="top">'+
                           '<iframe src="'+ url +'" width="459" height="280" frameborder="no" style="width: 459px; border: none;"></iframe>'+
                         '</td></tr>'+
                         '</table>'+
                         '</div>';
        var Tbl = document.getElementById('PopupCartWnd');
        var Top = Math.ceil((document.body.clientHeight - Tbl.clientHeight) / 8);
        Tbl.style.margin     = "180" +"px auto 0px auto"; //((Top < 0) ? '0' : Top)
        Div.style.left       = "0px";
        Div.style.top        = "0px";
        Div.style.zindex     = 5;
        Div.style.visibility = "visible";

        this.SizeSet = false;
        this.Send();
    }
};
