﻿function showLightBox(ele){
    if(ele.css('display')=='none')
    {
    if(ele.children().length > 3){
    LockScreen(true);
    ele.css({"z-index":"99999","position":"absolute","top":($(window).scrollTop()+50)});
    ele.show('fast');
    return false;
    }
    }
    return true;
}
function LockScreen(tag)
{
    if (tag)
    {
    var lockdiv = document.getElementById("lockscreen");
    if (lockdiv!=null)
    {
    lockdiv.style.display = "block";
    }
    else
    {
    var tabframe= document.createElement("div");
    $(tabframe).attr({"id":"lockscreen","name":"lockscreen"});
    $(tabframe).css({"top":0,"left":0,"height":document.body.scrollHeight,"width":"100%","position":"absolute","background-color":"#999","z-index":"99998","opacity":"0.5"});
    document.body.appendChild(tabframe);
    tabframe.style.display = "block";
    //subdiv.onclick=UNLockScreen;
    }
    }
    else
    {
    var lockdiv = document.getElementById("lockscreen");
    if (lockdiv!=null)
    {
    lockdiv.style.display = "none";
    }
    }
}

function UNLockScreen()
{
    LockScreen(false);
}

function ClearUpsellProductList(){
    var UpsellList = document.getElementsByName('Upsell');				
    for (i=0; i<UpsellList.length; i++)
    {
        UpsellList[i].checked = false;
    }
    UpsellClick(null);
//    var UpsellProductList = document.getElementsByName('UpsellProducts');
//    for(j=0; j<UpsellProductList.length; j++)
//    {
//	    UpsellProductList[j].value = '';
//    }
}

function ContinueCart(pid){
    //alert('#AddToCartForm_'+pid.toString()+$('.upsellBox').attr('id').toString().replace('upsellBox','')+' .AddToCartButton');
    obj =  $('#AddToCartForm_'+pid.toString()+$('.upsellBox').attr('id').toString().replace('upsellBox','')+' .AddToCartButton');
    if(obj.length>0)
    {
    obj.click();
    }
}
