﻿function ShowQuickBuy(tagShow){
    document.getElementById(tagShow).style.visibility = "visible";
}
function HideQuickBuy(tagShow){
    document.getElementById(tagShow).style.visibility = "hidden";
}
function ShowProductDesc(tagShow)
{
    document.getElementById(tagShow).style.display = "block";
}
function HideProductDesc(tagShow)
{
    document.getElementById(tagShow).style.display = "none";
}
function QuickBuy(strProductUrl) {   
    dvIframe = document.getElementById("dvItem");
    dvBackgroundLayer = document.getElementById("dvBackground");    

    var iWidth = parseInt(dvIframe.style.width.replace("px", ""));
    var p ="px";
    var iHeight = parseInt(dvIframe.style.height.replace("px", ""));          
    var vScrollTop =getScrollingPosition();

    var top =  parseInt((screen.availHeight- (iHeight+200))/2) + vScrollTop;        
    var left = parseInt((window.screen.width - iWidth)/2);

    dvIframe.style.top = top+p;
    dvIframe.style.left = left+p;

    dvBackgroundLayer.style.height=mbox_pageHeight()+p;
    dvBackgroundLayer.style.width=mbox_pageWidth()+p;
    dvBackgroundLayer.style.top= mbox_posTop()+p;
    dvBackgroundLayer.style.left=mbox_posLeft()+p;  

    window.onscroll = function () {
        var vScrollTop =getScrollingPosition();
        dvBackgroundLayer.style.width = document.body.clientWidth+p;
        dvBackgroundLayer.style.height = document.body.clientHeight+p;
        dvBackgroundLayer.style.top = document.body.scrollTop+p;
        dvBackgroundLayer.style.left = document.body.scrollLeft+p;
        dvIframe.style.top = (parseInt((screen.availHeight- (iHeight+200))/2) + vScrollTop) +p;
    }

    window.onresize = function () {
        dvBackgroundLayer.style.width = document.body.clientWidth+p;
        dvBackgroundLayer.style.height = document.body.clientHeight+p;
    }

    dvBackgroundLayer.style.display = 'block';

    //Center window.
    dvIframe.src = strProductUrl; 

    setTimeout("dvIframe.style.display = 'block'", 50);      
}      

function getScrollingPosition(){
    var vScrollTop ;
    if (typeof window.pageYOffset != 'undefined')
    {
        vScrollTop =    window.pageYOffset;
    }
    else if (typeof document.documentElement.scrollTop!= 'undefined' && document.documentElement.scrollTop > 0)
    {
       vScrollTop =   document.documentElement.scrollTop;
    }
    else if (typeof document.body.scrollTop != 'undefined')
    {
        vScrollTop =document.body.scrollTop;
    }
    return vScrollTop;
}
function QuickBuyHide(){     
    dvIframe = document.getElementById("dvItem");
    dvBackgroundLayer = document.getElementById("dvBackground");
    
    dvIframe.style.display = 'none';
    dvIframe.src = publicSiteUrl + "/blank.htm";
    dvBackgroundLayer.style.display = 'none';
}
function ShowBundleList(objBundleList) {
    var pnl = document.getElementById(objBundleList);
    pnl.style.display = 'block';
    pnl.style.visibility = 'visible';
}
function HideBundleList(objBundleList) {
    var pnl = document.getElementById(objBundleList);
    pnl.style.display = 'none';
    pnl.style.visibility = 'hidden';
}
function GetWishlistTop(srcObjId) {
    var srcObj = document.getElementById(srcObjId);
    if (srcObj != null) {
        var objTop = srcObj.offsetTop;
        var objParent = srcObj.offsetParent;
        while (objParent != null && objParent.tagName.toUpperCase() != "BODY") {
            objTop += objParent.offsetTop;
            objParent = objParent.offsetParent;
        }
        return (objTop - 200) + "px";
    }
    else
        return "40%";
}
