dom = (document.getElementById)? true : false;
ie4 = (document.all)? true : false;
ns4 = (document.layers)? true : false;

check = []; //this is an array that stores all the true/false values for each checkbox

function checkBox(id)
    {

   if(dom){
    if(check[id] != true) //if a value is not true, use this rather than == false
        {
        document.getElementById('imgCheck' + id).src = "/media/true.png"; //change the image
        document.getElementById('inputCheck' + id).value = "true"; //change the field value
        check[id] = true; //change the value for this checkbox in the array
        }
    else
        {
        document.getElementById('imgCheck' + id).src = "/media/false.png";
        document.getElementById('inputCheck' + id).value = "false";
        check[id] = false;
        }
      } else {
        if(check[id] != true) //if a value is not true, use this rather than == false
                {
                document.layers('imgCheck' + id).src = "/media/true.png"; //change the image
                document.layers('inputCheck' + id).value = "true"; //change the field value
                check[id] = true; //change the value for this checkbox in the array
                }
            else
                {
                document.layers('imgCheck' + id).src = "/media/false.png";
                document.layers('inputCheck' + id).value = "false";
                check[id] = false;
                }
        }
    }
    
	function addToggle() {
	obj1 = getObj('addItem');
	obj2 = getObj('addItemForm');

	if (obj1.style.display == 'none') {
		obj1.style.display = 'block';
		obj2.style.display = 'block';
	} else {
		obj1.style.display = 'none';
		obj2.style.display = 'none';
	}
}

function getObj(oID) {
	if (dom)
		return document.getElementById(oID);
	else if (ie4)
		return document.all(oID);
	else if (ns4)
		return null
}
