function selectOption(itemToSelect,formField)	{
	itemToSelect = itemToSelect.replace('%3A',':')
// Get a reference to the drop-down
	var myDropdownList = formField;

// Loop through all the items
	for (iLoop = 0; iLoop< myDropdownList.options.length; iLoop++)	{    
		if (myDropdownList.options[iLoop].id == itemToSelect)	{
// Item is found. Set its selected property, and exit the loop
			myDropdownList.options[iLoop].selected = true;
			break;
			}
		}
	}


function openWindow(url,w,h) {
	adviceWin = window.open(url,'advice','status=no,width='+w+',height='+h+',menubar=no,scrollbars=yes');
	adviceWin.focus(true);
	}



function clearText(thefield)	{
	if (thefield.defaultValue == thefield.value)
		thefield.value = "";
	}




//alert(typeof(MagicZoomPlus));

MagicZoomPlus.options = {
	'background-color':'#000000',
	'background-opacity':'50',
	'opacity-reverse':'true',
	'selectors-mouseover-delay':'0',
	'buttons-display':'close'
	}

/* this gets used on the category pages */
MagicThumb.options = {
	'background-color':'#000000',
	'background-opacity':'50',
	'click-to-initialize':'true',
	'buttons-display':'close'
	}
	
	





//jquery method for extending the class.
$.extend(handlePogs.prototype, {

	renderOptionSIMPLETHUMBNAIL_OVERRIDE:function(pog) {

	var pogid = pog.id;
	var parentDiv = document.getElementById('div_'+pogid);

	parentDiv.innerHTML += "<span id='showValue_"+pogid+"' class='padRight20'></span>";


//output ? with hint in hidden div IF ghint is set
	if(pog['ghint'])
		gHintQmark(pogid,pog['ghint']);

	parentDiv.innerHTML += "<div class='clearAll'></div><div class='bottomMargin'></div>";

/* sog values are displayed only as thumbnails.  a hidden input is added to the dom and, onclick, the value of the sog is saved to the value of the hidden input */
	$('#addToCartFrm').append('<input type="hidden" value=""  name="pog_'+pogid+'" id="pog_'+pogid+'" />');
	


    var i = 0;
    var len = pog.options.length;


//adds options to the select list.
    while (i < len) {
		optionPrompt = pog['options'][i]['prompt'];
		parentDiv.innerHTML += "<div class='floatLeft zborder rightMargin3 topMargin3'><a href='#' onClick='$(\"#pog_"+pogid+"\").val(\""+pog['options'][i]['v']+"\"); $(\"#showValue_"+pogid+"\").empty().append(\""+optionPrompt+"\"); return false;' title='"+optionPrompt+"'><img src='"+zoovyImageUrl(pog['options'][i]['img'],'25','25','ffffff')+"' width='25' height='25' alt='"+optionPrompt+"' \/><\/a>";
		i++;
       }


	parentDiv.innerHTML += "<div class='clearAll'></div><div class='zhint'>please click on a color swatch to make a selection</div>";
	},  //end simplethumbnail_override




	renderOptionCLICKTEXT_OVERRIDE:function(pog) {

	var pogid = pog.id;
	var parentDiv = document.getElementById('div_'+pogid);

	parentDiv.innerHTML += "<span id='showValue_"+pogid+"' class='padRight20'></span>";


//output ? with hint in hidden div IF ghint is set
	if(pog['ghint'])
		gHintQmark(pogid,pog['ghint']);

	parentDiv.innerHTML += "<div class='clearAll'></div><div class='bottomMargin'></div>";
/* sog values are displayed only as thumbnails.  a hidden input is added to the dom and, onclick, the value of the sog is saved to the value of the hidden input */
	$('#addToCartFrm').append('<input type="hidden" value=""  name="pog_'+pogid+'" id="pog_'+pogid+'" />');



    var i = 0;
    var len = pog.options.length;


//adds options to the select list.
    while (i < len) {
		optionPrompt = pog['options'][i]['prompt'];
		parentDiv.innerHTML += "<div class='floatLeft sogClickText rightMargin3 topMargin3'><a href='#' onClick='$(\"#pog_"+pogid+"\").val(\""+pog['options'][i]['v']+"\"); $(\"#showValue_"+pogid+"\").empty().append(\""+optionPrompt+"\"); return false;' title='"+optionPrompt+"'>"+optionPrompt+"<\/a>";
		i++;
       }

	
	parentDiv.innerHTML += "<div class='clearAll'></div>";
	},  //end imgselect_override
	
//used for switchplate covers.  displays options in a grid style with each option having a quantity box.

	xinit: function($super) {
		this.addHandler("type","imgselect","renderOptionSIMPLETHUMBNAIL_OVERRIDE");
//		this.addHandler("pogid","P0","renderOptionSIMPLETHUMBNAIL_OVERRIDE");
		this.addHandler("pogid","BD","renderOptionCLICKTEXT_OVERRIDE");
		}
	});
	




