/*
Copyright (C) 2010,2011 Jan Vorel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Any questions, suggestions or bug reports welcome: info@ctuser.net
*/

function CTCMSEx_InitComboPopup(xObjBaseName)
{
  var xObj1;
  var xObj2;
  var xObj3;
  
  xObj1 = document.getElementById(xObjBaseName + 'pnt');
  if (xObj1)
  {
    xObj2 = document.getElementById(xObjBaseName + 'cur');
    if (xObj2)
    {
      if (navigator.appName == 'Microsoft Internet Explorer')
      {
        re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(navigator.userAgent) != null)
          rv = parseFloat( RegExp.$1 );
        if (rv < 7)
          xObj2.style.border = '0px';
      }
    }
    xObj3 = document.getElementById(xObjBaseName + 'all');
    if (xObj3)
    {
//      if (xObj1.width < xObj3.offsetWidth)
//        xObj1.width = xObj3.offsetWidth;
/*
      if (xObj2)
      {
alert(xObj2.offsetLeft);
        xObj1.left = xObj2.offsetLeft;
        xObj1.top = xObj2.offsetTop;
      }
*/
    }
  }
}

function CTCMSEx_ShowComboPopup(xObjBaseName)
{
  var xObj1;
  var xObj2;
  
  xObj1 = document.getElementById(xObjBaseName + 'cur');
  if (xObj1)
  {
    xObj2 = document.getElementById(xObjBaseName + 'all');
    if (xObj2)
    {
      xObj2.style.visibility = 'visible';
    }
  }
}

function CTCMSEx_HideComboPopup(xAnyObject, e)
{
  var ex;
  if (xAnyObject)
  {
    if (!e)
      var e = window.event;
    var tg = (e) ? e.srcElement : e.target;
    tg = (e.relatedTarget) ? e.relatedTarget : e.toElement;

    while (tg)
    {
      if (tg == xAnyObject)
        return;
      tg = tg.parentNode;
    }
    xAnyObject.style.visibility = 'hidden';
  }
}

