/**
 * contextmenu
 * 
 * Função usada para mostrar um hint para links e etc...
 */
function contextmenu(str,show,e,x,y,maxwidth)
{
	var id_div = 'contextmenudiv';

	var factor = 23;
	if(!e) e = event;
	
	if(!document.getElementById(id_div))
	{
		div = document.createElement("div");
		div.setAttribute('id',id_div);
		document.body.appendChild(div);
	}
	
	document.getElementById(id_div).innerHTML = str;
	if(maxwidth && document.getElementById('contextmenudiv').offsetWidth > maxwidth)
	{
		document.getElementById('contextmenudiv').style.width = maxwidth+'px';
	}
	
	var scroll_top = 0, scroll_left = 0;

	scroll_top = (!isNaN(window.scrollY))?window.scrollY:document.documentElement.scrollTop;
	scroll_left = (!isNaN(window.scrollX))?window.scrollX:document.documentElement.scrollLeft;
	iw = (window.innerWidth)?window.innerWidth:document.documentElement.clientWidth;
	ih = (window.innerHeight)?window.innerHeight:document.documentElement.clientHeight;
	
	if(document.documentElement.scrollLeft)
	scroll_left = document.documentElement.scrollLeft;
	else if(window.scrollX)
	scroll_left = window.scrollX;
	
	xp = e.clientX + scroll_left + 10;
	yp = e.clientY + scroll_top;
	
	$(id_div).style.display = '';
	var div_height = $(id_div).offsetHeight;
	var div_width = $(id_div).offsetWidth;
	
	if(xp + div_width > iw)
		xp = iw - (div_width+10);
	if(yp + div_height > ih + scroll_top)
		yp = (ih+scroll_top) - (div_height+10);
	
	if(!isNaN(x)) xp = x;
	if(!isNaN(y)) yp = y;
	
	document.getElementById(id_div).style.top = yp+'px';
	document.getElementById(id_div).style.left = xp+'px';
	
	if(show == 'off')
	{
		document.getElementById(id_div).style.display = 'none';
	}
	if(show == 'on')
	{
		document.getElementById(id_div).style.display = '';
	}
}

function popup_window(url, sizex, sizey)
{
	if(!sizey) sizey = '600';
	if(!sizex) sizex = '800';
	dateobject = new Date();
	jan = window.open(url,"win"+dateobject.getTime(),'width='+sizex+',height='+sizey+',scrollbars=yes,resizable=no,location=no,directories=no,status=no,menubar=yes,top=150,left=150');
}


function fontup(option)
{
	if(option == 1)
	{
		document.getElementById('container').style.fontSize = '10px';
	}
	else if(option == 2)
	{
		document.getElementById('container').style.fontSize = '12px';
	}
	else if(option == 3)
	{
		document.getElementById('container').style.fontSize = '14px';
	}
}





