//<![CDATA[


//----------------------------------------------------------------------------
// Code to determine the browser and version.
//----------------------------------------------------------------------------

function Browser() {

  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isNS    = false;  // Netscape
  this.isOP    = false;
  this.version = null;

  ua = navigator.userAgent;

    s = "Opera";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isOP = true;
    this.version = 6.1;
    return;
  }
  
  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
  

}

var browser = new Browser();


//----------------------------------------------------------------------------
// Code for handling the wimenu bar and active button.
//----------------------------------------------------------------------------

var activeButton = null;



function buttonClick(event, wimenuId, Id) {

	var button;
  // Get the target button element.
	
	if (browser.isIE) button = window.event.srcElement;
	else button = document.getElementById("i" +  Id);
	if (button == null || button == undefined) button = document.all["i" +  Id]; 
  
	button.mId=Id
  // Blur focus from the link to remove that annoying outline.
  if (browser.isIE)
		button.blur();

  // Associate the named wimenu to this button if not already done.
  // Additionally, initialize wimenu display.

	if (button.wimenu == null||button.wimenu == undefined) {
//	  	alert(button.wimenu)
		button.wimenu = document.getElementById(wimenuId);
		if (button.wimenu.isInitialized == null)
			wimenuInit(button.wimenu);
	}


  // [MODIFIED] Added for activate/deactivate on mouseover.

  // Set mouseout event handler for the button, if not already done.
//  alert(button.onmouseout)
	if (button.onmouseout == null||button.onmouseout == undefined)
		{
		button.onmouseout = buttonOrwimenuMouseout;
		}

  // Exit if this button is the currently active one.
	if (button == activeButton)
		return false;

  // [END MODIFIED]

  // Reset the currently active button, if any.

	if (activeButton != null)
		{
//		alert(activeButton)
		resetButton(activeButton);
		}

  // Activate this button, unless it was the currently active one.
	if (button != activeButton) {
		depressButton(button, Id);
		activeButton = button;
	} 
	else
		activeButton = null;
	return false;
}

function buttonMouseover(event, wimenuId, Id) {
	clearTimeout(bobj)
	var button;
  // [MODIFIED] Added for activate/deactivate on mouseover.

  // Activates this button's wimenu if no other is currently active.
//	swon("i_"+ wimenuId, wimenuId);

	if (activeButton == null) {
		buttonClick(event, wimenuId, Id);
		return;
	}

  // [END MODIFIED]

  // Find the target button element.

	if (browser.isIE)
		button = window.event.srcElement;
	else
		button = event.currentTarget;

  // If any other button wimenu is active, make this one active instead.
	if (activeButton != null && activeButton != button)
		buttonClick(event, wimenuId, Id);
}

function depressButton(button, Id) {
	var x, y;
  // Update the button's style class to make it look like it's
  // depressed.
	button.className += " wimenuButtonActive";

  // [MODIFIED] Added for activate/deactivate on mouseover.

  // Set mouseout event handler for the button, if not already done.

	if (button.onmouseout == null||button.onmouseout == undefined)
		{

		button.onmouseout = buttonOrwimenuMouseout;
		}
		
	if (button.wimenu.onmouseout == null||button.wimenu.onmouseout == undefined)
	{

		button.wimenu.onmouseout = buttonOrwimenuMouseout;
//			alert(button.wimenu.onmouseout)
		}

  // [END MODIFIED]

  // Position the associated drop down wimenu under the button and
  // show it.
	x = getPageOffsetLeft(button);
	y = getPageOffsetTop(button) + button.offsetHeight;
  // For IE, adjust position.

	if (browser.isIE) {
		x += button.offsetParent.clientLeft;
		y += button.offsetParent.clientTop;//+4;
		winW = document.body.offsetWidth;
	} else {
		winW = window.innerWidth;
	}
//	button.wimenu.style.width=200
	var mnum=button.id.substr(9,button.id.length-9)
//	document.all["tt_"+mnum].style.width=button.wimenu.offsetWidth;
//	document.all["bt_"+mnum].style.width = button.wimenu.offsetWidth;
button.wimenu.style.top  = (y + 2) + "px";
//alert(button.wimenu.offsetWidth)
button.wimenu.style.width=button.wimenu.offsetWidth
//~ sb=document.getElementById('i_subwimenu'+Id);
//alert(sb.offsetWidth)
	if (x + button.wimenu.offsetWidth+20 < winW) {
		button.wimenu.style.left  = (x) + "px";
	} else {
		button.wimenu.style.left  = (document.body.offsetWidth - button.wimenu.offsetWidth - 32/* +sb.offsetWidth */) + "px";
	}
	sb=document.getElementById('sub_m'+Id);
	sb.style.width=button.wimenu.offsetWidth

	button.wimenu.style.visibility = "visible";
}

function resetButton(button) {

  // Restore the button's style class.

//  swon("i_"+ button.wimenu.id, "r_"+ button.wimenu.id);
	removeClassName(button, "wimenuButtonActive");

  // Hide the button's wimenu, first closing any sub wimenus.

	if (button.wimenu != null||button.wimenu != undefined) {
		closeSubwimenu(button.wimenu);
			button.wimenu.style.visibility = "hidden";

		//swon('b'+button.mId,'button')

	}
	activeButton = null;
}

