window.name="parentWindow";
name="parentWindow";
var Wins = new Array();			// array of open popups

function Add(ckbx,spName,price) {
  var on = ckbx.checked;
  var el = document.getElementById(spName);
  if (el) el.style.display = (on)?"block":"none";

  var loc =  'cart.php?';
  loc += 'name='+ckbx.form.name;
  loc += '&value='+ckbx.form.name;
  loc += '&price='+price;
  loc +='&quantity='+escape((on)?'+1':'-1');
  window.cart.location=loc;
}

function Sync(ckbx,frm,spName) { 
    if (Wins[frm]) {
    win = Wins[ frm ];                          
    if (!win.closed)   {
      win.document.forms[ckbx.form.name].elements[ckbx.name].checked = ckbx.checked;
      win.Sync(document.forms[ckbx.form.name].elements[ckbx.name],frm,spName); 
    }
  }
 }

function showPopUp(divName) {
     var features = "height=350,width=350,location,resizable,scrollbars";
     var pgName = "cntPage" + divName.replace(/\s/g,'_');
     var win = window.open('', pgName, features);
     var elem = document.getElementById(divName);
     var hasProblem = (!document.all && typeof HTMLElement != "undefined");
     win.document.write("<TITLE>" + divName + " Information</TITLE>");
     win.document.title = divName + " Information";
     win.document.write("<LINK REL='stylesheet' HREF='default.css' TYPE='text/css'>");
     win.document.write("<script src='add.js' defer type='text/javascript'></script\>");
     win.document.write("<BODY bgcolor=\"#F8F6F4\" onLoad='javascript:check(document.forms[0].elements[0])' onBeforeUnload='javascript:remove()'>");
     win.document.write((hasProblem)?parseHTML(elem.innerHTML):elem.innerHTML);
     win.document.close(); // Should be done always
     Wins[ divName ] = win;				// append name / win object to array
     win.focus();
}

function parseHTML(str)
{
     str = str.replace("/<br>/gi","\n");
     str = str.replace("</[^]+>/g", "");
     return str;
}

function SubWin(pg, sz) {
        var SW;
                if (sz == "3")  {
                    SW = window.open(pg,"","height=550,width=470,location,resizable,scrollbars");
                } else if (sz == "2")  {
                    SW = window.open(pg,"","height=450,width=350,location,resizable,scrollbars");
                } else if (sz == "1")  {
                    SW = window.open(pg,"","height=350,width=250,location,resizable,scrollbars");
                }
}

// function Cart(ckbx,price) {
//  var on = ckbx.checked;
//  var loc =  'cart.php?';
//  loc += 'name='+ckbx.form.name;
//  loc += '&value='+ckbx.form.name;
//  loc += '&price='+price;
//  loc +='&quantity='+escape((on)?'+1':'-1');
//  window.cart.location=loc;
// }
