
iconsSelected = 0;
iconsTotal = 0;

function toggle(a)
{
        b = document.getElementById(a);
        if (YAHOO.util.Dom.hasClass(b,"gridprice"))
        {
                YAHOO.util.Dom.replaceClass(b,"gridprice","gridprice-black");
		iconsSelected++;
        } else
        {
                YAHOO.util.Dom.replaceClass(b,"gridprice-black","gridprice");
		iconsSelected--;
        }
	updateTotal();
}

function updateTotal()
{
	iconsTotal = iconsSelected * 5;
	st = document.getElementById("selected-text");
	si = document.getElementById("grid-total");

	st.innerHTML = iconsSelected + " " + ((iconsTotal == 1) ? "Item" : "Items");
	si.innerHTML = "$" + iconsTotal;	

}


       function dumpObj(obj, name, indent, depth) {
              var MAX_DUMP_DEPTH = 3;
              if (depth > MAX_DUMP_DEPTH) {
                     return indent + name + ": <Maximum Depth Reached>\n";
              }

              if (typeof obj == "object") {
                     var child = null;
                     var output = indent + name + "\n";
                     indent += "\t";
                     for (var item in obj)
                     {
                           try {
                                  child = obj[item];
                           } catch (e) {
                                  child = "<Unable to Evaluate>";
                           }
                           if (typeof child == "object") {
                                  output += dumpObj(child, item, indent, depth + 1);
                           } else {
                                  output += indent + item + ": " + child + "\n";
                           }
                     }
                     return output;
              } else {
                     return obj;
              }
       }

