<!--//

 //-----------------------------------------------------------------------
 // John Mooney  07/2002:   added featStr parm to showLargerView function
 // Srikanth Garnepudi 16/Nov/2005 - fixed issues #008996 and #001207
 // Srikanth Garnepudi 16/Nov/2005 - fixed issues #008790-I
 // Raghavendra Shanthappa 06/21/2006 - color name changes
 // Matt Currey 09/21/2006 - Added componentProxy() function
 // Brian Antonelli 09/10/2007 - Various additions/changes for Zoom pop-up
 //-----------------------------------------------------------------------
  
//BeginExternalization
var colorstyle = "Color/Style:";
//EndExternalization
  
  var selectedColor = null;
  var productPopUpWindow = null;
  var zoomPopUpWindow = null;
  var verticalAttribs = 'resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,status=no,dependant,menubar=no,width=830,height=746,top=25,left=100';
  var horizontalAttribs = 'resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,status=no,dependant,menubar=no,width=830,height=746,top=25,left=100';
  var zoomAttribs = 'resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,status=no,dependant,menubar=no,width=624,height=746,top=25,left=100';

  var onLoadFlag = false;
  var emailPopUpWindow = null;
  //this function returns the currently selected color.
  //returns default if nothing is selected or if default is selected.
  function getSelectedColorFromList(compIndex){
  	if (document.data) {
		for(i=0;i<document.data.elements.length; i++) {
			w=document.data.elements[i];
//			alert("w.name.indexOf("+compIndex+"_)="+w.name.indexOf(compIndex+"_"));
			if((w.type == "select-one" && w.options != null && w.options[0].text==colorstyle && compIndex == null) 
			|| (w.type == "select-one" && w.options != null && w.options[0].text==colorstyle && compIndex != null && (w.name.indexOf(compIndex+"_") != -1)))  {				
			 	v = w.selectedIndex;
			 	if (v == -1) {
					return 'default';
			 	}
			 	else if (w.options[v].value != 'default') {
			  	return w.options[v].value ;
			 	}
			 	else {
			  	return 'default';	
			 	}
			}
		}
	}		
	return 'default';		
  }
  /**************************************************************
   * this function will display the larger view window
   **************************************************************/
  function showLargerView(categoryId,hostname,cmdPath,prodImagePath,defaultColor,imageFunctionIndicator,displayType,prodList,featStr,dsplSeq,cmpnSeq,viewTab) {

		//get the currently selected color if the imageFunctionIndicator doesn't equal 3
		if (imageFunctionIndicator != 3) {
		
		  //get a handle to the currently selected color, but not if imagefunctionindicator is only larger view.
		  if(dsplSeq == null && cmpnSeq == null){
				selectedColor = getSelectedColorFromList();
		  }else if (cmpnSeq == null) {
		  	selectedColor = getSelectedColorFromList(dsplSeq);
		  }else {
		  	selectedColor = getSelectedColorFromList(cmpnSeq);
		  }
		  
		  //set the default color to the current color if it is available
		  if (selectedColor != 'default') {
		    defaultColor = selectedColor;
		  }
		}
		
		var storeId="";
		var catalogId = "";
		var langId = document.data.langId.value;
		if ((document.data.storeId[1] != null) && (document.data.storeId[1].value != null)) {
			storeId = document.data.storeId[1].value;
		} else {
			storeId = document.data.storeId.value;
		}
		if ((document.data.catalogId[1] != null) && (document.data.catalogId[1].value != null)) {
			catalogId = document.data.catalogId[1].value;
		} else {
			catalogId = document.data.catalogId.value;
		}
				
		// set the url for the larger view    
		var qString = '?'+ 'prodImagePath=' + escape(prodImagePath) + '&prodColor=' + escape(defaultColor) + '&categoryId=' + categoryId + '&prodList='+prodList+'&feat=' + featStr + '&component=' + dsplSeq + '&storeId=' + storeId + '&langId=' + langId + '&catalogId=' + catalogId;
		if (cmpnSeq != null) {
			qString += "&cmpnSeq="+cmpnSeq;
		}
		if (viewTab != null) {
			qString += "&viewTab="+viewTab;
		}
		largerViewURL=hostname + cmdPath + 'LargerView'+ qString;
		// show the larger view window
		if (displayType == "V") { productPopUpWindow=window.open(largerViewURL,'popup',verticalAttribs); }
		else {productPopUpWindow=window.open(largerViewURL,'popup',horizontalAttribs); }
		productPopUpWindow.focus();			
 }
 
  /******************************************************************************************************
   * this function will display the Zoom window from NON-producthorizontal/productvertical product pages
   ******************************************************************************************************/
  function showZoomView(categoryId,hostname,cmdPath,prodImagePath,defaultColor,imageFunctionIndicator,productId,featStr,dsplSeq,cmpnSeq) {

		//get the currently selected color if the imageFunctionIndicator doesn't equal 5
		if (imageFunctionIndicator != 5) {
		
		  //get a handle to the currently selected color, but not if imagefunctionindicator is only zoom.
		  if(dsplSeq == null && cmpnSeq == null){
				selectedColor = getSelectedColorFromList();
		  }else if (cmpnSeq == null) {
		  	selectedColor = getSelectedColorFromList(dsplSeq);
		  }else {
		  	selectedColor = getSelectedColorFromList(cmpnSeq);
		  }
		  
		  //set the default color to the current color if it is available
		  if (selectedColor != 'default') {
		    defaultColor = selectedColor;
		  }
		}
		
		var storeId="";
		var catalogId = "";
		var langId = document.data.langId.value;
		if ((document.data.storeId[1] != null) && (document.data.storeId[1].value != null)) {
			storeId = document.data.storeId[1].value;
		} else {
			storeId = document.data.storeId.value;
		}
		if ((document.data.catalogId[1] != null) && (document.data.catalogId[1].value != null)) {
			catalogId = document.data.catalogId[1].value;
		} else {
			catalogId = document.data.catalogId.value;
		}
				
		// set the url for the zoom popup    
		var qString = '?'+ 'prodImagePath=' + escape(prodImagePath) + '&prodColor=' + escape(defaultColor) + '&categoryId=' + categoryId + '&productId='+productId+'&feat=' + featStr + '&imageFunctionIndicator=' + imageFunctionIndicator +  '&component=' + dsplSeq + '&storeId=' + storeId + '&langId=' + langId + '&catalogId=' + catalogId;
		if (cmpnSeq != null) {
			qString += "&cmpnSeq="+cmpnSeq;
		}
		zoomURL=hostname + cmdPath + 'ShowZoom'+ qString;
		// show the zoom window
		zoomPopUpWindow=window.open(zoomURL,'popup',zoomAttribs); 
		zoomPopUpWindow.focus();			
 }



  
  /**************************************************************
   * this function will display the set component detail view window
   ***************************************************************/
  function showDetailView(categoryId,hostname,cmdPath,prodImagePath,defaultColor,imageFunctionIndicator,displayType,prodList,featStr,dsplSeq,cmpnSeq) {

		//get the currently selected color if the imageFunctionIndicator doesn't equal 3
		if (imageFunctionIndicator != 3) {
		
		  //get a handle to the currently selected color, but not if imagefunctionindicator is only larger view.
		  if (cmpnSeq == null) {
		  	selectedColor = getSelectedColorFromList(dsplSeq);
		  }else {
		  	selectedColor = getSelectedColorFromList(cmpnSeq);
		  }
		  
		  //set the default color to the current color if it is available
		  if (selectedColor != 'default') {
		    defaultColor = selectedColor;
		  }
		}
		
		// set the url for the larger view    
		var qString = '?'+ 'prodImagePath=' + escape(prodImagePath) + '&prodColor=' + escape(defaultColor) + '&categoryId=' + categoryId + '&prodList='+prodList+'&feat=' + featStr + '&component=' + dsplSeq + '&cmpnSeq=' + cmpnSeq;
		// show the larger view window
		if (displayType == "V") { 
			largerViewURL=hostname + cmdPath + 'ShowSetDetailVertical'+ qString; 
			productPopUpWindow=window.open(largerViewURL,'popup',verticalAttribs);
		} else {
			largerViewURL=hostname + cmdPath + 'ShowSetDetailHorizontal'+ qString; 
			productPopUpWindow=window.open(largerViewURL,'popup',horizontalAttribs);
		}
		productPopUpWindow.focus();			
 }
 
  function myPopUpWindow(file){
    productPopUpWindow = window.open(file,'popup','resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,status=no,dependent,menubar=no,width=465,height=400,left=258,top=294');
    productPopUpWindow.focus();
  }

  //this function changes the main image on the page.
  //prodDisplay is the unescaped name shown to the user
  //prodName contains the underscores
  function swapColor(prodImagePath,prodDisplay,prodName, callPopup) 
  {
    
    //test if we need to tell the larger view to swap (or if this is called from the larger view)
    if (callPopup == null) 
    {
      callPopup=true;
    }
    //test to see if the new image is the same product
    else if (!callPopup)
    {
    	currImage = document.productShot.src;
    	//if not the same product, return
    	if (currImage.indexOf(prodImagePath) == -1) { 
		onLoadFlag = false;
		return;
	}
    }

    prodDisplay = prodDisplay.replace(/\*/g,"'");
    //get the current color information if not known
    if(prodDisplay == "" || prodName =="") 
    {
      selectedColor = getSelectedColorFromList();
      
      //do nothing if the user has selected the default value
      if (selectedColor == 'default') 
      {
	  onLoadFlag = false;
        return;
      }
      //set the color variables
      else 
      {
        prodDisplay = selectedColor;
        
        //replace special characters
        prodName = selectedColor;
        prodName = selectedColor.replace(/ /g,"_");
        prodName = prodName.replace(/-/g,"_");
        prodName = prodName.replace(/\'/g,"_");
        prodName = prodName.replace(/\//g,"_");
		if(getObject("product_color_text")!=null)
			getObject("product_color_text").innerHTML = "<span class=textSmall>"+selectedColor+"</span>";
      }
    }
    else 
    {
      //set the drop down list box value
      for(i=0;i<document.data.elements.length; i++)  {
        if(document.data.elements[i].type == "select-one" && document.data.elements[i].options != null && document.data.elements[i].options[0].text==colorstyle)  {
          for(var o = 0;o < document.data.elements[i].options.length;o++)  {
            //workaround for colors with an apostrophe in the name
            prodColor=document.data.elements[i].options[o].value;
            if(prodColor == prodDisplay)  {
              document.data.elements[i].selectedIndex = o;
            }
          }
        }
      }
	selectedColor = getSelectedColorFromList();
	if(getObject("product_color_text")!=null)
		getObject("product_color_text").innerHTML = "<span class=textSmall>"+selectedColor+"</span>";
    }
    
    //switch the main image
    if(prodName != "") {
	// display Email a Friend link if link exists and is hidden
	if (onLoadFlag == false) {
		// only redisplay link if not onLoad event
		if (getObject('emailLink') && prodName != '') {
			if (getObject('emailLink').style.display == 'none') {
				getObject('emailLink').style.display = '';
				// align link in center
				if (getObject('emailLinkAlign')) {
					getObject('emailLinkAlign').align = 'center';
				}
			}
		}
	} 
      document.productShot.src  =  prodImagePath + prodName + ".jpg";
    }

	onLoadFlag = false;

    // displayColor(prodDisplay);
// 	if (productPopUpWindow != null && !productPopUpWindow.closed && callPopup) productPopUpWindow.swapColorLarger(prodImagePath.replace(/\/M/, "/L"),prodDisplay,prodName,null,null, false);
 	if (productPopUpWindow != null && !productPopUpWindow.closed && callPopup) 
	  { 
			if (prodImagePath.indexOf("/M") >-1 )
			{
					productPopUpWindow.swapColorLarger(prodImagePath.replace(/\/M/, "/L"),prodDisplay,prodName,null,null, false);
			}
			if(prodImagePath.indexOf("/C") >-1)
		  {
						productPopUpWindow.swapColorLarger(prodImagePath.replace(/\/C/, "/L"),prodDisplay,prodName,null,null, false);
		  }
	  }
  }

  //this function changes the main image on the page and the name above the image
  //prodDisplay is the unescaped name shown to the user
  //prodName contains the underscores
  function swapComponentColor(prodImagePath,prodDisplay,prodName,dsplSeq,cmpnSeq,callPopup) 
  {
//alert("swapComponentColor");
    //test if we need to tell the larger view to swap (or if this is called from the larger view)
    if (callPopup == null) 
    {
      if (zoomPopUpWindow != null && !zoomPopUpWindow.closed && 
           ( (dsplSeq != null && dsplSeq == zoomPopUpWindow.component) || (cmpnSeq != null && cmpnSeq == zoomPopUpWindow.cmpnSeq) ) ) {    	
          callPopup=true;
      } else if (productPopUpWindow != null && !productPopUpWindow.closed &&  
           ( (dsplSeq != null && dsplSeq == productPopUpWindow.component) || (cmpnSeq != null && cmpnSeq == productPopUpWindow.cmpnSeq) ) ) {
         callPopup=true;
      } else {
         callPopup=false;
      }
    }
    //test to see if the new image is the same product
    else if (!callPopup)
    {
    	currImage = eval("document.productShot_" + dsplSeq + ".src");
//		alert("currImage="+currImage+"\nprodImagePath="+prodImagePath);
		// check to see if the image being switched to is for the same product that is being displayed.
		// needed for when the larger view is left opened and the goes to a different product page
    	if (currImage.indexOf(prodImagePath) == -1) return;
    }
    prodDisplay = prodDisplay.replace(/\*/g,"'");
//alert("prodDisplay="+prodDisplay+"\nprodName="+prodName); 
    //get the current color information if not known
    if(prodDisplay == "" || prodName =="")     
    {
      if (cmpnSeq == null) {
		  	selectedColor = getSelectedColorFromList(dsplSeq);
	  }else {
		  	selectedColor = getSelectedColorFromList(cmpnSeq);
	  }
//      alert("selectedColor="+selectedColor);
      //do nothing if the user has selected the default value
      if (selectedColor == 'default') 
      {
        return;
      }
      //set the color variables
      else 
      {
        prodDisplay = selectedColor;
        
        //replace special characters
        prodName = selectedColor;
        prodName = selectedColor.replace(/ /g,"_");
        prodName = prodName.replace(/-/g,"_");
        prodName = prodName.replace(/\'/g,"_");
        prodName = prodName.replace(/\//g,"_");
      }
    }
    else 
    {
      //set the drop down list box value
      if (cmpnSeq != null) {
      	selectDropDownValue(prodDisplay, cmpnSeq);
      } else {
		selectDropDownValue(prodDisplay, dsplSeq);
      }
    }
   
    if (eval("document.data.defaultColor_" + dsplSeq)) {
   	eval("document.data.defaultColor_" + dsplSeq).value=prodDisplay;
    }
   
    //switch the main image
    if(prodName != "") {
      eval("document.productShot_" + dsplSeq).src =  prodImagePath + prodName + ".jpg";
    }
//    alert("test="+eval("document.productShot_" + dsplSeq).src); 
    displayColor(prodDisplay, dsplSeq);
//    we don't call swapColorLarger because we don't know if the opened image is for the same product
 	if (productPopUpWindow != null && !productPopUpWindow.closed && callPopup) {
 		if (buildProductAttributes) {
			// from MIQS
			prodImagePath = prodImagePath.replace(/lt_/, "_");
 			index = prodImagePath.lastIndexOf('/');
 			prodImagePath = prodImagePath.substring(0, index+1) + "L" + prodImagePath.substring(index+1);
		} else {
			// from ordercomponent
			prodImagePath = prodImagePath.replace(/\/C/, "/L");
		}
 		//productPopUpWindow.swapColorLarger(prodImagePath.replace(/\/C/, "/L"),prodDisplay,prodName, dsplSeq,cmpnSeq, false);
 		productPopUpWindow.swapColorLarger(prodImagePath,prodDisplay,prodName, dsplSeq,cmpnSeq, false);
 	}
 	
 	
  	if (zoomPopUpWindow != null && !zoomPopUpWindow.closed && callPopup) {
 		if (buildProductAttributes) {
			// from MIQS
			prodImagePath = prodImagePath.replace(/lt_/, "_");
		} else {
			// from ordercomponent
			prodImagePath = prodImagePath.replace(/\/C/, "/");
		}
 		zoomPopUpWindow.swapColorZoom(prodImagePath,prodDisplay,prodName, dsplSeq,cmpnSeq, false);
 	}
 	
 	
  }

  function swapColorLarger(prodImagePath,prodDisplay,prodName, component, cmpnSeq, callParent) 
  {
    if (callParent == null) callParent = true;
    prodDisplay = prodDisplay.replace(/\*/g,"'");
    //get the current color information if not known
    if(prodDisplay == "" || prodName =="") 
    {
      selectedColor = getSelectedColorFromList();
      
      //do nothing if the user has selected the default value
      if (selectedColor == 'default') 
      {
        return;
      }
      //set the color variables
      else 
      {
        prodDisplay = selectedColor;
        
        //replace special characters
        prodName = selectedColor;
        prodName = selectedColor.replace(/ /g,"_");
        prodName = prodName.replace(/-/g,"_");
        prodName = prodName.replace(/\'/g,"_");
        prodName = prodName.replace(/\//g,"_");
      }
    }
    
    //switch the main image
    if(prodName != "") 
    {
    		document.productShot.src  =  prodImagePath + prodName + ".jpg";    		
    }

    displayColor(prodDisplay);
    if(component == null){
    	if (!window.opener.closed && callParent){    		
    		window.opener.swapColor(prodImagePath.replace(/\/L/, "/M"),prodDisplay,prodName, false);
    	}
    }else{
    	if (!window.opener.closed && callParent && window.opener.buildProductAttributes) {
		// from MIQS
		prodImagePath = prodImagePath.replace(/\/L/, "/");
 		index = prodImagePath.lastIndexOf('_');
 		prodImagePath = prodImagePath.substring(0, index) + "lt_";
	} else {
		// from ordercomponent
		prodImagePath = prodImagePath.replace(/\/L/, "/C");
	}
    	if (!window.opener.closed && callParent && cmpnSeq==null) {
    		//window.opener.swapComponentColor(prodImagePath.replace(/\/L/, "/C"),prodDisplay,prodName,component,cmpnSeq,false);
    		window.opener.swapComponentColor(prodImagePath,prodDisplay,prodName,component,cmpnSeq,false);
    	} else if (!window.opener.closed && callParent && cmpnSeq!=null) {
    		//window.opener.swapComponentColor(prodImagePath.replace(/\/L/, "/C"),prodDisplay,prodName,component,cmpnSeq,false);
    		window.opener.swapComponentColor(prodImagePath,prodDisplay,prodName,component,cmpnSeq,false);
	}
  	}    
  }




  function swapColorZoom(prodImagePath,prodDisplay,prodName, component, cmpnSeq, callParent) 
  {
    var colorCode = -1;
    if (callParent == null) callParent = true;
    prodDisplay = prodDisplay.replace(/\*/g,"'");
    //get the current color information if not known
    if(prodDisplay == "" || prodName =="") 
    {
      selectedColor = getSelectedColorFromList();
      
      //do nothing if the user has selected the default value
      if (selectedColor == 'default') 
      {
        return;
      }
      //set the color variables
      else 
      {
        prodDisplay = selectedColor;
        
        //replace special characters
        prodName = selectedColor;
        prodName = selectedColor.replace(/ /g,"_");
        prodName = prodName.replace(/-/g,"_");
        prodName = prodName.replace(/\'/g,"_");
        prodName = prodName.replace(/\//g,"_");
      }
    }
    	//get colorCode
    	colorCode = pageControllerObject.findColorCode(prodDisplay);
    	
    	//switch the main image
	if (pageControllerObject.swatchesObject && pageControllerObject.imageSwapObj && pageControllerObject.zoomControlObject) {
		if (pageControllerObject.altViewSelected) {
        		pageControllerObject.zoomImageSwap(colorCode, 1);
        	} else {
        		pageControllerObject.zoomImageSwap(colorCode);
        	}
        }	
	
	
	if (pageControllerObject.colorTextSwapObj) {	
		//swap color text
		pageControllerObject.colorTextSwapObj.swap(colorCode);
	}
	
	
	if (pageControllerObject.zoomAltThumbsObject) {
        	pageControllerObject.zoomAltThumbsObject.showHideSwatches(false);
        	pageControllerObject.zoomAltThumbsObject.resetThumbnails();
        	pageControllerObject.zoomAltThumbsObject.selectMainThumbnail();
        	pageControllerObject.altViewSelected = 0;
        }


/* Do we need this code??? Commenting out for now - BMA 09/10
    if(component == null){
    	if (!window.opener.closed && callParent){    		
    		window.opener.swapColor(prodImagePath.replace(/\/L/, "/M"),prodDisplay,prodName, false);
    	}
    }else{
    	if (!window.opener.closed && callParent && window.opener.buildProductAttributes) {
		// from MIQS
		prodImagePath = prodImagePath.replace(/\/L/, "/");
 		index = prodImagePath.lastIndexOf('_');
 		prodImagePath = prodImagePath.substring(0, index) + "lt_";
	} else {
		// from ordercomponent
		prodImagePath = prodImagePath.replace(/\/L/, "/C");
	}
    	if (!window.opener.closed && callParent && cmpnSeq==null) {
    		//window.opener.swapComponentColor(prodImagePath.replace(/\/L/, "/C"),prodDisplay,prodName,component,cmpnSeq,false);
    		window.opener.swapComponentColor(prodImagePath,prodDisplay,prodName,component,cmpnSeq,false);
    	} else if (!window.opener.closed && callParent && cmpnSeq!=null) {
    		//window.opener.swapComponentColor(prodImagePath.replace(/\/L/, "/C"),prodDisplay,prodName,component,cmpnSeq,false);
    		window.opener.swapComponentColor(prodImagePath,prodDisplay,prodName,component,cmpnSeq,false);
	}
  	}    
*/

  }



	function displayColor(color, component) {
		currentColor = color;
		if(component == null){
			largerImage = document.productShot.src.replace(/\/M/, "/L");
			
			document.getElementById("product_color").innerHTML = "<span class=textSmall>"+color+"</span>";
	
			
		}else{
			imageName = eval("document.productShot_" + component);
			largerImage = imageName.src.replace(/\/M/, "/L");
			
			document.getElementById("product_color_" + component).innerHTML = "<span class=textSmall>"+color+"</span>";
			
			
		}
	}
	
	function writeToLayer(info, component){
	
		//adapted from Josef Blazej's original code
		var strOutput="<span class='textSmall'>";
		globalId = component;
		strOutput+= info;

		var NSLayer = eval("document.layers.ID"+globalId+"Lyr");
		NSLayer.doc = eval("document.layers.ID" + globalId + "Lyr.document");
		NSLayer.top = document.anchors["ID"+globalId + "Anch"].y;
		NSLayer.left = document.anchors["ID"+globalId + "Anch"].x;
		NSLayer.doc.open();
		NSLayer.doc.write(strOutput);
		NSLayer.doc.close();

	}								

	function selectDropDownValue(newColor, compIndex) {
      //set the drop down list box value
//alert("document.data.elements.length="+document.data.elements.length);
      for(i=0;i<document.data.elements.length; i++)  {
      	w=document.data.elements[i];
//      	alert("w.name.indexOf(\""+compIndex+"_\")="+w.name.indexOf(compIndex+"_"));
//        if(w.type == "select-one" && w.options != null && w.options[0].text==colorstyle && component != null &&  (w.name.substr(4,1) == component || w.name.substr(4,2) == component))  {
        if(w.type == "select-one" && w.options != null && w.options[0].text==colorstyle && compIndex != null &&  (w.name.indexOf(compIndex+"_") != -1))  {
           for(var o = 0;o < document.data.elements[i].options.length;o++)  {
            //workaround for colors with an apostrophe in the name
            prodColor=document.data.elements[i].options[o].value;
//            alert("prodColor="+prodColor+"\nnewColor="+newColor); 
            if(prodColor == newColor)  {
              document.data.elements[i].selectedIndex = o;
            }
          }
        }
      }

	}

/**************************************************************
 * this function will display the email a friend view window
 **************************************************************/
function showEmailFriendView(displayType, hostname, cmdPath, bg) {
	
	// set emailFriend gloabal variable to true
	emailFriendFlag = true;

	// check to make sure required input fields were selected
	if (!check_attr_selection()) {
		emailFriendFlag = false;
		
		// required fields were not selected, return
		return;
		
	}
	emailFriendFlag = false;
		
	// set variables from data form to pass to email popup
	var rPrice = regPrice;  // regular price js var from productItemSelect.jsi
	var sPrice = salePrice; // sale price js var from productItemSelect.jsi
	var gPrice = grpPrice;  // group price var js from productItemSelect.jsi
	var gQty   = grpQty;    // group quantity js var from productItemSelect.jsi
	var iDesc  = itemDesc;  // item description js var from productItemSelect.jsi
	
	var categoryId = document.data.categoryId.value;
	var prodId = document.data.product_rn.value;
	var prodDsplId = document.data.display_id.value;
	
	var displayAlpha = document.data.catalog_id.value
	var langId = document.data.langId.value;
	var storeId = document.data.storeId[1].value;
	var catalogId = document.data.catalogId[1].value;
	var prodImagePath = document.productShot.src;
	var mainImageWidth  = document.productShot.width;
	var mainImageHeight  = document.productShot.height;

	var quantity = null;
	var cuffs = null;
	if (document.data.quantity)
		quantity = parseInt(document.data.quantity.value);
	if (document.data.cuffsradio) {
		var len = document.data.cuffsradio.length;
		for (var j=0; j<len; ++j) {
			if (document.data.cuffsradio[j].checked) {
				cuffs = document.data.cuffsradio[j].value;
			}
		}
	}
	
	
	// set the url for the email popup    
	var qString = '?'+ 'categoryId=' + categoryId 
		+ '&langId=' + langId 
		+ '&storeId=' + storeId 
		+ '&catalogId='+ catalogId
		+ '&catalog_id='+ displayAlpha
		+ '&bg=' + bg 
		+ '&productId=' + prodId 
		+ '&display_id=' + prodDsplId 
		+ '&prodImagePath=' + prodImagePath 
		+ '&mainImageWidth=' + mainImageWidth 
		+ '&mainImageHeight=' + mainImageHeight; 
	
	if (quantity != null)
		qString += '&quantity=' + quantity; 

	// check js variables from productItemSelect. if has a value add to url 
	if (rPrice != '')
		qString += '&regPrice=' + rPrice; 
	if (sPrice != '')
		qString += '&salePrice=' + sPrice; 
	if (gPrice != '') 	
		qString += '&grpPrice=' + gPrice + '&grpQty=' + gQty;
	if (iDesc != '')
		qString += '&itemDesc=' + iDesc;
	
	
	if (cuffs != null ) 
		qString += '&cuffsradio=' + cuffs;
	
	// get value of attr select boxes and attr name
	for (var i=0;i<= document.data.length-1;i++)
	{
		if( (document.data.elements[i].type == 'select-one')
		 && (document.data.elements[i].name != 'addr_rn') 
		 && (document.data.elements[i].selectedIndex != -1) 
		 && (document.data.elements[i].options[document.data.elements[i].selectedIndex].value != "default")) 
		{
			qString += "&"+document.data.elements[i].name+"="+escape(document.data.elements[i].options[document.data.elements[i].selectedIndex].value);
		}

		if( (document.data.elements[i].type == 'hidden')
		 && (document.data.elements[i].name.substr(0, 8) == 'attrName')) 
		{
			qString += "&"+document.data.elements[i].name+"="+document.data.elements[i].value;
		}

	}
	
	// set the url and errorUrl request parameters
	if (displayType == "V") {
		qString += '&url=ShowEmailFriendProductVertical&errorUrl=ShowEmailFriendProductVertical';
	} else {
		qString += '&url=ShowEmailFriendProductHorizontal&errorUrl=ShowEmailFriendProductHorizontal';
	}
	
	emailViewURL = hostname + cmdPath + 'CheckSku'+ qString;
	
	// show Email Friend window
	var option = "toolbar=0,location=0, directories=0,status=0,menubar=0,scrollbars=1, resizable=1,width=690,height=600";
	emailPopUpWindow=window.open(emailViewURL,'popup',option);
	emailPopUpWindow.focus();			
 }
 
/**************************************************************
 * this function is called from the "view larger" popup window when its parent is the component (outfit, etc) product page
 **************************************************************/ 
function componentProxy(index) {
	
	if (window.popupImages && popupImages.largeImages && popupImages.colorNames && window.component) {
	
		var imageName = popupImages.largeImages[index];
		var colorName = popupImages.colorNames[index];
		var firstUnderscoreIndex = imageName.indexOf("_", imageName.lastIndexOf("/"));
		prodImagePath = imageName.substring(0,firstUnderscoreIndex+1);  //(up to and including the first underscore);
		prodDisplay = colorName;
		prodName = colorName.replace(/'|\/|\s/g,"_"); // replace apostrophe, or slash, or whitespace, with an underscore
	
		//component = //js var set by JSP
		//cmpnSeq = //js var set by JSP
		
		if (window.opener.buildProductAttributes) {
			// from MIQS
			prodImagePath = prodImagePath.replace(/\/L/, "/");
 			index = prodImagePath.lastIndexOf('_');
 			prodImagePath = prodImagePath.substring(0, index) + "lt_";
		} else {
			// from ordercomponent
			prodImagePath = prodImagePath.replace(/\/L/, "/C");
		}
		//window.opener.swapComponentColor(prodImagePath.replace(/\/L/, "/C"),prodDisplay,prodName,component,cmpnseq,false);
		window.opener.swapComponentColor(prodImagePath,prodDisplay,prodName,component,cmpnseq,false);		
	}
}

/**************************************************************
 * this function is called from the "zoom" popup window when its parent is the component (outfit, etc) product page
 **************************************************************/ 
function componentZoomProxy(index) {
	
	if (window.popupImages && popupImages.smallImages && popupImages.colorNames && window.component) {
	
		var imageName = popupImages.smallImages[index];
		var colorName = popupImages.colorNames[index];
		var firstUnderscoreIndex = imageName.indexOf("_", imageName.lastIndexOf("/"));
		prodImagePath = imageName.substring(0,firstUnderscoreIndex+1);  //(up to and including the first underscore);
		prodDisplay = colorName;
		prodName = colorName.replace(/'|\/|\s/g,"_"); // replace apostrophe, or slash, or whitespace, with an underscore
	
		
		if (window.opener.buildProductAttributes) {
			// from MIQS
			index = prodImagePath.indexOf('t_');
 			prodImagePath = prodImagePath.substring(0, index)+ "lt_";
		} else {
			// from ordercomponent
			index = prodImagePath.indexOf('t_');
 			prodImagePath = prodImagePath.substring(0, index)+ "_";
 			index = prodImagePath.lastIndexOf('/');
			prodImagePath = prodImagePath.substring(0, index+1) + 'C' + prodImagePath.substring(index+1);
		}
		window.opener.swapComponentColor(prodImagePath,prodDisplay,prodName,component,cmpnseq,false);		
	}
}

/*************************************************************************
 * These functions return true if the user has flash of at least the
 * required version (7.0.14 currently)
 *************************************************************************/ 
function isUserFlashEnabled(displayZoomLink) {
	var enabled = false;
	if (displayZoomLink)
	{
		enabled = isUserFlashEnabled();
	}
	//alert("isUserFlashEnabled(" + displayZoomLink + ") returning |" + enabled + "|");
	return enabled;
}

function isUserFlashEnabled()
{
	var enabled = false;
	var major = 0;
	var minor = 0;
	var rev = 0;
	var userPlayerVersion;
	try {
		userPlayerVersion = deconcept.SWFObjectUtil.getPlayerVersion();
		major = userPlayerVersion.major;
		minor = userPlayerVersion.minor;
		rev = userPlayerVersion.rev;
		//alert("userPlayerVersion = |" + userPlayerVersion + "|\nuserPlayerVersion.major = |" + userPlayerVersion.major + "|\nuserPlayerVersion.minor = |" + userPlayerVersion.minor + "|\nuserPlayerVersion.rev = |" + userPlayerVersion.rev + "|");
	}
	catch (e)
	{
		//alert("exception!");
	}
	if (major > 7)
	{
		enabled = true;
	}
	else if (major == 7)
	{
		if (minor < 1)
		{
			if (rev > 13)
			{
				enabled = true;
			}
		}
		else
		{
			enabled = true;
		}
	}
	//alert("returning |" + enabled + "|");
	return enabled;
}
//-->
