var xmlhttp;

function show_consultant_balloon(e, consultant_id, cat_id) {
	
	var isIE = document.all?true:false;
	  var _x;
	  var _y;
	  if (!isIE) {
		_x = e.pageX;
		_y = e.pageY;
	  }
	  if (isIE) {
		_x = event.clientX + document.body.scrollLeft;
		_y = event.clientY + document.body.scrollTop;
	  }

		posX=_x - 43;
		posY=_y - 235;

	document.getElementById("consultant_balloon").innerHTML="";
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null)
	  {
	  return;
	  }
	var url= wwwroot + "/extensions/konsultandid/consultant_hint.php?id=" + scms_id + "&consultant_id=" + consultant_id + "&cat_id=" + cat_id + "&lang=" + lang + "";
	url=url+"&sid="+Math.random();
	xmlhttp.onreadystatechange=ball_content;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);

	document.getElementById("consultant_balloon").style.display='block';
	document.getElementById("consultant_balloon").style.left=posX+'px';
	document.getElementById("consultant_balloon").style.top=posY+'px';

}

function hide_balloon() {
	var elem = document.getElementById("consultant_balloon");
	elem.style.display='none';
}

function set_clicked() {
}

function ball_content()
{
if (xmlhttp.readyState==4)
  {
  document.getElementById("consultant_balloon").innerHTML=xmlhttp.responseText;
  }
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}



function Opener(e, url, width, height, scroll)	{

	var x=y=0;
    y = e.clientY;
	x = e.clientX;

	var sc_X = sc_Y = 0;

	scX = screen.Width;
	scY = screen.Height;

	var OS_top = 0;
	OS_top = Number(height) + Number(y) + 40;

	var OS_right = 0;
	OS_right = Number(width) + Number(x) + 40;


	if(OS_top > scY) {
	
		new_y = Number(scY) - Number(height);
		y = new_y - 70;
	}

	if(OS_right > scX) {
	
		new_x = Number(scX) - Number(width);
		x = new_x - 70;
	}

	newwin=window.open(url, "", "left=" + x + ", top=" + y + ", toolbar=no, menubar=no, location=no, scrollbars=" + scroll + ", resizable=yes, width=" + width + ", height=" + height);

}

function confirm_action(where, msg, newwindow)	{

	input_box=confirm(msg);
				
	if (input_box==true)	{
		
		if(newwindow == 1)	window.open(where);  
		else				window.location.href=where;
	
	}

}

