﻿
IE4 = document.all;

function newConfirm(title,mess,icon,defbut,mods) {
   if (IE4) {
      icon = (icon==0) ? 0 : 2;
      defbut = (defbut==0) ? 0 : 1;
      retVal = makeMsgBox(title,mess,icon,4,defbut,mods);
      retVal = (retVal==6);
   }
   else {
      retVal = confirm(mess);
   }
   return retVal;
}

var browserName=navigator.appName;

function showWindow(url){
    if (browserName=="Netscape")
    {
        window.open(url,"Link","toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1");
    }
    else
    {
        if (browserName=="Microsoft Internet Explorer")
        {
            window.open(url,"Link","toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1");
        }
    }
   }
   
function showControlledWindow(url){
    if (browserName=="Netscape")
    {
        window.open(url,"Link","toolbar=0,location=0,height=600,width=800,directories=0,status=1,menubar=0,scrollbars=1,resizable=1");
    }
    else
    {
        if (browserName=="Microsoft Internet Explorer")
        {
            window.open(url,"Link","toolbar=0,height=600,width=800,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1");
        }
    }
   }
   
   function findDiv(elem)
{
    for(i=0;i<elem.childNodes.length;i++)
    {
        if (elem.childNodes[i].className=='menuContainer')
        {
          return  elem.childNodes[i];
        }
    }

}

function showSub(elem)
{
  var contentDiv = findDiv(elem);
  
   var container = document.getElementById('MainMenu');
    contentDiv.style.position='absolute';
    
    //if ie7 - make offset +15
    contentDiv.style.top =elem.offsetHeight;
    contentDiv.style.display='block';

    var left= (elem.offsetLeft + (elem.clientWidth /2)) - (contentDiv.clientWidth /2) +'px';
   
    left = left.replace('px','')
    var right;

  
   //alert(left); - 75
   


    if (left > 0)
    {
        //make sure it fits into the RHS
        right = parseFloat(left) + parseFloat(contentDiv.clientWidth);
        //alert(right);
        
        if (right > (0 + container.clientWidth))
        {
            //move it backward
            var difference  = right - (0 + container.clientWidth);
           left = left - difference - 8;
       
        }
    }
    else
    {
        //bump if left to fit inside the container
  
        left = 0;
    }
    contentDiv.style.left =parseFloat(left)+parseFloat(5)+'px' ;

    
}

function hideSub(elem)
{
    var contentDiv  =findDiv(elem);
    contentDiv.style.display='none';
}

