var lastBoxId = null;

function toggleBox(boxId, state)
{
    var obj = document.layers ? document.layers[boxId] : document.getElementById ? document.getElementById(boxId).style : document.all[boxId].style;
    obj.visibility = document.layers ? (state ? "show" : "hide") : (state ? "visible" : "hidden");
    return false;
}

function show(boxId)
{
    if (lastBoxId != null) { toggleBox(lastBoxId, false); }
    lastBoxId = boxId;
    return toggleBox(boxId, true);
}

function inc(name)
{
    var qty = parseInt(document.product[name].value, 10);
    if (isNaN(qty)) { qty = 1; }
    else { qty++; }
    if (qty < 1) { qty = 1; }
    //if (qty > 11) { qty = 10; }
    document.product[name].value = qty;
    return false;
}

function dec(name)
{
    var qty = parseInt(document.product[name].value, 10);
    if (!isNaN(qty) && qty > 1) { qty--; } else { qty = ""; }
    if (qty < 1) { qty = ""; }
    //if (qty > 10) { qty = 10; }
    document.product[name].value = qty;
    return false;
}

var PopUpWindow;

function openPopUpWindow(Url, Width, Height, Scrollbars)
{

   var DefaultHeight = 670;
   var DefaultWidth = 600;
   var DefaultScrollbars = "yes";

   if (Height == null) { Height = DefaultHeight; }
   if (Width == null) { Width = DefaultWidth; }
   if (Scrollbars == null) { Scrollbars = DefaultScrollbars; }

   if (PopUpWindow && !PopUpWindow.closed) { PopUpWindow.document.location.href = Url; }
   else
   {
      PopUpWindow = window.open(Url, "PopUpWindow", "scrollbars=" + Scrollbars + ",status=no,resizable=no,left=50,top=50,width=" + Width + ",height=" + Height);
   }
    return false;
}