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; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

var IE = navigator.appVersion.indexOf("MSIE")>0;
var currxPos = 1
var newxPos = 1
var xDistance = 1

var curryPos = 1
var newyPos = 1
var yDistance = 1

function scrollH(newxPos){
	if(newxPos > currxPos){
		xDistance = newxPos - currxPos
		while (xDistance > 0){
			xDistance = Math.round(xDistance - 10)
			currxPos=(newxPos-xDistance)
			self.scroll(currxPos, curryPos);
		}
		currxPos = (newxPos-xDistance)
	}
	else{
		xDistance = currxPos - newxPos	
		while (xDistance > 0){
			xDistance = Math.round(xDistance - 10)
			currxPos=(newxPos+xDistance)
			self.scroll(currxPos, curryPos);
		}
		currxPos = (newxPos+xDistance)
	}
	if (IE) {}
	else {
		self.resizeTo(800,600);
	}
}

function scrollV(newyPos){
	if(newyPos > curryPos){
		yDistance = newyPos - curryPos
		while (yDistance > 0){
			yDistance = Math.round(yDistance - 10)
			curryPos=(newyPos-yDistance)
			self.scroll(currxPos,curryPos);
		}
		curryPos = (newyPos-yDistance)
	}
	else{
		yDistance = curryPos - newyPos
		while (yDistance > 0){
			yDistance = Math.round(yDistance - 10)
			curryPos=(newyPos+yDistance)
			self.scroll(currxPos,curryPos);
		}
		curryPos = (newyPos+yDistance)
	}
	if (IE) {}
	else {
		self.resizeTo(800,600);
	}
}

function reSet(){
	self.scroll(currxPos, curryPos);
}

function MM_findObj(n, d) { //v3.0
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function showHideLayers() { //v3.0
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	obj.visibility=v; }
}

function MM_showHideAll() { //v3.0
  var i,p,v,obj,args=document.all.tags("div");
	//window.status= args[i].id;
  for (i=0; i<(args.length); i++) {
  		if (args[i].id != "header" && args[i].id != "navigation"){
			args[i].style.visibility='hidden';
		}
	}
}
function findObj(n, d) { 
	var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length){ 
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); 
	return x;
}
function showHideLayers() { 
	var i,p,v,obj,args=showHideLayers.arguments; 
	if(document.getElementById){ 
		for (i=0; i<(args.length-2); i+=3){ 
			obj=document.getElementById(args[i]);v=args[i+2]; 
			v=(v=='show')?'visible':(v='hide')?'hidden':v; 
			if(obj)obj.style.visibility=v; 
		}
	}else{ 
		for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { 
			v=args[i+2]; 
			if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; } 
			obj.visibility=v; 
		} 
	}
}

// Maryanna Nesina
// mar@mail.bio.pu.ru
// http://www.bio.pu.ru/~mar
// http://www.webprogramming.boom.ru
// This script allows to show and hide layes for a set of main brousers
// And can be used to construct pull-down menus

// All the Layers get names from menu0 to menu_vith_nomber_m
// If we want to hide all the layers 
// we call showmenu() function without parametrs
// i.e. using onMouseOver evant

function DOMGetElement(xx) 
{
  // This function returns document's elemtnt acording it's name
  // Using Document Object Model
 if (document.getElementById) return document.getElementById(xx); 
 return nul;
}

function showmenu(name) 
{
// This is the main function that hide all the layers but the only one, 
// which name was delivered to the function as a parametr

var ii;  // cicle variable
var m=2; // variable that shows maximum nomber in layers' names 
var qq;  // here we store the name of a layer that we must show
var nen; // here we store the names of all layers (in a cicle)

NeMenu =  new Array(m+1); // an array to store the objects -  all the layers that should be hidden
nename = new Array(m+1);  // an array to store the names of all the layers  that should be hidden

// cicle to store the names of all the layers that should be hidden an array
for (ii=0; ii<=m; ii++) {
  nen="menu" + ii;
  nename[ii]=nen;
   if (name) { // this
    if (nen==name) qq=ii; // flag on - if it's a name of a layer hat should be shown
   }
}

// than we should show one layer and hide all the others (in a cicle)
// we do it for all the main types of brousers 

  if (document.getElementById) { 
  // Type 1: IE5,6; NN6; Mozilla
  // if our brouser supports DOM and we can get an object according to it's name
    if (name) { // if there was a parametr
     var Menu = DOMGetElement(name); // get an object 
     Menu.style.visibility='visible'; // and show it, changing the style
    }
    for (ii=0; ii<=m; ii++) { // for all the layers
     if (ii!=qq) { // but one that should be shown
      NeMenu[ii] = DOMGetElement(nename[ii]); // get an object that we do NOT show
      NeMenu[ii].style.visibility='hidden';  // and hide it, changing the style
     }
    }
    return true; // exit function
  } // that's all for the first type of brousers

 if(document.all) { 
  // Type 2: For document.all stands IE4-6 and Opera5, but IE5,6 were gone as the 1-st type 
   if (name) document.all[name].style.visibility= 'visible'; //if there was a parametr, show that layer using style
  for (ii=0; ii<=m; ii++) { 
   // hide all the layers but one that should be shown  - using style
   if (ii!=qq) document.all[nename[ii]].style.visibility= 'hidden'; 
  }
    return true; // exit function
 } // that's all for the second type of brousers

 if (document.layers) { 
   //Type 2: NN4
   if (name) document.layers[name].visibility='show'; // if there was a parametr, show that layer using layer
    for (ii=0; ii<=m; ii++) {
    // hide all the layers but one that should be shown  - using layer
     if (ii!=qq) document.layers[nename[ii]].visibility='hide';
    }
    return true; // exit function
  } // that's all for the second type of brousers (NN4)
} 


var isNav4, isIE4, isMac;
if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
  isNav4 = (navigator.appName == "Netscape") ? true : false
  isNav6 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 5) ? true : false
  isIE4  = (navigator.appName.indexOf("Microsoft") != -1) ? true : false
  isMac  = (navigator.platform.indexOf("Mac") != -1) ? true : false
}

function doSubWinTwo(url, winWidth, winHeight) {
  if (isNav4 || isIE4) {
    var screenPosX,screenPosY;
    screenPosX = (screen.availWidth - winWidth) / 2;
    screenPosY = (screen.availHeight - winHeight) / 2;
    if (isNav4) {
      window.open(url, 'subwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0, copyhistory=0,width='+winWidth+',height='+winHeight+',screenX='+screenPosX+',screenY='+screenPosY);
    }
    if (isIE4) {
      newwin = window.open(url, 'subwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0, copyhistory=0,width='+winWidth+',height='+winHeight+',left='+screenPosX+',top='+screenPosY);    
    }
  }
  else {
    window.open(url, 'subwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0, copyhistory=0,width='+winWidth+',height='+winHeight);
  }
}