MagicZoomPlus.options = {
  'background-color':'#000000',
  'background-opacity':'50',
  'opacity-reverse':'true',
  'selectors-mouseover-delay':'0'
 }
//'click-to-initialize':'true',
MagicThumb.options = {'buttons-display':'close'}


function openWindow(url,w,h) {
	adviceWin = window.open(url,'advice','status=no,width='+w+',height='+h+',menubar=no,scrollbars=yes');
	adviceWin.focus(true);
	}



//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

	renderSelectWithSizeChart: function(pog)	{
		this.renderOptionINVSELECT_OVERRIDE(pog);
		$('#pog_'+pog.id+'_id').prepend("<div style='float:right'><a href='#' onclick='$( \"#shoesizechart\" ).dialog({\"width\":700,modal: true}); return false;' style='color:#ffffff; padding-right:20px;'>size guide<\/a><\/div>");
		},





	renderSizeChart: function(pog)	{
		$('#sizeChartButton').prepend("<a href='#' onclick='$( \"#glassessizechart\" ).dialog({\"width\":500,modal: true}); return false;' >size guide<\/a>");
		$('#div_'+pog.id).css({'display':'none'}); //make sure the prompt is invisible. the type on this should always be a finder. if it isn't, use the selectwithsizechart.
		},

	xinit: function($super) {
//		this.addHandler("pogid","00","renderInvAndLatencySmartSelect");
		this.addHandler("pogid","A3","renderSizeChart");
		this.addHandler("pogid","A1","renderSelectWithSizeChart");
		this.addHandler("type","select","renderOptionINVSELECT_OVERRIDE");
		}
	});
	


