var http_root2 = '';
if (typeof(HTTP_ROOT) !='undefined')
	http_root2 = HTTP_ROOT;

  var is_public = 0;
  if (typeof(set_public_mini_profile) !='undefined')
	is_public = set_public_mini_profile;

  
  // Mini profile AJAX management ( !!! prototype MUST be loaded)

  var current_profile_uid = -1;
  var currentTimeOut = -1;
  var mini_profile_div;
  var display_left = false;

  function mini_profile_mouse_over(profile_uid, target_anchor_name, display_left_option, group_name)
  {
    //alert(profile_uid);
    //alert(target_anchor_name);
	if (currentTimeOut!=-1) clearTimeout(currentTimeOut);
	if (current_profile_uid!=profile_uid)
	{
	  var pos = getAnchorPosition(target_anchor_name);
	  var x = pos.x;
	  var y = pos.y;

	  if (group_name)
		  currentTimeOut = setTimeout('open_mini_profile('+profile_uid+','+x+','+y+',\''+group_name+'\');', 1000);
	  else
		  currentTimeOut = setTimeout('open_mini_profile('+profile_uid+','+x+','+y+');', 1000);
	}
	
	
	if (display_left_option)
	  display_left = true;
	else
	  display_left = false;
	
  }
  
  function mini_profile_mouse_out(profile_uid)
  {
    //alert("mouse out"+profile_uid);
	if (currentTimeOut!=-1) clearTimeout(currentTimeOut);
	if (current_profile_uid==profile_uid)
	  currentTimeOut = setTimeout('close_mini_profile('+profile_uid+');', 1000);
  }
  
  function mini_profile_stop_timer()
  {
    //alert("stop timer");
	if (currentTimeOut!=-1) clearTimeout(currentTimeOut);
  }
  
  
  function open_mini_profile(profile_uid, x, y, group_name)
  {
    //alert("open mini profile uid=["+profile_uid+"] x=["+x+"] y=["+y+"]");
	
	// Was one already opened ?
	if (current_profile_uid!=-1) close_mini_profile(current_profile_uid);
	  
	clearTimeout(currentTimeOut);
	currentTimeOut = -1;
	current_profile_uid = profile_uid;
	
	mini_profile_div = document.createElement('div');
    mini_profile_div.setAttribute('id', 'mini_profile');
   
    mini_profile_div.style.width = 335 + "px";
    mini_profile_div.style.height = 375 + "px";
    mini_profile_div.style.position = "absolute";
	
	var display_left_int;
	if (!display_left)
	{
		if (
			 (navigator.appName == 'Microsoft Internet Explorer') && 
			 (navigator.appVersion.indexOf('MSIE 7') == -1) && 
			 (navigator.appVersion.indexOf('MSIE 8') == -1) 
			) // IE < v7.x (+ Maxthon v1.x/v2.x , AOL , ...)
		  mini_profile_div.style.background = "transparent url(" + http_root2 + "templates/images/bg_mini_profile_noshadows.png) no-repeat";
		else
		  mini_profile_div.style.background = "transparent url(" + http_root2 + "templates/images/bg_mini_profile.png) no-repeat";
		//mini_profile_div.style.background = "#000000";
		display_left_int = 0;
		
		
        mini_profile_div.style.left = x + 5 + "px";
        mini_profile_div.style.top = y - 74 + "px";
	}
	else
	{
		if (
			 (navigator.appName == 'Microsoft Internet Explorer') && 
			 (navigator.appVersion.indexOf('MSIE 7') == -1) && 
			 (navigator.appVersion.indexOf('MSIE 8') == -1) 
			) // IE < v7.x (+ Maxthon v1.x/v2.x , AOL , ...)
		  mini_profile_div.style.background = "transparent url(" + http_root2 + "templates/images/bg_mini_profile_left_noshadows.png) no-repeat";
		else
		  mini_profile_div.style.background = "transparent url(" + http_root2 + "templates/images/bg_mini_profile_left.png) no-repeat";
		//mini_profile_div.style.background = "#000000";
		display_left_int = 1;
		
		mini_profile_div.style.left = x - 335 + "px";
        mini_profile_div.style.top = y - 74 + "px";
	}
	
    document.body.appendChild(mini_profile_div);
	
	// Ajax content :
	var currentTime = new Date();
    var url = http_root2 + 'include/ajax/ajax_mini_profile.php?profile_uid='+profile_uid+'&display_left='+display_left_int+'&t='+currentTime.getTime();
	if (group_name)
		url = url + '&group_name=' + group_name;
	if (is_public == 1)
		url = url + '&public=1';
	
    var updater1 = new Ajax.Updater('mini_profile', url, { method: 'get' });
  }
  
  function close_mini_profile(profile_uid)
  {
    //alert("close "+profile_uid);
	clearTimeout(currentTimeOut);
	currentTimeOut = -1;
	current_profile_uid = -1;
	document.body.removeChild(mini_profile_div);
  }


