﻿function MenuHover(obj)
{
  obj.parentNode.style.backgroundImage="url('/images/MMenu_02.gif')";
}

function MenuUnhover(obj)
{
  obj.parentNode.style.backgroundImage="url('/images/MMenu_01.gif')";
}

function MenuHover2(obj)
{
  obj.parentNode.style.backgroundImage="url('/images/MMenu_02(2).gif')";
}

function MenuUnhover2(obj)
{
  obj.parentNode.style.backgroundImage="url('/images/MMenu_01(2).gif')";
}

var mnuTimeoutID1 = null;
function MenuRollout1(objname)
{
   var obj = WebForm_GetElementById(objname);
   var _height = obj.scrollHeight;
   if (obj.offsetHeight >= _height) 
   {
     mnuTimeoutID1 = null;
     return;
   }
   obj.style.height = Math.min(obj.offsetHeight + Math.round(_height/8), _height) + 'px';
   if (mnuTimeoutID1 != null) window.clearTimeout(mnuTimeoutID1);
   mnuTimeoutID1 = window.setTimeout("MenuRollout1('" + objname + "')", 15);
}

function MenuRollin1(objname)
{
   var obj = WebForm_GetElementById(objname);
   if (obj.offsetHeight == 0) 
   {
     obj.style.display = 'none';
     mnuTimeoutID1 = null;
     return;
   }  
   obj.style.height = Math.max(obj.offsetHeight - Math.round(obj.scrollHeight/8), 0) + 'px';
   if (mnuTimeoutID1 != null) window.clearTimeout(mnuTimeoutID1);
   mnuTimeoutID1 = window.setTimeout("MenuRollin1('" + objname + "')", 15);
}

var mnuTimeoutID2 = null;
function MenuRollout2(objname)
{
   var obj = WebForm_GetElementById(objname);
   var _height = obj.scrollHeight;
   if (obj.offsetHeight >= _height) 
   {
     mnuTimeoutID2 = null;
     return;
   }
   obj.style.height = Math.min(obj.offsetHeight + Math.round(_height/8), _height) + 'px';
   if (mnuTimeoutID2 != null) window.clearTimeout(mnuTimeoutID2);
   mnuTimeoutID2 = window.setTimeout("MenuRollout2('" + objname + "')", 15);
}

function MenuRollin2(objname)
{
   var obj = WebForm_GetElementById(objname);
   if (obj.offsetHeight == 0) 
   {
     obj.style.display = 'none';
     mnuTimeoutID2 = null;
     return;
   }  
   obj.style.height = Math.max(obj.offsetHeight - Math.round(obj.scrollHeight/8), 0) + 'px';
   if (mnuTimeoutID2 != null) window.clearTimeout(mnuTimeoutID2);
   mnuTimeoutID2 = window.setTimeout("MenuRollin2('" + objname + "')", 15);
}

var mnuTimeoutID3 = null;
function MenuRollout3(objname)
{
   var obj = WebForm_GetElementById(objname);
   var _height = obj.scrollHeight;
   if (obj.offsetHeight >= _height) 
   {
     mnuTimeoutID3 = null;
     return;
   }
   obj.style.height = Math.min(obj.offsetHeight + Math.round(_height/8), _height) + 'px';
   if (mnuTimeoutID3 != null) window.clearTimeout(mnuTimeoutID3);
   mnuTimeoutID3 = window.setTimeout("MenuRollout3('" + objname + "')", 15);
}

function MenuRollin3(objname)
{
   var obj = WebForm_GetElementById(objname);
   if (obj.offsetHeight == 0) 
   {
     obj.style.display = 'none';
     mnuTimeoutID3 = null;
     return;
   }  
   obj.style.height = Math.max(obj.offsetHeight - Math.round(obj.scrollHeight/8), 0) + 'px';
   if (mnuTimeoutID3 != null) window.clearTimeout(mnuTimeoutID3);
   mnuTimeoutID3 = window.setTimeout("MenuRollin3('" + objname + "')", 15);
}

function IsInMenu(e, obj1, obj2)
{
  var parentobj = WebForm_GetElementById(obj1);
  var parentobj2 = WebForm_GetElementById(obj2);
  var p = e.relatedTarget;
  if (p == null) p = e.toElement;
  if (p == null) return false;
  while (p != null)
  {
    if (p == parentobj) return true;
    if (p == parentobj2) return true;
    if ((p.className != null) 
      && (p.className == 'menuhdr')) return true;
	  p = p.parentNode;
  }
  return false;
}

function DoProdOut(e)
{
  if (IsInMenu(e, 'menuProducts', 'tdProducts')) return;
  var obj = WebForm_GetElementById(imgProduct);
  obj.src = '/images/Maket_11(2).jpg';
  MenuRollin1('menuProducts'); 
}