//----------------------------------------------------------------------------
// Code to handle the wimenus and sub wimenus.
//----------------------------------------------------------------------------

function wimenuMouseover(event) {
	clearTimeout(bobj)
	var wimenu;
  // Find the target wimenu element.
	if (browser.isIE)
		wimenu = getContainerWith(window.event.srcElement, "DIV", "wimenu");
	else
		wimenu = event.currentTarget;
  // Close any active sub wimenu.
  	if (wimenu.activeItem != null)
		closeSubwimenu(wimenu);
}

var pname="wimenuItem"
function wimenuItemMouseover(event, wimenuId) {

  var item, wimenu, x, y;

  // Find the target item element and its parent wimenu element.
//document.all['test'].tt.value=window.event.srcElement.className;
if (window.event.srcElement.className=="wimenuItem"||window.event.srcElement.className=="wimenuItemSel")
{
	pname=window.event.srcElement.className
}
else if (window.event.srcElement.parentNode.className=="wimenuItem"||window.event.srcElement.parentNode.className=="wimenuItemSel")
{
	pname=window.event.srcElement.parentNode.className
}
//document.all['test'].tt.value=window.event.srcElement.parentNode.className
  if (browser.isIE)
    item = getContainerWith(window.event.srcElement, "A", pname);
  else
    item = event.currentTarget;
  wimenu = getContainerWith(item, "DIV", "wimenu");

  // Close any active sub wimenu and mark this one as active.

  if (wimenu.activeItem != null)
    closeSubwimenu(wimenu);
  wimenu.activeItem = item;

  // Highlight the item element.

  item.className += " wimenuItemHighlight";

  // Initialize the sub wimenu, if not already done.

  if (item.subwimenu == null) {
    item.subwimenu = document.getElementById(wimenuId);
    if (item.subwimenu.isInitialized == null)
      wimenuInit(item.subwimenu);
  }

  // [MODIFIED] Added for activate/deactivate on mouseover.

  // Set mouseout event handler for the sub wimenu, if not already done.

  if (item.subwimenu.onmouseout == null||item.subwimenu.onmouseout == undefined)
    item.subwimenu.onmouseout = buttonOrwimenuMouseout;

  // [END MODIFIED]

  // Get position for subwimenu based on the wimenu item.

  x = getPageOffsetLeft(item) + item.offsetWidth;
  y = getPageOffsetTop(item);

  // Adjust position to fit in view.

  var maxX, maxY;

  if (browser.isNS) {
    maxX = window.scrollX + window.innerWidth;
    maxY = window.scrollY + window.innerHeight;
  }
  if (browser.isIE) {
    maxX = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) +
      (document.documentElement.clientWidth != 0 ? document.documentElement.clientWidth : document.body.clientWidth);
    maxY = Math.max(document.documentElement.scrollTop, document.body.scrollTop) +
      (document.documentElement.clientHeight != 0 ? document.documentElement.clientHeight : document.body.clientHeight);
  }
  maxX -= item.subwimenu.offsetWidth;
  maxY -= item.subwimenu.offsetHeight;

  if (x > maxX)
    x = Math.max(0, x - item.offsetWidth - item.subwimenu.offsetWidth
      + (wimenu.offsetWidth - item.offsetWidth));
  y = Math.max(0, Math.min(y, maxY));

  // Position and show the sub wimenu.

  item.subwimenu.style.left = (x -5) + "px";
  item.subwimenu.style.top  = y + "px";


  var mnum=item.subwimenu.id.substr(7,item.subwimenu.id.length-7)
//  alert(mnum)
	document.all["tt_"+mnum].style.width=item.subwimenu.offsetWidth
	document.all["bt_"+mnum].style.width=item.subwimenu.offsetWidth
  
  item.subwimenu.style.visibility = "visible";

  
  // Stop the event from bubbling.

  if (browser.isIE)
    window.event.cancelBubble = true;
  else
    event.stopPropagation();
}

function closeSubwimenu(wimenu) {
//alert(wimenu.activeItem)
  if (wimenu == null || wimenu.activeItem == null||wimenu == undefined || wimenu.activeItem == undefined)
    return;

  // Recursively close any sub wimenus.

  if (wimenu.activeItem.subwimenu != null) {
    closeSubwimenu(wimenu.activeItem.subwimenu);
    wimenu.activeItem.subwimenu.style.visibility = "hidden";
    wimenu.activeItem.subwimenu = null;
  }
  removeClassName(wimenu.activeItem, "wimenuItemHighlight");
  wimenu.activeItem = null;
}

