﻿// @TRONC /Kaley/Kaley.MessageBox.js

var idTimeoutMessageBox = null;
var MessageBoxShowed = false;

function ShowMessageBox(text, type){
  if (idTimeoutMessageBox!=null)
    window.clearTimeout(idTimeoutMessageBox);
    
  if (MessageBoxShowed)
    HideMessageBox();
    
  var msgBox = document.getElementById('msgBox');
  var msgBoxIcon = document.getElementById('msgBoxIcon');
  var msgBoxText = document.getElementById('msgBoxText');
  if (type==0)
    msgBoxIcon.style.backgroundImage = "url(/pics.aspx?img=messagebars&rect=0x51x37x41)";
    else
  if (type==1)
    msgBoxIcon.style.backgroundImage = "url(/pics.aspx?img=messagebars&rect=0x0x37x41)";
    else
  if (type==2)
    msgBoxIcon.style.backgroundImage = "url(/pics.aspx?img=messagebars&rect=0x102x37x41)";
  //msgBox.style.width = document.body.clientWidth-201;
  msgBox.style.height = "0px";
  msgBox.style.display = "block";
  if (msgBox.tmr!=null)
    window.clearInterval(msgBox.tmr);
  if (msgBox.z==null) 
    msgBox.z = 0;   
   
  HideDropDowns(); 
    
  msgBoxText.innerHTML = text;  
     
  msgBox.tmr = window.setInterval("_ShowMessageBox()", 10);
  MessageBoxShowed = true;
}


function HideMessageBox(){
  if (msgBox.tmr!=null)
    window.clearInterval(msgBox.tmr);
  msgBox.tmr = window.setInterval("_HideMessageBox()", 10);
}
 
 
function _ShowMessageBox(){
    var msgBox = document.getElementById('msgBox');
    if (msgBox == null) return;
    msgBox.z += 2;
    msgBox.style.height = msgBox.z + "px";
    if (msgBox.z>=41) { 
      window.clearInterval(msgBox.tmr);
      msgBox.tmr = null;
      msgBox.style.height = "41px";
      idTimeoutMessageBox = window.setTimeout("HideMessageBox()",4000);
    }
  
}


function _HideMessageBox(){
    var msgBox = document.getElementById('msgBox');
    if (msgBox == null) return;
  msgBox.z -= 2;
  msgBox.style.height = Math.max(0, msgBox.z) + "px";
  if (msgBox.z<=0) { 
    window.clearInterval(msgBox.tmr);
    msgBox.tmr = null;
    msgBox.style.height = "0px";
    msgBox.style.display = "none";
    ShowDropDowns();
    MessageBoxShowed = false;
  }
}

function ShowDropDowns(){
  if (!IsIe6()) return;
  var drp = document.getElementById("ctl00_DrpSearch");
  if (drp!=null)
    drp.style.display = "inline";
}

function HideDropDowns(){
  if (!IsIe6()) return;
  var drp = document.getElementById("ctl00_DrpSearch");
  if (drp!=null)
    drp.style.display = "none";
}

function IsIe6(){ 
  return (  
     (navigator.appName=="Microsoft Internet Explorer") &&
     (parseInt(navigator.appVersion)<=6)
         );
}

function IsIe(){ 
  return (navigator.appName=="Microsoft Internet Explorer");
}