var ie  = document.all
var ns6 = document.getElementById&&!document.all
var stckptr = -1;
var stck = new Array();
var remobj = null;
var docobj = null;
var pobj = null;
var onclck = 0;
var dynamic = 0;

function get_email(str1, str2)
{
  return "mailto:"+str2+str1+"?subject=XEntrant - "
}

function LoadInit()
{
  dobj = document.getElementById("dyn");
  dobj.style.display = "";
  sobj = document.getElementById("sta");
  sobj.style.display = "none";
  if (docobj != null) docobj.style.display = "none";
  docobj = document.getElementById("dmHome");
  docobj.style.display = "";
  if (pobj != null) pobj.style.display = "none";
  pobj = document.getElementById("pHome");
  pobj.style.display = "";
//  if (ns6) {
  wheight = document.body.clientHeight + 147;
  wwidth = document.body.clientWidth;
//  } else {
//    wheight = top.window.outerHeight;
//	wwidth = top.window.outerWidth;
//  }
  mrg = 160;
  pwdth = 800;
  wdth = 2 * mrg + pwdth;
  dchght = 600;
  whght = dchght + 200 + 147;
  dchghtdf = 0;
  //alert(wheight+" "+wwidth+" "+wdth);
  if (wwidth < wdth)
  {
    //alert(mrg);
    if (screen.width < wdth)
	{
	  mrg = (screen.width - pwdth)/2;
	  //alert(mrg);
	}
  }
  wdth = 2 * mrg + pwdth;
  if (wheight < whght)
  {
    if (screen.height < whght)
	{
	  dchghtdf = whght - screen.height;
	  dchght = dchght - dchghtdf;
	  whght = screen.height;
	}
  }

  hdr2obj = document.getElementById("hdr2")
  cprobj = document.getElementById("cprght")
  //alert(hdr2obj.style.pixelTop+" "+dchghtdf+" "+whght);
  if (ns6)
  {
    document.getElementById("hdr").style.left = mrg;
    hdr2obj.style.left = mrg;
    cprobj.style.left = mrg;
	document.getElementById("start").style.left = mrg;
	
	hdr2obj.style.top = 740 - dchghtdf + 18;
	cprobj.style.top = 770 - dchghtdf + 5;
	//alert(hdr2obj.style.top+" !"+cprobj.style.top+" ?"+dchghtdf);
  } else
  {
    document.getElementById("hdr").style.pixelLeft = mrg;
    hdr2obj.style.pixelLeft = mrg;
    cprobj.style.pixelLeft = mrg;
	document.getElementById("start").style.pixelLeft = mrg;
	
	hdr2obj.style.pixelTop = 740 - dchghtdf;
	cprobj.style.pixelTop = 770 - dchghtdf;
  }
  setElementLeftByClass('wpath', mrg);
  setElementLeftByClass('prdctb', mrg);
  
  setElementHghtByClass('prdctb', dchght)
  setElementHghtByClass('rghtdv', dchght)
  //setElementHghtByClass('rghtdv', dchght-20)
//  window.moveTo(0,0);
  window.resizeTo(wdth, whght);
}

function switchMode()
{
  if (dynamic == 0) {
    dynamic = 1;
	dobj = document.getElementById("dyn");
	dobj.style.display = "none";
	sobj = document.getElementById("sta");
	sobj.style.display = "";
  } else {
    dynamic = 0;
	sobj = document.getElementById("sta");
	sobj.style.display = "none";
	dobj = document.getElementById("dyn");
	dobj.style.display = "";
  }
}
function setElementLeftByClass(clnm, mrg)
{
  obj = document.body.getElementsByTagName('*');
  for (var i=0; i < obj.length; i++) {
    if ( obj[i].className == clnm ) {
	  if (ns6) {
        obj[i].style.left = mrg;
	  } else {
	    obj[i].style.pixelLeft = mrg;
	  }
    }
  }
}