// [MODIFIED] Added for activate/deactivate on mouseover. Handler for mouseout
// event on buttons and wimenus.
var bobj=null
function buttonOrwimenuMouseout(event) {

  var el;

  // If there is no active button, exit.

  if (activeButton == null)
    return;

  // Find the element the mouse is moving to.

  if (browser.isIE)
    el = window.event.toElement;
  else if (event.relatedTarget != null)
      el = (event.relatedTarget.tagName ? event.relatedTarget : event.relatedTarget.parentNode);

  // If the element is not part of a wimenu, reset the active button.
//
  if (getContainerWith(el, "DIV", "wimenu") == null) {
//alert(getContainerWith(el, "DIV", "wimenu"))
    bobj=setTimeout('resetButton(activeButton)',300);
//    activeButton = null;
  }
}

// [END MODIFIED]

//----------------------------------------------------------------------------
// Code to initialize wimenus.
//----------------------------------------------------------------------------

function wimenuInit(wimenu) {
	var itemList, spanList;
	var textEl, arrowEl;
	var itemWidth;
	var w, dw;
	var i, j;

  // For IE, replace arrow characters.

	if (browser.isIE) {
		wimenu.style.lineHeight = "2.5ex";
		spanList = wimenu.getElementsByTagName("SPAN");
		for (i = 0; i < spanList.length; i++)
			if (hasClassName(spanList[i], "wimenuItemArrow")) {
				spanList[i].style.fontFamily = "Webdings";
				spanList[i].firstChild.nodeValue = "4";
			}
	}

  // Find the width of a wimenu item.
	itemList = wimenu.getElementsByTagName("A");
	if (itemList.length > 0)
		itemWidth = itemList[0].offsetWidth;
	else
		return;

  // For items with arrows, add padding to item text to make the
  // arrows flush right.
	for (i = 0; i < itemList.length; i++) {
		spanList = itemList[i].getElementsByTagName("SPAN");
		textEl  = null;
		arrowEl = null;
		for (j = 0; j < spanList.length; j++) {
			if (hasClassName(spanList[j], "wimenuItemText"))
				textEl = spanList[j];
			if (hasClassName(spanList[j], "wimenuItemArrow"))
				arrowEl = spanList[j];
		}
		if (textEl != null && arrowEl != null)
			textEl.style.paddingRight = (itemWidth - (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
	}

  // Fix IE hover problem by setting an explicit width on first item of
  // the wimenu.
//	if (browser.isIE) {
//		w = itemList[0].offsetWidth;
//		itemList[0].style.width = w + "px";
//		dw = itemList[0].offsetWidth - w;
//		w -= dw;
//		itemList[0].style.width = w + "px";
//	}

  // Mark wimenu as initialized.
	wimenu.isInitialized = true;
}

//----------------------------------------------------------------------------
// General utility functions.
//----------------------------------------------------------------------------

function getContainerWith(node, tagName, className) {

  // Starting with the given node, find the nearest containing element
  // with the specified tag name and style class.
  while (node != null) {
    if (node.tagName != null && node.tagName == tagName &&
        hasClassName(node, className))
      return node;
    node = node.parentNode;
  }
  return node;
}

function hasClassName(el, name) {

  var i, list;

  // Return true if the given element currently has the given class
  // name.

  list = el.className.split(" ");
  for (i = 0; i < list.length; i++)
    if (list[i] == name)
      return true;

  return false;
}

function removeClassName(el, name) {
//if (browser.isOP)
//return
  var i, curList, newList;
//alert(String(el.className))
  if (el.className == null)
    return;

  // Remove the given class name from the element's className property.

  newList = new Array();
  curList = el.className.split(" ");
  for (i = 0; i < curList.length; i++)
    if (curList[i] != name)
		newList[newList.length] = curList[i];
//      newList.push(curList[i]);
  el.className = newList.join(" ");
}

function getPageOffsetLeft(el) {
	var x;
  // Return the x coordinate of an element relative to the page.
	x = el.offsetLeft;
	if (el.offsetParent != null)
		x += getPageOffsetLeft(el.offsetParent);
	return x;
}

function getPageOffsetTop(el) {

  var y;

  // Return the x coordinate of an element relative to the page.

  y = el.offsetTop;
  if (el.offsetParent != null)
    y += getPageOffsetTop(el.offsetParent);

  return y;
}



//window.onresize=reld

function reld(){
	location.reload();
}





///left wimenu


var opened = 0;
function wimenu(num) {
	if (opened > 0) open_close(opened);
	open_close(num);
	opened = num;
	return false;
}
function open_close(num) {
	if (document.getElementById('wimenu' + num).style.display != 'none') {
		document.getElementById('td' + num).opened = false;
		document.getElementById('lin' + num).className = 'm1';
		swon('b' + num, 'button');
	
		document.getElementById('wimenu' + num).style.display = 'none';

	} else  {
//			alert(document.getElementById('td' + num).opened)
		document.getElementById('td' + num).opened = true;
		document.getElementById('lin' + num).className = 'm2';
		swon('b' + num, 'button_o');
		document.getElementById('wimenu' + num).style.display = 'block';
	}
}

function lin_sl(obj, num, ovr) {

	hr=document.getElementById('lin'+num)

if (ovr==1)
	{
	
	hr.className='m2'
}
else
	{
	
	if(!obj.opened) 
	{
		swon('b'+num,'button'); 
		hr.className='m1'}
	if(obj.opened) 
		hr.className='m2'
	}
}