// JavaScript Document

function initOtherWishLists() {
	
	var hooks = $("a.otherWishListsButton");

	var overList = 1;
	
	var userWishLists = new Array();
	
	/*dummy wish list values*/
	
				var num = 3;
				for(i = 0; i < num; i++) {
					var li = document.createElement('li');
					var a = document.createElement('a');
					a.className = 'iconWishList';
					a.innerHTML = "New Wish List " + (i + 1);
					a.href = "javascript:void(0);";
					li.appendChild(a);
					userWishLists.push(li);
				}
	
	var zindex = 100;
	for(i = 0; i < hooks.length; i++) {
		
		hooks[i].parentNode.style.zIndex = zindex;
		zindex = zindex - 1;
		hooks[i].onclick = function() {
			
			overList = 1
			/*var ul = document.createElement('ul');
			ul.id = "subList";
			
			ul.innerHTML = '<li class="arrowSelected">arrow selected</li>';
			
			
			var wishListHTML = '';

			for(j = 0; j < userWishLists.length; j++) {
				if(j == (userWishLists.length - 1))
					wishListHTML += '<li class="lastItem">' + userWishLists[j].innerHTML + '</li>';
				else
					wishListHTML += '<li>' + userWishLists[j].innerHTML + '</li>';
			}			

			ul.innerHTML += wishListHTML;
			//console.log(ul.innerHTML);
			//init addTo function
			
			
			
			var doesExist = document.getElementById('subList');
			
			if(doesExist) {
				doesExist.parentNode.removeChild(doesExist);
				this.parentNode.appendChild(ul);
			}
			else
				this.parentNode.appendChild(ul);
			*/
			
			ul_DropDown = document.getElementById('DropDown_subList_source');
			
			if(ul_DropDown.style.right != "0px") {
				ul_DropDown.style.right = 0 + "px";
				ul_DropDown.style.visibility = "visible";
			}

			ul_DropDown.childNodes[0].onclick = function () {
				overList = 0;	
				ul_DropDown.style.visibility = "hidden";
			}
			
			ul_DropDown.onmouseover = function() {
				overList = 1;
			}
			
			ul_DropDown.onmouseout = function () {
				overList = 0;	
			}
			
			document.body.onclick = function () {
				if(overList) 
					ul_DropDown.style.visibility = "visible";
				else
					ul_DropDown.style.visibility = "hidden";
			}

		}
	}
}