﻿
function slideDown(obj)
{

var tagName=document.getElementById(obj);
tagName.style.display='block';
tagName.style.visibility='visible';
//alert(tagName);

} // for ends



function slideUP(obj)
{
var tagName=document.getElementById(obj);
tagName.style.display='none';
tagName.style.visibility='hidden';

}







function doSlide(id){  

timeToSlide = 40; // in milliseconds  

obj = document.getElementById(id);  

if(obj.style.display == "none"){ // if it's allready hidden we slide it down  

obj.style.visibility = "hidden";  

obj.style.display = "block";  

height = obj.offsetHeight;  

obj.style.height="0px";  

obj.style.visibility = "visible";  

slideDown2(obj,0,height,Math.ceil(height/timeToSlide));  

} else {  

slideUp2(obj,Math.ceil(obj.offsetHeight/timeToSlide),obj.offsetHeight);  

 }  

 }  

 

function slideDown2(obj,offset,full,px){  

if(offset < full){  

obj.style.height = offset+"px";  

offset=offset+px;  

setTimeout((function(){slideDown2(obj,offset,full,px);}),1);  

 } else {  

 obj.style.height = full+"px"; //If the data inside is updated on runtime you can use auto instead...  

}  

 }  

  

function slideUp2(obj,px,full){  

if((obj.offsetHeight-px) > 0){  

obj.style.height = obj.offsetHeight-px+"px";  

setTimeout((function(){slideUp2(obj,px,full);}),1);  
} 
else 
{  

obj.style.height=full+"px"; // we reset the height if we were to slide it back down  

obj.style.display = 'none';  

 }  

 } 


function openDiv(obj)
{
//alert(obj)
var myObj=document.getElementById(obj);
myObj.style.visibility='hidden';
myObj.style.display='none';
}




function openDiv_2(obj)
{

var myObj=document.getElementById(obj);
myObj.style.visibility='visible';
myObj.style.display='block';

}


function getControls(obj_datalist,obj)
{
var myObj=document.getElementById(obj);
var mydata=document.getElementById(obj_datalist).childNodes[1];
//var theDiv=mydata.getElementsByTagName("a");
var theDiv=mydata.getElementsByTagName("div");
var myimg=mydata.getElementsByTagName("img");

for (var i=0;i<theDiv.length;i++)
{
var s=theDiv[i].id;

if (myObj.id==s)
{
openDiv_2(myObj.id);
//var img_obj=document.getElementById(myimg[i].id);
//img_obj.onclick=alert('chan');
////alert(myimg[i].id);
}
else
{
openDiv(s);
}

}
}
