var active_td = ""



function findPosX(obj) { 
var curleft = 0; 
if (obj.offsetParent) { 
while (obj.offsetParent) { 
curleft += obj.offsetLeft; 
obj = obj.offsetParent; 
} 
} else if (obj.x) 
curleft += obj.x; 

return curleft; 
} 

function findPosY( obj) { 
var curtop = 0; 

if (obj.offsetParent) { 
while (obj.offsetParent) { 
curtop += obj.offsetTop; 
obj = obj.offsetParent; 
} 
} else if (obj.y) 
curtop += obj.y; 

return curtop; 
} 


function getElementsByAttribute(oElm, strTagName, strAttributeName, strAttributeValue){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var oAttributeValue = (typeof strAttributeValue != "undefined")? new RegExp("(^|\\s)" + strAttributeValue + "(\\s|$)") : null;
	var oCurrent;
	var oAttribute;
	for(var i=0; i<arrElements.length; i++){
		oCurrent = arrElements[i];
		oAttribute = oCurrent.getAttribute && oCurrent.getAttribute(strAttributeName);
		if(typeof oAttribute == "string" && oAttribute.length > 0){
			if(typeof strAttributeValue == "undefined" || (oAttributeValue && oAttributeValue.test(oAttribute))){
				arrReturnElements.push(oCurrent);
			}
		}
	}
	return arrReturnElements;
}




var animate_elems = ","


function drop_down(thi,pts){
var xz = new Date()
var ts = ((((xz.getHours() * 60) + xz.getMinutes() * 60) + xz.getSeconds() * 1000) + xz.getMilliseconds())

var th = document.getElementById(thi)
var bux_app = th.offsetHeight

if ((bux_app < th.scrollHeight)&& ((ts - pts) < 750))
{
buxapp = th.offsetHeight + 5 
if (buxapp > th.scrollHeight) 
{
buxapp = th.scrollHeight
}
th.style.height = buxapp + "px"
window.setTimeout("drop_down('" + thi + "'," + pts + ")",10)
}
else
{
//window.status = "exiting anim"
animate_elems = animate_elems.replace(thi + ",",'')

}


}

function animate(th){
var xz = new Date()
var ts = ((((xz.getHours() * 60) + xz.getMinutes() * 60) + xz.getSeconds() * 1000) + xz.getMilliseconds())

if (!(th.tagName == "DIV"))
{
	if (document.all)
	{
	th = th.parentElement
	}
	else{
	th = th.parentNode
	}
}
if (animate_elems.indexOf(th.id + ",") == -1)
	{
	animate_elems = animate_elems + th.id + ","
	drop_down(th.id,ts)
	}
	else{
	//window.status = animate_elems + "               - already animatin this"
	}


}


function move_up(thi){

var xz = new Date()
	var ts = ((((xz.getHours() * 60) + xz.getMinutes() * 60) + xz.getSeconds() * 1000) + xz.getMilliseconds())
var th = document.getElementById(thi)
if(th){
var bux_app = th.offsetHeight
var f_cell = th.getElementsByTagName("TD")[0]

if (bux_app > f_cell.offsetHeight)
{
buxapp = th.offsetHeight - 5  
	if (buxapp < f_cell.scrollHeight)
	{
	buxapp = f_cell.scrollHeight
	}
	th.style.height = buxapp + "px"
	window.setTimeout("move_up('" + thi + "')",10)
}
else
{
//th.style.height = "0px"
//window.status = "exiting anim"
animate_elems = animate_elems.replace(thi + ",",'')
if (animate_elems == ","){
document.getElementById("floatingdiv").style.display = "none"
}
}
}
}


function d_animate(th){
if(!(setActive == th)){
	if ((animate_elems.indexOf("," + th.id + ",") == -1))
	{
	animate_elems = animate_elems + th + ","
	move_up(th)
	}
	else{
	window.status = animate_elems + "               - already d_animatin this"
	}
}
}

