//jquery method for extending the class.
$.extend(handlePogs.prototype, {

	renderOptionINVSELECT_OVERRIDE:function(pog) {

	var pogid = pog.id;
	
	var selectList = document.createElement("select");
	with(selectList) {
		setAttribute("id", "pog_"+pogid);
		setAttribute("name", "pog_"+pogid);
		className = "zform_select";  // IE friendly way to set class
		}

    var i = 0;
    var len = pog.options.length;

//if the option is 'optional' AND has more than one option, add blank prompt. If required, add a please choose prompt first.
	if(len > 0)	{
		selOption = document.createElement("option");
		selOption.innerHTML = (pog['optional'] == 1) ?  "" :  "Please choose (required)";
// sets the required option as disabled. must then set it as selected AFTER disabling it (otherwise it auto-selects the first option)
		with(selOption)	{
			setAttribute('value', "");
			setAttribute('disabled', true);
			setAttribute('selected', true);
			}
		
		selectList.appendChild(selOption);
		}
//adds options to the select list.
    while (i < len) {
		selOption = document.createElement("option");
		selOption.setAttribute("value", pog['options'][i]['v']);
		selOption.innerHTML = pog['options'][i]['prompt'];

//check inventory availablility. disable option if sold out.

		if(typeof MYADD2CART_sku[sku+':'+pogid+pog['options'][i]['v']] != 'undefined')	{ //is inventoryable stid?
			if(MYADD2CART_sku[sku+':'+pogid+pog['options'][i]['v']]['inv'] < 1)	{
				selOption.setAttribute("disabled", true);
				selOption.innerHTML += ' - sold out';
				}
			}

		if(pog['options'][i]['p'])
			selOption.innerHTML +=   handlePogPrice(pog['options'][i]['p'],pog.flags); //' '+pog['options'][i]['p'][0]+'$'+pog['options'][i]['p'].substr(1);
		selectList.appendChild(selOption);
		i++;
       }
	
	parentDiv = document.getElementById("div_"+pogid);
	parentDiv.appendChild(selectList);


//output ? with hint in hidden div IF ghint is set
	if(pog['ghint'])
		gHintQmark(pogid,pog['ghint']);
	},  //end invselect_override
	
//used for switchplate covers.  displays options in a grid style with each option having a quantity box.

	xinit: function($super) {
//		this.addHandler("pogid","A0","renderOptionINVSELECT_OVERRIDE");
		this.addHandler("type","select","renderOptionINVSELECT_OVERRIDE");
		}
	});
	