function setElementHghtByClass(clnm, hght)
{
  obj = document.body.getElementsByTagName('*');
  for (var i=0; i < obj.length; i++) {
    if ( obj[i].className == clnm ) {
	  if (ns6) {
        obj[i].style.height = hght;
	  } else {
	    obj[i].style.pixelHeight = hght;
	  }
    }
  }
}

function  ItemMenuPopup(parmenu, paritm, menudiv)
{
  parobj = document.getElementById(paritm);
  mnobj = document.getElementById(menudiv);
  pmnobj = document.getElementById(parmenu);
  removerest(parmenu);
  myclearTimeout();
  if (menudiv != "")
  {
  if (parmenu == "start")
  {
    lft = pmnobj.offsetLeft+parobj.offsetLeft;
    tp = pmnobj.offsetTop+parobj.offsetTop+parobj.offsetHeight;
  } else
  {
    lft = pmnobj.offsetLeft+parobj.offsetLeft+parobj.offsetWidth;
    tp = pmnobj.offsetTop+parobj.offsetTop;
	//alert(document.body.scrollTop);
  }
  if (ns6)
  {
    mnobj.style.left = lft;
    mnobj.style.top = tp;
  } else
  {
    mnobj.style.pixelLeft = lft;
    mnobj.style.pixelTop = tp;
  }
  mnobj.style.display = "";
  stackin(menudiv);
  }
  if (dynamic == 1) {
    if (onclck == 0)
    {
      if (docobj != null) docobj.style.display = "none";
      docobj = document.getElementById("dm"+paritm)
      if (docobj != null) docobj.style.display = "";
      if (pobj != null) pobj.style.display = "none";
      pobj = document.getElementById("p"+paritm);
      if (pobj != null)
      {
        pobj.style.display = "";
      }
    }
  }
  return true ;
}

function ItemMenuClick(parmenu, paritm, menudiv)
{
  if (dynamic == 0) {
  if (docobj != null) docobj.style.display = "none";
  docobj = document.getElementById("dm"+paritm)
  if (docobj != null) docobj.style.display = "";
  if (pobj != null) pobj.style.display = "none";
  pobj = document.getElementById("p"+paritm);
  if (pobj != null)
  {
    pobj.style.display = "";
  }
  } else {
  if (onclck == 0)
  {
    onclck = 1;
  } else
  {
    onclck = 0;
    ItemMenuPopup(parmenu, paritm, menudiv);
  }
  }
}

function PathClick(itmname)
{
  if (docobj != null) docobj.style.display = "none";
  docobj = document.getElementById("dm"+itmname);
  docobj.style.display = "";
  if (pobj != null) pobj.style.display = "none";
  pobj = document.getElementById("p"+itmname);
  if (pobj != null)
  {
    pobj.style.display = "";
  }
}

function ItemMenuHide(menudiv)
{
  if (menudiv != "")
  {
    if(document.getElementById(menudiv).style.display == "")
    {
      remobj = document.getElementById(menudiv);
    }
  }
  setremove=setTimeout("removemenu()",250);
  return true ;
}

function myclearTimeout()
{
  if (typeof setremove != "undefined") clearTimeout(setremove);
}

function removetopmenu()
{
  if (remobj != null)
  {
    if (remobj == document.getElementById(stck[stckptr]))
    {
      remobj.style.display = "none";
      stackout();
      remobj = null;
    }
  }
}

function removemenu()
{
  for (ptr = stckptr; ptr > -1; ptr--) {
    if (remobj == null) remobj = document.getElementById(stck[stckptr]);
    removetopmenu();
  }
  if (dynamic == 1) {
    onclck = 0;
  }
}

function removerest(menudiv)
{
  for (ptr = stckptr; ptr > -1; ptr--) {
    if (remobj == null) remobj = document.getElementById(stck[stckptr]);
    if (stck[stckptr] != menudiv)
    {
      removetopmenu();
    } else return true;
  }
  return true;
}

function stackin(menudiv)
{
  stckptr = stckptr + 1;
  stck[stckptr] = menudiv;
}

function stackout()
{
  stck[stckptr] = "";
  stckptr = stckptr - 1;
}