var setActive = ""
var nowShowing = -1
var hid_this = true;

function pre_d_animate(th){
setActive=''
//document.getElementById("floatingdiv").style.display = "none"
setTimeout('d_animate("' + th.id + '")',1000)
}

var vsetActive = ""
function ssetActive(th){
setActive = th.id
vsetActive = setActive
hid_this=false
}

function rsetActive(){
setActive=vsetActive
}


function fetchMyId(th){
var menus
if (document.all)
{
menus = getElementsByAttribute(document.body,"td","name","mnuitem")
}
else{
menus = document.getElementsByName("mnuitem")
}

for (var i=0;i<menus.length;i++)
{
if (menus[i] == th)
{
return i;
}
}
}

function show_me(th){
var tid = (fetchMyId(th))
if (animate_elems == ",")
{
if (!(nowShowing == tid))
{
if (document.all)
{
var s = getElementsByAttribute(document.body,"div","name","submenu")
var m = getElementsByAttribute(document.body,"TD","name","mnuitem")


}
else
{
var s = document.getElementsByName("submenu")
var m = document.getElementsByName("mnuitem")

}

document.getElementById("floatingdiv").innerHTML = "<a onmouseover='rsetActive()'>" + s[tid].innerHTML + "</a>"
active_td = m[tid]
document.getElementById("floatingdiv").style.height = "1px"
document.getElementById("floatingdiv").style.display = "block"
document.getElementById("floatingdiv").style.left = (findPosX(th) + (th.offsetWidth * 1)) - 2 + "px"
document.getElementById("floatingdiv").style.top = findPosY(th) + "px"
var xz = new Date()
var ts = ((((xz.getHours() * 60) + xz.getMinutes() * 60) + xz.getSeconds() * 1000) + xz.getMilliseconds())
lts = ts

var wh = ""
if (document.all)
{
	wh = document.body.offsetHeight 
}
else{
	wh = window.innerHeight 
}
var dir = false
if ((document.body.scrollTop + wh) < (document.getElementById("floatingdiv").scrollHeight + findPosY(th)))
{
	dir = true;
}
	
anim_f_div(ts,dir)
nowShowing = tid
}
}
}

function hid_all(){
if (hid_this)
{
animate_elems = ","
document.getElementById("floatingdiv").style.display = "none"
move_up(setActive)
//document.title = "asdsadsadasdad"
}
}

function anim_f_div(pts,dir){
var fx = document.getElementById("floatingdiv")
var xz = new Date()
var ts = ((((xz.getHours() * 60) + xz.getMinutes() * 60) + xz.getSeconds() * 1000) + xz.getMilliseconds())
//document.title = pts 
if ((fx.scrollHeight > fx.offsetHeight) && ((ts - pts) < 1000))
{
fx.style.height = (fx.offsetHeight * 1) + 4
	if (dir)
	{
//	alert(fx.style.top)
		fx.style.top = findPosY(fx) - 4
	}
setTimeout("anim_f_div(" + pts + "," + dir + ")",10)
}
else{
if (lts == pts)
{
fx.style.height = fx.scrollHeight
}
}

}

var lts = 0

function keep_float(){
active_td.getElementsByTagName("A")[0].className = "active_TD"
hid_this=false
}


function reset_all(){
var dt = new Date()
//document.title = dt + " Reset"
if (document.all)
{
var m = getElementsByAttribute(document.body,"TD","name","mnuitem")
}
else
{
var m = document.getElementsByName("mnuitem")
}


for (var i=0; i < m.length;i++)
{
	m[i].getElementsByTagName("A")[0].className = "menu_select_m"
}

}

function perform_hid(){
hid_this=true;
window.setTimeout('hid_all()',1000)
}


var xz = new Date()
var ts = ((((xz.getHours() * 60) + xz.getMinutes() * 60) + xz.getSeconds() * 1000) + xz.getMilliseconds())
lts = 0

