// custom tooltip
var loader_html = '<div style="background:url(/images/tooltip/background.png); border:1px solid #555555; padding:10px;"><img src="/images/loading_large.gif" alt="Loading..." title="Loading..."></div>';

function tooltip(containerId, listingId, offsetDistance)
{
	// determine the offset
	var offset = findPos(document.getElementById(containerId));
	// preloader image
	document.getElementById('tooltip_ajax').innerHTML = loader_html;
	// position the window
	document.getElementById('tooltip_ajax').style.top = (offset[1]+parseFloat(offsetDistance))+'px';
	document.getElementById('tooltip_ajax').style.left = (offset[0]+parseFloat(offsetDistance))+'px';
	// display the window
	document.getElementById('tooltip_ajax').style.display = 'inline';
	// pull the content through ajax call
	ajaxpage('/ajax_tooltip.php?do=listing&listingid='+listingId, 'tooltip_ajax');
}

function tooltip_url(containerId, thumbUrl, offsetDistance)
{
	// determine the offset
	var offset = findPos(document.getElementById(containerId));
	// preloader image
	document.getElementById('tooltip_ajax').innerHTML = loader_html;
	// position the window
	document.getElementById('tooltip_ajax').style.top = (offset[1]+parseFloat(offsetDistance))+'px';
	document.getElementById('tooltip_ajax').style.left = (offset[0]+parseFloat(offsetDistance))+'px';
	// display the window
	document.getElementById('tooltip_ajax').style.display = 'inline';
	// pull the content through ajax call
	ajaxpage('/ajax_tooltip.php?url='+thumbUrl, 'tooltip_ajax');	
}

function tooltip_warn(containerId, thumbUrl, offsetDistance)
{
	// determine the offset
	var offset = findPos(document.getElementById(containerId));
	// preloader image
	document.getElementById('tooltip_ajax').innerHTML = loader_html;
	// position the window
	document.getElementById('tooltip_ajax').style.top = (offset[1]+parseFloat(offsetDistance))+'px';
	document.getElementById('tooltip_ajax').style.left = (offset[0]+parseFloat(offsetDistance))+'px';
	// display the window
	document.getElementById('tooltip_ajax').style.display = 'inline';
	// pull the content through ajax call
	ajaxpage('/ajax_tooltip.php?warn&url='+thumbUrl, 'tooltip_ajax');	
}

function tooltip_calendar(containerId, calendarId, offsetDistance)
{
	// determine the offset
	var offset = findPos(document.getElementById(containerId));
	// preloader image
	document.getElementById('tooltip_ajax').innerHTML = loader_html;
	// position the window
	document.getElementById('tooltip_ajax').style.top = (offset[1]+parseFloat(offsetDistance))+'px';
	document.getElementById('tooltip_ajax').style.left = (offset[0]+parseFloat(offsetDistance))+'px';
	// display the window
	document.getElementById('tooltip_ajax').style.display = 'inline';
	// pull the content through ajax call
	ajaxpage('/ajax_tooltip.php?calendarid='+calendarId, 'tooltip_ajax');	
}

function tooltip_off()
{
	document.getElementById('tooltip_ajax').style.display = 'none';	
}