﻿function OpenPopup(idPopup, url, popupW, popupH){
	window.open(url, idPopup, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=' + popupW + ',height=' + popupH + ',top=55,left=55');
}

function OpenPopupById(idPopup, url, popupW, popupH, id) {
    window.open(url + '?id=' + id, idPopup, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=' + popupW + ',height=' + popupH + ',top=55,left=55');
}

function OpenPopupRemenber(url)
{
    window.open(url,'ProductRemember','toolbar=no,status=no,menubar=no,scrollbars=no,resizeable=no,top=100,left=50,width=435,height=435');
}

function showImgZoom(src, width, height)
{
    setBoxWidth('divZoom', width + 6);
    setBoxHeight('divZoom', height + 26);
    
    setBoxWidth('divImgZoom', width);
    setBoxHeight('divImgZoom', height);
    
    setBoxWidth('divCloseZoom', width);
    
    writeInnerHtml('divImgZoom', '<img src="' + src + '" width="' + width + '" height="' + height + '" border="0">');
    show('divZoom');
}

function closeZoom()
{
    hide('divZoom');
}
function show(el)
{
    var obj = getElement(el);
    var css;
    
    if (obj == null)
        return;
    
    css = isDefined(obj.style);
    if (css && isDefined(obj.style.visibility))
    {
        obj.style.visibility = 'visible';
    }
    else if(css && isDefined(obj.style.display))
    {
        obj.style.display = 'block';
    }
}
function hide(el)
{
    var obj = getElement(el);
    var css;
    
    if (obj == null)
        return;
    
    css = isDefined(obj.style);
    if (css && isDefined(obj.style.visibility))
    {
        obj.style.visibility = 'hidden';
    }
    else if(css && isDefined(obj.style.display))
    {
        obj.style.display = 'none';
    }
}

function getElement(el)
{
    if(typeof(el)=='string')
    {
        if(document.getElementById)
            el = document.getElementById(el);
        else if(document.all)
            el = document.all[el];
        else 
            el = null;
    }
    return el;
}

function isDefined()
{
    for(var i = 0; i < arguments.length; i++)
    {
        if(typeof (arguments[i]) == 'undefined')
            return false;
    }
    return true;
}

function setBoxWidth(el, width)
{
    var obj = getElement(el);
    var css;
    
    if (obj == null)
        return;
    
    css = isDefined(obj.style);
    
    if(css && isDefined(obj.offsetWidth) && obj.style.width == 'string')
    {
        obj.style.width = width + 'px';
    }
    else if(css && isDefined(obj.style.pixelWidth))
    {
        obj.style.pixelWidth = width;
    }
    
}

function setBoxHeight(el, height)
{
    var obj = getElement(el);
    var css;
    
    if (obj == null)
        return;
    
    css = isDefined(obj.style);
    
    if(css && isDefined(obj.offsetHeight) && obj.style.height == 'string')
    {
        obj.style.height = height + 'px';
    }
    else if(css && isDefined(obj.style.pixelHeight))
    {
        obj.style.pixelHeight = height;
    }
}

function writeInnerHtml(el, content)
{
    var obj = getElement(el);
    var innerHtml;
    if (obj == null)
        return;
        
    innerHtml = isDefined(obj.innerHTML);
    if (innerHtml)
    {
        obj.innerHTML = content;
    }
}


