var running = true;
var bShadow = false;
if (!window.jsUtils)
{
        setTimeout(function(){
                var oSript = document.body.appendChild(document.createElement('script'));
                oSript.src = '/bitrix/js/main/utils.js';
                if (document.attachEvent && navigator.userAgent.toLowerCase().indexOf('opera') == -1)
                        oSript.onreadystatechange = function(){if (oSript.readyState == 'loaded'){Aload_css();}};
                else
                        oSript.onload = function(){setTimeout(Aload_css, 50);};
        }, 50);
}
else
{
        Aload_css();
}

function Aload_css()
{
        if (!window.AkStyles)
                window.AkStyles = jsUtils.loadCSSFile(['/bitrix/themes/.default/pubstyles.css']);
}

function ALocalWindow()
{
        var _this = this;
        //this.div_id = 'ALX_DEBUG_INFO';
        this.div_current = null;
        this.div_detail_current = null;

        this.Show = function(divId)
        {
                var div = document.getElementById(divId);
                if(div)
                {
                        div.style.display = 'block';
                        var left = parseInt(document.body.scrollLeft + document.body.clientWidth/2 - div.offsetWidth/2);
                        var top = parseInt(document.body.scrollTop + document.body.clientHeight/2 - div.offsetHeight/2);

                        var windowSize = jsUtils.GetWindowSize();

                        var left = parseInt(windowSize["scrollLeft"] + windowSize["innerWidth"]/2 - div.offsetWidth/2);
                        var top = parseInt(windowSize["scrollTop"] + windowSize["innerHeight"]/2 - div.offsetHeight/2);

                        jsFloatDiv.Show(div, left, top);
                        jsUtils.addEvent(document, "keypress", this.OnKeyPress);
                }
        }

        this.Close = function(divId)
        {
                jsUtils.removeEvent(document, "keypress", this.OnKeyPress);
                var div = document.getElementById(divId);
                jsFloatDiv.Close(div);
                div.style.display = 'none';
        }

        this.OnKeyPress = function(e)
        {
                if(!e) e = window.event
                if(!e) return;
                if(e.keyCode == 27)
                        _this.Close();
        }

}
function ALX_ShowWindow(divId,image,content,but1,but2,href,height,id,qua)
{
        html = "";
        add2basket(id,'ADD2BASKET','N',qua);
        html += '<div class="bx-debug-title">';
        html += '<table cellspacing="0" style="width:100% !important;">';
        html += '        <tr>';
        html += '                <td class="bx-debug-title-text" onmousedown="jsFloatDiv.StartDrag(arguments[0], document.getElementById(\''+divId+'\'));">www.vodaplus.ru</td>';
        html += '                <td width="0%"><a class="bx-debug-close" href="javascript:jsWindow.Close(\''+divId+'\');" title="Закрыть"></a></td>';
        html += '        </tr>';
        html += '</table>';
        html += '</div>';
        html += '<div style="display:block;">';
        html += '        <div class="bx-debug-content" style="height:'+height+'px; overflow:auto;">';
        if (image.length>0)
             html += '<div style="float:left; margin-right: 30px;"><img src="'+image+'" border=0 width="50"></div>';
        html += content;
        //html += '<small>Чтобы просмотреть Корзину перейдите по ссылке &laquo;<a href="http://www.vodaplus.ru/personal/basket.php">Ваша Корзина</a>&raquo;</small>';
        html += '<h2 class="text_basket_add">Этот товар добавлен в вашу Корзину</h2>';
        html += '<span>Оформите быстрый заказ, всего в 1 клик через &laquo;<a href="http://www.vodaplus.ru/personal/basket.php">Корзину</a>&raquo; и  получите скидку!</span>';

        html += '        </div>';

        if(but1.length>0 || but2.length>0)
        {
                html += '<div class="bx-debug-buttons">';
                html += '<form action="'+href+'" method="POST">';
                if(but1.length>0)
                        html += '<input type="button"  onclick="location.href=\'/personal/basket.php\'" value="Перейти в корзину">';
                if(but2.length>0)
                        html += '&nbsp;<input type="button" value="Продолжить покупки" onclick="jsWindow.Close(\''+divId+'\');">';
                html += '&nbsp;<input type="button" value="Отменить добавление" onclick="add2basket(\''+id+'\',\'DELETE\',\'N\',\''+qua+'\');jsWindow.Close(\''+divId+'\');">';
                html += '</form>';
                html += '</div>';
        }
        html += '</div>';
        document.getElementById(divId).innerHTML = html;
        jsWindow.Show(divId);
}
var jsWindow = new ALocalWindow();
