/************************************************************************************************************
Ajax tooltip


************************************************************************************************************/ 

    var question_type; 
  /* Custom variables */
  
  /* Offset position of tooltip */
  var x_offset_tooltip = 5;
  var y_offset_tooltip = 0;
  
  /* Don't change anything below here */
  
  
  var group_tooltipObj = false;
  var group_tooltipObj_iframe = false;
  
  var group_tooltip_MSIE = false;
  
  if(navigator.userAgent.indexOf('MSIE')>=0) 
    group_tooltip_MSIE=true;
  
  // TODO: Same method for Media upload need to change
  // example parameters
  // ('/medias?id=question', this,'camera','poll_question', 1)
  function show_tooltip_window(url, inputObj, type, search_textId, question_t) {
    if(!popup_window){
      popup_window  = true
      // TODO: this question_type var is never used, so we can remove it and all calls 
      // to show_tooltip_window can call with one less parameter
      question_type = question_t;

      if(!group_tooltipObj){ /* Tooltip div not created yet ? */
        window.setTimeout("", 3000);
        group_tooltipObj = document.createElement('DIV');
      }

      group_positionTooltip(inputObj,type);
      group_tooltipObj.style.position   = 'absolute';
      group_tooltipObj.style.visibility = 'visible';
      group_tooltipObj.style.display    = 'block';
      group_tooltipObj.className        = 'more_info_pop';
      group_tooltipObj.setAttribute('id','more_info_pop');
      document.body.appendChild(group_tooltipObj);
      $('more_info_pop').update('')
      
      ajax_loadContent('more_info_pop', url, search_textId, inputObj);

    }
  }
  
  function group_positionTooltip( obj,type ){
    position =  Position.cumulativeOffset( obj )   
/* fOR TOOL TIP WINDOW, WIll DISPLAY ON TOP OF CLICKED ELEMENT*/
    if( type == "tool_tip" ){
      group_tooltipObj.style.left = position[0] + 50 +  "px"
      group_tooltipObj.style.top =  position[1] - 180 +"px"
    }else{
/* FOR MEDIA WINDOW, DOWN TO CLICKED WINDOW */
      group_tooltipObj.style.left = position[0] - 215 + "px"
      group_tooltipObj.style.top =  position[1] + 20 + "px"
    }
  }
  
  function group_hideTooltip() {
    if(group_tooltipObj)
      group_tooltipObj.style.display='none';
    popup_window = false;
  }
  
  function groupTooltip_getTopPos(inputObj)
  {   
    var returnValue = inputObj.offsetTop+50;
    while((inputObj = inputObj.offsetParent) != null){
      if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
    }
    return returnValue;
  }
  
  function groupTooltip_getLeftPos(inputObj)
  {
    var returnValue = inputObj.offsetLeft;
    while((inputObj = inputObj.offsetParent) != null){
      if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
    }
    return returnValue;
}

 