var favoritesVisible = false;

function toggleFavorites(){
	if(favoritesVisible == true ){
		document.getElementById('favoritesButton').className = "";
		hide('dropDown');
		overflow('scrollArea', 'visible')
		try {
			toggleHelper()
		} catch(e) {}
		favoritesVisible = false;
	} else {
		document.getElementById('favoritesButton').className = "active";
		try {
			toggleHelper()
		} catch(e) {}
		show('dropDown');
		overflow('scrollArea', 'auto')
		favoritesVisible = true;
	}
}

function hide(id){
	document.getElementById(id).style.visibility="hidden";
}
function show(id){
	document.getElementById(id).style.visibility="visible";
}

function overflow(id, value){
	document.getElementById(id).style.overflow = value;
}

function dropDownFav_init() {
	document.onclick = document_onclick
	document.getElementById('dropDown').onmousedown = dropdown_onmousedown
	document.getElementById('favoritesButton').onmousedown = dropdown_onmousedown
}

var drop = false;
function document_onclick(e) {
	if (favoritesVisible == true ) {
		if (drop == false) toggleFavorites();
	}
	drop = false;
}

function dropdown_onmousedown(e) {
	drop = true;
	window.setTimeout('endDrop()', 100);
}
function endDrop() {drop = false;}


