


	function ignoreReturn(field, event) {
	
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) { return false; } 
	}



	var zoom_timeoutID = 0;

	function thumbMouseover(filecode, imgwidth)	{
	
		var call = "showZoomedImage('" +filecode + "', " + imgwidth + ");";
	
		zoom_timeoutID = setTimeout(call, 300);
		
		var img = findObj("img_" + filecode);
		img.style.border = "1px solid #999999";
	}
	
	function showZoomedImage(filecode, width)	{
	
		var link = "/photo/view?filecode=" + filecode + "&type=large";

		findObj("photo_zoomed_img").src = link;

		var thumb_pos = findPos(findObj("img_" + filecode));

		var zoom_div = findObj("photo_zoomed");
		zoom_div.style.left = thumb_pos[0] - (50 - width/2) + 105;
		zoom_div.style.top = thumb_pos[1] - 30;
		
		zoom_div.style.display = "block";
	}
	


	function hideZoomedImage(filecode)	{
	
		if(zoom_timeoutID!=0)	{
			clearTimeout(zoom_timeoutID);
			zoom_timeoutID = 0;
		}
	
	
		var zoom_div = findObj("photo_zoomed");
		zoom_div.style.display = "none";

		findObj("photo_zoomed_img").src = "/html/c.gif";
		
		var img = findObj("img_" + filecode);
		img.style.border = "1px solid #FFFFFF";
	}




	function findPos(obj) {
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			curleft = obj.offsetLeft
			curtop = obj.offsetTop
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
			}
		}
		return [curleft,curtop];
	}
	
	
	


	function updateOptions(productID, default_subcat)	{
	
		var parent_option = findObj("category_" + productID);
	    var child_option = findObj("subcatID_" + productID);
	    
		var category = parent_option.options[parent_option.selectedIndex].value;
	
		var names = eval(category + "_names");
		var ids = eval(category + "_IDs");
		
		child_option.options.length=0;
		
		child_option.options[child_option.options.length] = new Option("(Choose)...", "");
			
		for(var i=0; i<names.length; i++)	{
		
			child_option.options[child_option.options.length] = new Option(names[i], ids[i], ids[i]==default_subcat);
			
			if(ids[i]==default_subcat)	child_option.selectedIndex = child_option.options.length-1;
		}
	}
	
		
		
			
	function formatCurrency(num) {
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
		cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+
		num.substring(num.length-(4*i+3));
		return (((sign)?'':'-') + num + '.' + cents);
	}

		
	
	var fade_timeout = 0;

	function startFade(divID)	{
	
		blue = 0;
	
		if(fade_timeout!=0)	clearTimeout(fade_timeout);
	
		fadeHighlight(divID, 100);
	}
	
	function fadeHighlight(divID, blue)	{
	
		fade_timeout = 0;
	
		var color = "#FFFF" + intToHex(Math.round(blue/16)) + intToHex(blue%16);
	
		findObj(divID).style.backgroundColor = color;
	
		if(blue<255)	{
		
			blue+= blue>180?2:5;
	
			if(blue>255)	blue = 255;
	
			fade_timeout = setTimeout("fadeHighlight('" + divID + "', " + blue + ");", 40);
		}
	}

	function intToHex(c){
	
		if(c < 10) 	return(c);
		
		if(c==10)	return('A');
		if(c==11)	return('B');
		if(c==12)	return('C');
		if(c==13)	return('D');
		if(c==14)	return('E');
					return('F');
	}
	
	

	var bgcolor = "FFFFFF"
	
	function setOpacity(obj, opacity) {
	
	  opacity = (opacity == 100)?99.999:opacity;
	
	  // IE/Win
	  obj.style.filter = "alpha(opacity:"+opacity+")";
	  obj.style.background = bgcolor; 
	
	  // Safari<1.2, Konqueror
	  obj.style.KHTMLOpacity = opacity/100;
	  
	  // Older Mozilla and Firefox
	  obj.style.MozOpacity = opacity/100;
	  
	  // Safari 1.2, newer Firefox and Mozilla, CSS3
	  obj.style.opacity = opacity/100;
	}
	
	function uniPop(href,winname,width,height,x,y,toolbar,scrollbars,resizable,status)  {
		if (href == "") href = '/support';
		if (winname == 'spellChecker') href+=escape(document.eventForm.notes.value);
		if ((width < 100) || (width == null)) var width = '515';
		if ((height < 100) || (height == null)) var height = '475';
		if (toolbar == null) var toolbar = 'yes';
		if (scrollbars == null) var scrollbars = 'yes';
		if (resizable == null) var resizable = 'yes';
		if (status == null) var status = 'yes';
		var theParam = "width=" +width+ 
						",height=" +height+  
						",toolbar=" +toolbar+ 
						",scrollbars=" +scrollbars+ 
						",resizable=" +resizable+ 
						",status=" +status+
						",screenX=" + x + ",screenY=" + y + ",top=" + y + ",left=" + x;
		var thePopup = window.open(href,winname,theParam);
	}
		
	function confirmURL(text, url) {
		if(confirm(text)) {
			location.href=(url);
		}
	}

	function trim(str)
	{
	   return str.replace(/^\s*|\s*$/g,"");
	}

	function isdefined( variable)
	{
	    return (typeof(variable) == "undefined")?  false: true;
	}


	
	function findObj(n, d) {
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.ls&&i<d.ls.length;i++) x=findObj(n,d.ls[i].document);
	  if(!x && document.getElementById) x=document.getElementById(n); return x;
	}
	
	
	
	
	function replace(s, t, u) {
  /*
  **  Replace a token in a string
  **    s  string to be processed
  **    t  token to be found and removed
  **    u  token to be inserted
  **  returns new String
  */
  i = s.indexOf(t);
  r = "";
  if (i == -1) return s;
  r += s.substring(0,i) + u;
  if ( i + t.length < s.length)
    r += replace(s.substring(i + t.length, s.length), t, u);
  return r;
  }






	function uncheckAll(params)
	{
		
		if(!isArray(params))	{
		
			params.checked = false;
			return;
		}
		
		
		for (i = 0; i < params.length; i++)	{
		
			var param = params[i];
			
			param.checked = false;
		}
		
	}
	
	
function isArray(obj){return(typeof(obj.length)=="undefined")?false:true;}

 
 