function OpenLegend(legend) {
	if (legend == 1) {
		var legendItem = document.getElementById("routes");
		
		if (legendItem.style.display == "none") {
			document.getElementById("im_routes").src = "imgs/buttons/open.gif";
			legendItem.style.display = "block";
		} else {
			document.getElementById("im_routes").src = "imgs/buttons/closed.gif";
			legendItem.style.display = "none";
		}
				
	} else if (legend ==2) {
		var legendItem = document.getElementById("lines");
		
		if (legendItem.style.display == "none") {
			document.getElementById("im_lines").src = "imgs/buttons/open.gif";
			legendItem.style.display = "block";
		} else {
			document.getElementById("im_lines").src = "imgs/buttons/closed.gif";
			legendItem.style.display = "none";
		}
		
	} else if (legend == 3) {
		var legendItem = document.getElementById("ships");
		
		if (legendItem.style.display == "none") {
			document.getElementById("im_ships").src = "imgs/buttons/open.gif";
			legendItem.style.display = "block";
		} else {
			document.getElementById("im_ships").src = "imgs/buttons/closed.gif";
			legendItem.style.display = "none";
		}
		
	} else if (legend == 0) {
		var shipLegendItem = document.getElementById("ships");
		var routeLegendItem = document.getElementById("routes");
		var linesLegendItem = document.getElementById("lines");
		
		if ((document.getElementById("im_expandall").src == "http://www.canadiancruiseexperts.ca/imgs/buttons/closed.gif") || (document.getElementById("im_expandall").src == "https://www.canadiancruiseexperts.ca/imgs/buttons/closed.gif")) {
			document.getElementById("im_ships").src = "imgs/buttons/open.gif";
			document.getElementById("im_lines").src = "imgs/buttons/open.gif";
			document.getElementById("im_routes").src = "imgs/buttons/open.gif";
			
			document.getElementById("im_expandall").src = "imgs/buttons/open.gif";
			document.getElementById("sp_expand").innerHTML= '<a href="javascript:OpenLegend(0);">Collapse All</a>';
			
			shipLegendItem.style.display = "block";
			routeLegendItem.style.display = "block";
			linesLegendItem.style.display = "block";
		} else {
			document.getElementById("im_ships").src = "imgs/buttons/closed.gif";
			document.getElementById("im_lines").src = "imgs/buttons/closed.gif";
			document.getElementById("im_routes").src = "imgs/buttons/closed.gif";
			
			document.getElementById("im_expandall").src = "imgs/buttons/closed.gif";
			document.getElementById("sp_expand").innerHTML= '<a href="javascript:OpenLegend(0);">Expand All</a>';
			
			shipLegendItem.style.display = "none";
			routeLegendItem.style.display = "none";
			linesLegendItem.style.display = "none";
		}		
	}
}

function showTooltip(cruiseTitle, shipName, lineName, routeName, price) {
	var sTip = "";

	sTip = "<div style=\"font-weight:bold;font-size:12px;padding-bottom:4px;letter-spacing:1px;\">" + cruiseTitle + "</div>";
	sTip += "<div style=\"background-color:#ffffff;width:100%;\">";
	sTip += "<div style=\"float:left;padding:4px 8px 4px 8px;\">";
	sTip += "<b>Cruise Line: </b> " + lineName + "<br/>";
	sTip += "<b>Ship Name: </b> " + shipName + "<br/>";
	sTip += "<b>Route: </b> " + routeName + "<br/>";
	sTip += "</div>";
	sTip += "<div style=\"float:right;font-weight:bold;color:#990000;font-size:15px;padding:15px 8px 0px 0px;\">$";
	sTip += price;
	sTip += "</div>";
	sTip += "</div>";
	
	return sTip;
}
