var OBJ_SLIDE;
var OBJ_VIEW;
var NEW_PIX_VAL = 0;
var DIV_HEIGHT = 0; //value irrelevant
var MainDiv,SubDiv;

document.write('<div id="tempcontainer" class="mainDiv" style="visibility: hidden; position: absolute"></div>')



function Init(objDiv)
{
        // full div
		MainDiv = objDiv.parentNode;
        
		// first level menu
		SubDiv = MainDiv.getElementsByTagName("DIV").item(0);
		// first level sub menu container div
		OBJ_SLIDE = MainDiv.getElementsByTagName("DIV").item(1)
        // first level sub menu div
		OBJ_VIEW = OBJ_SLIDE.getElementsByTagName("DIV").item(0);
		
		//change style on mouse over
		if (SubDiv.className == SubDiv.getAttribute("classOut"))
        	SubDiv.className = SubDiv.getAttribute("classOver");
   		else
        	SubDiv.className = SubDiv.getAttribute("classOut");
		//change style on mouse out
		SubDiv.onmouseout = ChangeStyle;

		// run slide
        SubDiv.onclick = RunSlide;

				


        
		// getting div high
		document.getElementById("tempcontainer").innerHTML=MainDiv.getElementsByTagName("DIV").item(2).innerHTML //DD added code
		DIV_HEIGHT=document.getElementById("tempcontainer").offsetHeight //DD added code
        
		// setting used hig to 0
        NEW_PIX_VAL = 0;
}


function RunSlide()
{	
	// checking state atribute
    if (OBJ_VIEW.getAttribute("state") == 0)
    {
		// setting div high
		NEW_PIX_VAL += DIV_HEIGHT;
		
		if(DIV_HEIGHT == 0)OBJ_VIEW.style.display = 'none';
		
        // OBJ_SLIDE.style.height = NEW_PIX_VAL;

		//OBJ_VIEW.innerHTML = DIV_HEIGHT;
		OBJ_VIEW.style.display = 'inline';
		OBJ_VIEW.setAttribute("state","1");
		MainDiv.setAttribute("state","1");
    } else
    {
        OBJ_VIEW.style.display = 'none';
		
		NEW_PIX_VAL = 0;
        
		// OBJ_SLIDE.style.height = NEW_PIX_VAL;
        
        
		OBJ_VIEW.setAttribute("state","0");
        MainDiv.setAttribute("state","0");

    }
}

function ChangeStyle()
{
    if (this.className == this.getAttribute("classOut"))
        this.className = this.getAttribute("classOver");
    else
        this.className = this.getAttribute("classOut");
}
