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

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

  var current_company_uid = -1;
  var currentCompanyMPTimeOut = -1;
  var mini_company_profile_div;
  var display_companyMP_left = false;

  function mini_company_profile_mouse_over(company_uid, group_uid, target_anchor_name, display_companyMP_left_option)
  {
    //alert("mouse over:"+company_uid+" current_company_uid="+current_company_uid);
    //alert(target_anchor_name);
	if (currentCompanyMPTimeOut!=-1) clearTimeout(currentCompanyMPTimeOut);
	if (current_company_uid!=company_uid)
	{
	  var pos = getAnchorPosition(target_anchor_name);
	  var x = pos.x;
	  var y = pos.y;

	  currentCompanyMPTimeOut = setTimeout('open_mini_company_profile('+company_uid+','+group_uid+','+x+','+y+');', 1000);
	}
	
	
	if (display_companyMP_left_option)
	  display_companyMP_left = true;
	else
	  display_companyMP_left = false;
	
  }
  
  function mini_company_profile_mouse_out(company_uid)
  {
    //alert("mouse out"+company_uid);
	if (currentCompanyMPTimeOut!=-1) clearTimeout(currentCompanyMPTimeOut);
	if (current_company_uid==company_uid)
	  currentCompanyMPTimeOut = setTimeout('close_mini_company_profile('+company_uid+');', 1000);
  }
  
  function mini_company_profile_stop_timer()
  {
    //alert("stop timer");
	if (currentCompanyMPTimeOut!=-1) clearTimeout(currentCompanyMPTimeOut);
  }
  
  
  function open_mini_company_profile(company_uid, group_uid, x, y)
  {
    //alert("open mini company_uid=["+company_uid+"] x=["+x+"] y=["+y+"]");
	
	// Was one already opened ?
	if (current_company_uid!=-1) close_mini_company_profile(current_company_uid);
	  
	clearTimeout(currentCompanyMPTimeOut);
	currentCompanyMPTimeOut = -1;
	current_company_uid = company_uid;
	
	mini_company_profile_div = document.createElement('div');
    mini_company_profile_div.setAttribute('id', 'mini_company_profile');
   
    mini_company_profile_div.style.width = 335 + "px";
    mini_company_profile_div.style.height = 375 + "px";
    mini_company_profile_div.style.position = "absolute";
	
	var display_companyMP_left_int;
	if (!display_companyMP_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_company_profile_div.style.background = "transparent url(" + http_root2 + "templates/images/bg_mini_profile_noshadows.png) no-repeat";
		else
		  mini_company_profile_div.style.background = "transparent url(" + http_root2 + "templates/images/bg_mini_profile.png) no-repeat";
		//mini_company_profile_div.style.background = "#000000";
		display_companyMP_left_int = 0;
		
		
        mini_company_profile_div.style.left = x + 5 + "px";
        mini_company_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_company_profile_div.style.background = "transparent url(" + http_root2 + "templates/images/bg_mini_profile_left_noshadows.png) no-repeat";
		else
		  mini_company_profile_div.style.background = "transparent url(" + http_root2 + "templates/images/bg_mini_profile_left.png) no-repeat";
		//mini_company_profile_div.style.background = "#000000";
		display_companyMP_left_int = 1;
		
		mini_company_profile_div.style.left = x - 335 + "px";
        mini_company_profile_div.style.top = y - 74 + "px";
	}

    document.body.appendChild(mini_company_profile_div);
	
	
	// Ajax content :
	var currentTime = new Date();
    var url = http_root2 + 'include/ajax/ajax_mini_company_profile.php?company_uid='+company_uid+'&group_uid='+group_uid+'&display_companyMP_left='+display_companyMP_left_int+'&t='+currentTime.getTime();
    var updater1 = new Ajax.Updater('mini_company_profile', url, { method: 'get' });
  }
  
  function close_mini_company_profile(company_uid)
  {
    //alert("close "+company_uid);
	clearTimeout(currentCompanyMPTimeOut);
	currentCompanyMPTimeOut = -1;
	current_company_uid = -1;
	document.body.removeChild(mini_company_profile_div);
  }




  // Utilities : get anchor position
  // -------------------------------
  
  // --> see mini_profile.js
  
  

