var obj = "";
var totalHeight = 0;
var actualHeight = 0;
var opaque = 100;
var iconId = "";
var commandId = "";
var commandTxt1 = "";
var commandTxt2 = "";
var i = 1;
function openClose(objName,icon,command,command1,command2){
	obj = document.getElementById(objName);
	iconId = document.getElementById(icon);
	totalHeight = obj.offsetHeight;
	commandId = document.getElementById(command);
	commandTxt1 = command1;
	commandTxt2 = command2;

	if(obj.style.display != "none"){
		actualHeight = totalHeight;
		closeDiv();
	} else{
		openDiv()
	}
}

function closeDiv(){
	obj.style.height = totalHeight + "px";
	obj.style.filter="alpha(opacity="+ opaque +")";
	obj.style.opacity= opaque/100;
	var closeObj = setTimeout("closeDiv()", 50);
	i++;
	totalHeight-=5*i;
	opaque-=5*i;
	if(totalHeight < 5){
		clearTimeout(closeObj);
		totalHeight = 0;
		opaque = 0;
		i = 1;
		commandId.innerHTML = commandTxt1;
		iconId.className = commandTxt2;
		obj.style.display = "none"
	}
}

function openDiv(){
	obj.style.height = totalHeight + "px";
	obj.style.filter="alpha(opacity="+ opaque +")";
	obj.style.opacity= opaque/100;
	obj.style.display = "block"
	var openObj = setTimeout("openDiv()", 50);
	i++;
	totalHeight+=5*i;
	opaque+=5*i;
	if(totalHeight > actualHeight){
		clearTimeout(openObj);
		totalHeight = actualHeight;
		opaque = 100;
		i = 1;
		commandId.innerHTML = commandTxt2;
		iconId.className = commandTxt1;
		
	}
}
