function showInfoWindow(element){
	
	$("#infowindow").fadeTo(5, 0, function(){
		var iw = $("#infowindow");
		iw.css("display", "block");
		
		// Find out if the hover elements top + it's height + the height of the info window
		//	is higher than the windows height.
		if(parseInt($(element).offset().top) + parseInt($(element).height()) + 5 + parseInt(iw.height()) > $(window).height() + $(window).scrollTop()){
			// If it is then show the info window on top
			iw.css({
				"left":$(element).offset().left + 5,
				"top":$(element).offset().top - iw.height() - 5
			});
		}else{
			iw.css({
				"left":$(element).offset().left + 5,
				"top":$(element).offset().top + $(element).height() + 5
			});
		}
		iw.fadeTo(5, 1);
	});
}

function hideInfoWindow(){
	$("#infowindow").fadeOut();
}

function hideInfoWindowControls(){
	$("#infowindow ul li").css("display", "none");
}

/* control the options on the info window */
function showInfoWindowControls(){
	for(var i=0, len = arguments.length; i < len; i++){
		show = arguments[i];
		$("#infowindow ul li#"+show).css("display", "block");
	}
}
