	function addToList(thisElem, listWrapper, linkType) {
        document.getElementById('shoplist_linktype').value = linkType;
        document.getElementById('additemtowishlistwrapper').style.display='none';
        document.getElementById('additemtoreorderlistwrapper').style.display='none';
        document.getElementById('additemtoshoplistwrapper').style.display='none';
        document.getElementById(listWrapper).style.display='';
        document.getElementById('additem_tolist').style.display = '';
        if (linkType==400 && !$('additemtowishlist')) {
          $('addnew_list').style.display='';
        } 
        if (linkType==402 && !$('additemtoreorderlist')) {
          $('addnew_list').style.display='';
        } 
        if (linkType==401 && !$('additemtoshoplist')) {
          $('addnew_list').style.display='';
        }
        
        if (linkType==401) {
        	document.getElementById('additemtoshoplistmisc').style.display='';
        } else {
        	document.getElementById('additemtoshoplistmisc').style.display='none';
        }
      }
      
      function submitAddToList() {
        var itemId = $('addtocartformid').IID.value;
        var linkType =  $('shoplist_linktype').value;
        var seq = $('shoplist_seq').value;
        var qty = 1;
        var listName = $('shoplist_name').value;
        var comment = $('shoplist_comment').value;
        var recommendedBreeds = '';
        var recos = document.getElementsByName('breedrecommendation');
        for (var x=0; x<recos.length; x++) {
        	var recoElem = recos[x];
        	if(recoElem && recoElem.checked) {
        		if(recommendedBreeds.length > 0) {
        			recommendedBreeds += ',' + recoElem.value;
        		} else {
        			recommendedBreeds = recoElem.value;
        		}
        	}
        }
                
        ajaxShopListAddItem(itemId, linkType, seq, qty, listName, comment, recommendedBreeds);
        document.getElementById('additem_tolist').style.display = 'none';
        document.getElementById('addnew_list').style.display='none';
        document.getElementById('additemtowishlistwrapper').style.display='';
        document.getElementById('additemtoreorderlistwrapper').style.display='';
        document.getElementById('additemtoshoplistwrapper').style.display='';
      }
      
      function cancelAddToList() {
      	if(document.getElementById('shoplist_comment')) {
      		document.getElementById('shoplist_comment').value = '';
      	}      	
        document.getElementById('additem_tolist').style.display = 'none';
        document.getElementById('addnew_list').style.display='none';
        document.getElementById('additemtowishlistwrapper').style.display='';
        document.getElementById('additemtoreorderlistwrapper').style.display='';
        document.getElementById('additemtoshoplistwrapper').style.display='';
      }
    
      function showAddNewList(elem) {
        clearSelects();
        Effect.BlindDown(elem,{duration:.4})
      }
    
      function specifyOtherBreeds(elem) {
      	document.getElementById('pbreed').options[0].selected = true;
        Effect.BlindDown(elem,{duration:.4})
      }
    
      function updateListFields(seq) {
        document.getElementById('shoplist_seq').value = seq;
        $('shoplist_name').value="";
      }

      function clearSelects() {
        if ($('additemtowishlist')) {
          $('additemtowishlist').selectedIndex=0;
        } 
        if ($('additemtoreorderlist')) {
          $('additemtoreorderlist').selectedIndex=0;
        } 
        if ($('additemtoshoplist')) {
          $('additemtoshoplist').selectedIndex=0;
        } 
      }
      
      function selectBreed(elem) {
      	if(elem.selectedIndex > 0) {
      		var optionValue = elem.options[elem.selectedIndex].value;
      		var dspName = elem.options[elem.selectedIndex].text;
      		var parent = document.getElementById('breed_recommendation_table');

      		var newRow = document.createElement('tr');
      		var newCol = document.createElement('td');
      		var newXBox = document.createElement('input');
      		var newSpace = document.createTextNode(' ');
      		var newText = document.createTextNode(dspName);

      		newRow.id = 'remove_'+ optionValue;
      		
			newCol.className = 'body';
			newCol.setAttribute('style', 'color:white;');

			newXBox.type = 'checkbox';
			newXBox.className = 'body';
			newXBox.setAttribute('style', 'color:white;');
			newXBox.name = 'breedrecommendation';
			newXBox.value = optionValue;
			newXBox.setAttribute('checked', 'true');
			newXBox.setAttribute("onClick", "removeRow(this, '"+ optionValue + "');");
			
			newRow.appendChild(newCol);
			newCol.appendChild(newXBox);
			newCol.appendChild(newSpace);
			newCol.appendChild(newText);
			
			parent.appendChild(newRow);
			
			document.getElementById('pbreed').options[0].selected = true;
      	}
      }
      
      function removeRow(elem, optVal) {
      	if(!elem.checked) {
	      	var idVal = 'remove_' + optVal;
	      	var parent = document.getElementById('breed_recommendation_table');
	      	var childToRemove = document.getElementById(idVal);
	      	alert('Parent : ' + parent + ' for ' + idVal+' childToRemove : '+childToRemove);
	      	parent.removeChild(childToRemove);
      	}
      }