   curSwatch = 0;
  
  function setSwatch(nSwatch,imgName)
  {
		strSwatch = arUrls[nSwatch];
	if (strSwatch != "null")
	{
		document.getElementsByName(document.images[imgName].name)[0].src=strSwatch;
	}
	return true;
  }

 function viewerPopup(classStyle, colorList, prodDescription)
  {
  	// takes "curSwatch" as a global variable set when each swatch is set
  
    // http://s7ondemand1.scene7.com/s7ondemand/zoom/flasht_zoom.jsp?
	// 		company=NewYorkCompany&
	//		config=default_config&
	//		sku=01404528&
	//		vc=selItem=NewYorkCompany/01404528,136&singleImageSwatch=True&
	//		itemdesc=TEST PRODUCT NAME&
	//		initialFrame=0&
	//		zoomheight=500&
	//		zoomwidth=640
  
  
//  	baseUrl="http://s7ondemand1.scene7.com/s7ondemand/zoom/flasht_zoom.jsp?";
	baseUrl="http://s7d2.scene7.com/s7ondemand/zoom/flasht_zoom.jsp?";
	accountCompany="NewYorkCompany";
	viewerConfiguration="p2_config";
	skuNumber="";
	//width="640";
	//height="500";
	width="700";
	height="740";
	customer="";
	
	initialFrame=0;
	initialFrame += curSwatch; // 0,1,2,n-1 of swatches
	
	selItem="NewYorkCompany/"+classStyle;
	if (colorList != "")
		selItem= selItem + "," + colorList;
	if (colorList.indexOf(",") != -1)
	{
		singleSwatch="false";
		singleSwatch="true";
	} else {
		singleSwatch="true";
	}
	
	var ua = navigator.userAgent.toLowerCase();
	
	URL = baseUrl + "company=" + escape(accountCompany) + "&config=" + escape(viewerConfiguration) + "&sku=" + escape(classStyle) + "&vc=" + "selItem%3D" + escape(selItem) + "%26singleImageSwatch%3D" + singleSwatch + "%26itemdesc%3D" + escape(prodDescription) + "%26initialFrame%3D" + escape(initialFrame) + "%26codeRoot%3D%2Fis-viewers-3.7%2Fflash%2F&viewer=%2Fskins%2FNewYorkCompany%2FSWFs%2Fnycogenericzoom.swf" + "&zoomheight=" + escape(height) + "&zoomwidth=" + escape(width)
//	alert(URL);

	if (ua.indexOf("msie"))
	{
    	newwindow=open(URL,"","location=no,resizable=no,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,width="+width+",height="+height); 
	} else {
	    newwindow=open(URL,"","location=no,scrollbars=no,toolbar=no,directories=no,menubar=no,resizable=no,status=yes,width="+width+",height="+height);
	}

	return;
  }

function autotab(current,to)
  {
    if (current.getAttribute &&  current.value.length==current.getAttribute("maxlength"))
       {
         to.focus()
       }
  }