Menupx = 160; // How many pixels to put the menu from the top of the page.



var bNetscape6     = (document.getElementById&&!document.all);

var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");


NS6 = (document.getElementById&&!document.all);

IE = (document.all);

NS = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4");


/******************************************************************
Anil M Dubey - March 3rd, 2002
MM_reloadPage function reloads window if Nescape navigator ver 4
has been resized.
*******************************************************************/
function MM_reloadPage(init)
{
  //reloads the window if Nav4 resized
  if (init==true)
  with (navigator)
   { if ((appName=="Netscape")&&(parseInt(appVersion)>=4))
      {
        document.MM_pgW=innerWidth;
        document.MM_pgH=innerHeight;
        onresize=MM_reloadPage;
        aSlide();
      }
   }
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
   {
      location.reload();
   }
}

/******************************************************************
Anil M Dubey - March 3rd, 2002
hide function hides the sub menu
*******************************************************************/
function hide(menu, parent) {
  if (document.layers) 
  {
    theMenu = document.layers[menu];
  }
  else if (document.all) 
  {
    theMenu = document.all(menu).style;
  } 
  else if (document.getElementById&&!document.all) 
  {
  theMenu = document.getElementById(menu).style;
  }
  
  if (theMenu.visibility == 'visible') {
     theMenu.visibility = 'hidden';
  } else {
    theMenu.visibility = 'hidden';
  }  
}

/******************************************************************
Anil M Dubey - March 3rd, 2002
showoff function shows the sub menu
*******************************************************************/
function showoff(menu, parent) {
  if (document.layers) 
  {
    theMenu = document.layers[menu];
  } else if (document.all) 
  {
    theMenu = document.all(menu).style;
  } else if (document.getElementById) 
  {
    theMenu = document.getElementById(menu).style;
  }
  
  if (theMenu.visibility == 'visible') 
  {
    theMenu.visibility = 'visible';
  } else {
    theMenu.visibility = 'visible';
  }  
}

/******************************************************************
Anil M Dubey - March 3rd, 2002
Browser function would return browser info in a LeftSlidingMenuObjectect
*******************************************************************/
function Browser(){
	this.ver = navigator.appVersion;
	this.app = navigator.appName;
	this.agt = navigator.userAgent;
	return this
}

/******************************************************************
Anil M Dubey - March 3rd, 2002
set_css_style function sets proper cascading style sheet in MSIE 6
since we do not have a way of kow DPI in earlier version of MSIE
default style sheet is being used
*******************************************************************/
function set_css_style()
{
  if ( navigator.userAgent.indexOf("MSIE 6") > -1 )
  {
   if ( parseInt(screen.deviceYDPI) == 96 )
      {
      document.write('<LINK href="css/normal_style.css" type=text/css rel=stylesheet>')
      }
   if ( parseInt(screen.deviceYDPI)  == 120 )
      {
        document.write('<LINK href="css/largedpi_style.css" type=text/css rel=stylesheet>')
      }
   if ( parseInt(screen.deviceYDPI) > 120)
      {
        document.write('<LINK href="css/verylargedpi_style.css" type=text/css rel=stylesheet>')
      }

  }
 else 
  {
        document.write('<LINK href="css/normal_style.css" type=text/css rel=stylesheet>'); 
  }
}

/******************************************************************
Anil M Dubey - March 3rd, 2002
CheckUIElements function creates the left menu bar scrolling affect
This script found somewhere on internet has been modified
by xptuneup for the http://www.xptuneup.com website.
*******************************************************************/
//var bExplorer4plus = (document.getElementById && document.all);
//var bNetscape6 = (document.getElementById && !document.all);
//var Menupx = 121;

function CheckUIElements()
{
	  
	var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck ,LeftSlidingMenuObject,TopLeftMenuObject,TipsSubMenuObject;
if ( bNetscape6 )
	{
	   LeftSlidingMenuObject = document.getElementById('Layer1');
	   LeftSlidingMenuObject.style.visibility = 'visible';
 
	}


	if ( bExplorer4plus ) {
		yMenuFrom   = parseInt (Layer1.style.top, 10);
		yMenuTo     = document.body.scrollTop + Menupx;
	}
	else if ( bNetscape6 ) {
		yMenuFrom   = parseInt(LeftSlidingMenuObject.style.top,10);
		yMenuTo     = pageYOffset + Menupx;
	}


	timeoutNextCheck = 500;

	if ( yMenuFrom != yMenuTo ) {

		if ( bNetscape6 )
			yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 5 );

		if ( bExplorer4plus )
			yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 10 );

		if ( yMenuTo < yMenuFrom )
			yOffset = -yOffset;

                if ( bExplorer4plus )
		       {
					
			Layer1.style.top = parseInt (Layer1.style.top, 10) + yOffset;
		       }
		else if ( bNetscape6 )
		{

		 LeftSlidingMenuObject.style.top =  parseInt (LeftSlidingMenuObject.style.top , 10 ) + yOffset;

		}

		timeoutNextCheck = 1;
	}

	setTimeout ('CheckUIElements()', timeoutNextCheck);
}


/******************************************************************
Anil M Dubey - March 3rd, 2002
aSlide function creates the left menu bar scrolling affect
*******************************************************************/
function aSlide()
{

var  LeftSlidingMenuObject,TopLeftMenuObject,TipsSubMenuObject;
if ( bNetscape6 )
	{
	   LeftSlidingMenuObject = document.getElementById('Layer1');
	   LeftSlidingMenuObject.style.visibility = 'visible';

	}

	if ( bExplorer4plus ) {
		Layer1.style.top = document.body.scrollTop + Menupx;
		Layer1.style.visibility = 'visible';

	}
	else if ( bNetscape6 ) {
		   LeftSlidingMenuObject.style.top =  Menupx + pageYOffset;
		   TopLeftMenuObject.style.top =  pageYOffset;

		    }

	CheckUIElements();
}