function DoProdIn(e)
{
  var m = WebForm_GetElementById('menuProducts');
  if (m.style.display == '') return;
  var obj = WebForm_GetElementById(imgProduct);
  obj.src = '/images/Maket_11(2act).jpg';
  m.style.display = '';
  var coord = WebForm_GetElementPosition(WebForm_GetElementById('tdProducts'));
  m.style.top = (coord.y + coord.height) + 'px';
  m.style.left = coord.x + 'px';
  MenuRollout1('menuProducts'); 
}

function DoDownOut(e)
{
  if (IsInMenu(e, 'menuDownload', 'tdDownload')) return;
  var obj = WebForm_GetElementById(imgDownload);
  obj.src = '/images/Maket_11(4).jpg';
  MenuRollin2('menuDownload'); 
}

function DoDownIn(e)
{
  var m = WebForm_GetElementById('menuDownload');
  if (m.style.display == '') return;
  var obj = WebForm_GetElementById(imgDownload);
  obj.src = '/images/Maket_11(4act).jpg';
  m.style.display = '';
  var coord = WebForm_GetElementPosition(WebForm_GetElementById('tdDownload'));
  m.style.top = (coord.y + coord.height) + 'px';
  m.style.left = coord.x + 'px';
  MenuRollout2('menuDownload'); 
}

function DoSupOut(e)
{
  if (IsInMenu(e, 'menuSupport', 'tdSupport')) return;
  var obj = WebForm_GetElementById(imgSupport);
  obj.src = '/images/Maket_11(6).jpg';
  MenuRollin3('menuSupport'); 
}

function DoSupIn(e)
{
  var m = WebForm_GetElementById('menuSupport');
  if (m.style.display == '') return;
  var obj = WebForm_GetElementById(imgSupport);
  obj.src = '/images/Maket_11(6act).jpg';
  m.style.display = '';
  var coord = WebForm_GetElementPosition(WebForm_GetElementById('tdSupport'));
  m.style.top = (coord.y + coord.height) + 'px';
  m.style.left = coord.x + 'px';
  MenuRollout3('menuSupport'); 
}

function LngSelectIn(e)
{
  var m = WebForm_GetElementById('lngselector');
  m.style.backgroundImage="url('/images/Maket_05(10_).jpg')";
  m = WebForm_GetElementById(lngselectbtn_);
  m.style.display = '';
  m = WebForm_GetElementById(lblLangSelector);
}

function LngSelectOut(e)
{
  if (IsLangListActive()) return;
  if (!IsInMenu(e, 'tblLangSelect', 'lngselector_td')) DoLngSelectOut();
}

function DoLngSelectOut()
{
  var m = WebForm_GetElementById('lngselector');
  m.style.backgroundImage="url('/images/Maket_05(10).jpg')";
  m = WebForm_GetElementById(lngselectbtn_);
  m.style.display = 'none';
  m = WebForm_GetElementById(lblLangSelector);
}

function ShowLangList(e)
{
  var m = WebForm_GetElementById('tblLangSelect');
  var coord = WebForm_GetElementPosition(WebForm_GetElementById(lngselectbtn_));
  m.style.top = (coord.y + coord.height) + 'px';
  m.style.left = (coord.x + coord.width - 97) + 'px';
  m.style.display = '';
  e.cancelBubble = true;
  document.onclick = DoClickLangPanel;
  window.onresize = DoClickLangPanel;
}

function DoSearchIn()
{
  if (IsLangListActive()) return;
  var m = WebForm_GetElementById(searchicon_);
  m.src='/images/Maket_05(8act).jpg';
  m = WebForm_GetElementById('searchtbl');
  m.style.display = '';
  m = WebForm_GetElementById('searchtext');
  m.focus();
}

function DoSearchOut(e)
{
  if (IsInMenu(e, searchicon_, 'searchdiv')) return;
  var m = WebForm_GetElementById(searchicon_);
  m.src='/images/Maket_05(8).jpg';
  m = WebForm_GetElementById('searchtbl');
  m.style.display = 'none';
  m = WebForm_GetElementById('searchtext');
  m.blur();
}

function DoClickLangPanel(e)
{
  document.onclick = null;
  window.onresize = null;
  var m = WebForm_GetElementById('tblLangSelect');
  m.style.display='none'; 
  DoLngSelectOut();
}  

function IsLangListActive()
{
  var m = WebForm_GetElementById('tblLangSelect');
  return (m.style.display == '');
}

function DoSearch()
{
  var m = WebForm_GetElementById('searchtext');
  if (m.value == '') return;
  window.location.href='http://www.google.com/search?ie=UTF-8&oe=UTF-8&btnG=Search&sitesearch=' + 
    encodeURI('http://www.radar-soft.com') + '&q=' + encodeURI(m.value);
}

function showfullbrief()
{
  var f = WebForm_GetElementById('_full');
  var b = WebForm_GetElementById('_brief');
  var isBrief = (b.style.display=='none');
  if (isBrief)
  {
    f.style.display='none';
    b.style.display='';
  }
  else
  {
    b.style.display='none';
    f.style.display='';
  }
}