

var tId = new Array();
var tId2 = new Array();
var stepOn = 15;
var stepOff = 300;
//var popupMaxHeight = 295;

var activeTopMenuPopup = "";
var objP;

function popupOn(tid, obj, popupId, popupMaxHeight)
{
if(popupMaxHeight == undefined) popupMaxHeight = 315;
if (activeTopMenuPopup != ""){
activeTopMenuPopup.className = "mouseOutItem";
objP.style.display = "none";
}
obj.className = "pulldownItem";
if (document.getElementById)
{
objP = document.getElementById(popupId);
if (objP)
{
objP.style.display = "block";

window.clearInterval(tId[tid]);
tId2[tid] = "0";
tId[tid] = window.setInterval("onTimerOn(" + tid + ",'" + popupId + "', " + popupMaxHeight + ")", 10);
objP.style.height="1px";
}
}
}

function popupOff(tid, obj, popupId, popupMaxHeight)
{
if(popupMaxHeight == undefined) popupMaxHeight = 295;
if (document.getElementById)
{
objP = document.getElementById(popupId);
if (objP)
{
//window.clearInterval(tId[tid]);


activeTopMenuPopup = obj;

tId2[tid] = "1";
window.setTimeout("waitTimeoutOff(" + tid + ",'" + popupId + "'," + 0 + ", 0, " + popupMaxHeight + ")", 50);
}
}

}


function waitTimeoutOff(tid, popupId, pageId, minHeight, normalHeight)
{

if (tId2[tid] == "1")
{
if(activeTopMenuPopup != "")
activeTopMenuPopup.className = "mouseOutItem";
window.clearInterval(tId[tid]);
tId[tid] = window.setInterval("onTimerOff(" + tid + ",'" + popupId + "'," + pageId + ", " + minHeight + ", " + normalHeight + ")", 10);
}
else
window.setTimeout("waitTimeoutOff(" + tid + ",'" + popupId + "', " + pageId + ", " + minHeight + ", " + normalHeight + ")", 50);

}



function onTimerOn(tid, popupId, maxHeight)
{
if (document.getElementById)
{
objP = document.getElementById(popupId);
if (objP)
{
var h = parseFloat(objP.offsetHeight);

var s = stepOn;
if ((h + s) > maxHeight)
s = maxHeight - h;

objP.style.height = (h + parseFloat(s)) + "px";
}

if (h + s >= maxHeight)
window.clearInterval(tId[tid]);
}
}

function onTimerOff(tid, popupId, pageId, minHeight, normalHeight)
{
if (document.getElementById)
{
objP = document.getElementById(popupId);
if (objP)
{
var h = parseFloat(objP.offsetHeight);
var s = stepOff;
if ((h - s) < minHeight)
s = h - minHeight;

objP.style.height = (h - s) + "px";
}

if (h - s <= minHeight)
{
window.clearInterval(tId[tid]);
objP.style.height = normalHeight + "px";
objP.style.display = "none";

if (activeTopMenuPopup != "")
{
activeTopMenuPopup.className = "mouseOutItem";
activeTopMenuPopup = "";
}


//document.getElementById("")

//objP

//pageId.className = "";

//objP.id = "";

/*
if (document.body.id == pageId)
{
document.body.id = "";
}
*/
}
}
}

function popupContentOn(tid)
{
tId2[tid] = "0";
}

function popupContentOff(tid)
{
tId2[tid] = "1";
}


