
function showCat(ids)
{
   if (cats.length > 0)
   {
      for (var i=0; i<cats.length; i++)
      {
         hideCat( cats[i] );
      }
      document.getElementById(ids).style.display      = 'block';
      document.getElementById(ids+'Title').className  = 'categoryGroupActive';
   }
}

function hideCat(ids)
{
   document.getElementById(ids).style.display     = 'none';
   document.getElementById(ids+'Title').className = ' ';
}

function addProduct(productCode)
{
   var form     = document.createElement("form");
   form.action  = BASEURL + 'cart/add/';
   form.method  = 'POST';

   var input1   = document.createElement('input');
   input1.name  = 'product_code';
   input1.type  = 'hidden';
   input1.value = productCode;
   form.appendChild(input1);
   
   var input2   = document.createElement('input');
   input2.name  = 'redirect';
   input2.type  = 'hidden';
   input2.value = REDIRECT;
   form.appendChild(input2);
   
   var numberField = document.getElementById('number'+productCode);
   
   var input3   = document.createElement('input');
   input3.name  = 'number';
   input3.type  = 'hidden';
   input3.value = numberField.value;
   form.appendChild(input3);
   
   document.body.appendChild(form);
   form.submit();
}




var popup;
function showPicture(imgName,imgHeight,imgWidth)
{
	maxHeight = screen.availHeight - 34;
	maxWidth = screen.availWidth - 15;
	if ((imgHeight > maxHeight) && (imgWidth > maxWidth)) {
		height = maxHeight;
		width = maxWidth;
		doScrollbar='yes';
	} else if ((imgHeight > maxHeight) && (imgWidth <= maxWidth)) {
		height = maxHeight;
		width = imgWidth + 18;
		doScrollbar='yes';
	} else if ((imgHeight <= maxHeight) && (imgWidth > maxWidth)) {
		height = imgHeight + 18;
		width = maxWidth;
		doScrollbar='yes';
	} else {
		height = imgHeight;
		width = imgWidth;
		doScrollbar='no';
	}
	
	//try { popup.close(); } catch(e) {return false;}
	var strHTML = '<html><head><title>Image Viewer</title>';
	strHTML += '<script language="Javascript" src="'+BASEURLBASIC+'js/security.js"></script>';
	strHTML += '</head>';
	strHTML += '<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="trap()">';
	strHTML += '<table width="100%" height="100%" border="0"><tr><td align="center" valign="center"><img src=" ' + imgName + ' " alt="" border="0"></td></tr></table>';
	strHTML += '</body></html>';
	
	if (popup) 
	  popup.close();
	popup = window.open('' ,'popupImage','Height=' + height + ',Width=' + width + ',scrollbars=' + doScrollbar + ',resize=no,left=0,top=0');
	popup.document.write(strHTML);
	popup.document.close();
	popup.focus();
	return false;
}
