function addListenerToEvent(obj,evtName,fnCall) {
	// can't remember where this came from
	// doesn't appear to be able to take parameters in fnCall, which seems odd

 evtName=evtName.toLowerCase();
 doCapture=false;

 if (obj.addEventListener){
  //obj.addEventListener(evtName.replace('on',''),fnCall,doCapture);
  obj.addEventListener(evtName.replace('on',''),
  function(){eval(fnCall);},false);
 }
 else if(obj.attachEvent){
  obj.attachEvent(evtName,function(){eval(fnCall);});
  //also do detachEvent later
 }
 else{
  eval(obj+"."+evtName +"="+ fnCall);
 }
}

function enlarge(type,product,width,height) {
	//alert(product+';'+width+';'+height);
	if (type=='product') {
		var url='/product_popup.php?type=product&product='+product;
		}
	else if (type=='free_gift') {
		var url='/product_popup.php?type=free_gift&product='+product;
		}
	else return false;
	kmg_product_popup=window.open(url,'kmg_product_popup','width='+width+',height='+height+',resizable=1');
	kmg_product_popup.focus();
	return false;
	}

function calculator(product) {
	//alert('product: '+product);
	var width=400;
	var height=500;
	var url='/calculator_popup.php?product='+product;
	//alert('url: '+url);
	//return false;
	kmg_calculator_popup=window.open(url,'kmg_calculator_popup','width='+width+',height='+height+',resizable=1');
	kmg_calculator_popup.focus();
	return false;
	}


