function showOverlay(srcObj,show) {
	tar=objid(srcObj.id.replace("block","overlay"));
	if (show) {
		revealObject(tar);
	}else{
		hideObjectDelay(tar);
	}
}
var revealObjects=new Array();
var revealTimer=null;
var hideTimer={};
function revealObject(tar) {
	exists=false;
	for(o=revealObjects.length-1;o>=0;o--) {
		if (revealObjects[o]["obj"]==tar) {
			if (revealObjects[o]["expand"]) {
				exists=true;
			}else{
				revealObjects.splice(o,1);
			}
		}
	}
	if (!exists && tar.style.display=="block") exists=true;
	if (!exists) {
		fh=1;
		if (tar.style.display=="block") fh=tar.childNodes[0].clientHeight;
		tar.style.visibility="hidden";
		tar.style.display="block";
		tar.style.height="";
		h=tar.childNodes[0].clientHeight;
		tar.style.overflow="hidden";
		tar.style.height=fh+"px";
		tar.style.visibility="visible";
		revealObjects.push({"obj":tar,"toHeight":h,"fromHeight":fh,"expand":true});
		revealTimer = setTimeout("resizeTheObj()",2);
	}
	id=tar.id.replace("block","");
	if (hideTimer[id]) clearTimeout(hideTimer[id]);
}
function hideObjectDelay(tar) {
	if (hideTimer[id]) clearTimeout(hideTimer[id]);
	id=tar.id.replace("block","");
	hideTimer[id]=setTimeout("hideObject('"+tar.id+"')",500);
}
function hideObject(tar) {
	if (typeof(tar)=="string") tar=objid(tar);
	exists=false;
	for(o=revealObjects.length-1;o>=0;o--) {
		if (revealObjects[o]["obj"]==tar) {
			if (revealObjects[o]["expand"]) {
				revealObjects.splice(o,1);
			}else{
				exists=true;
			}
		}
	}
	if (!exists) {
		if (tar.style.display=="block") {
			h=tar.clientHeight;
			revealObjects.push({"obj":tar,"fromHeight":h,"toHeight":1,"expand":false});
			revealTimer = setTimeout("resizeTheObj()",2);
		}
	}
}
function resizeTheObj(){
	for(o=revealObjects.length-1;o>=0;o--) {
		maxMovement=3;
		dh=(revealObjects[o]["toHeight"]-revealObjects[o]["fromHeight"])/2;
		if (dh>maxMovement) dh=maxMovement;
		if (dh<-maxMovement) dh=-maxMovement;
		if (dh<1 && dh>-1) {
			if (revealObjects[o]["expand"]) {
				revealObjects[o]["obj"].style.height=revealObjects[o]["toHeight"]+"px";
			}else{
				revealObjects[o]["obj"].style.display="none";
				revealObjects[o]["obj"].style.height="";
			}
			revealObjects.splice(o,1);
		}else{
			revealObjects[o]["fromHeight"]+=dh;
			revealObjects[o]["obj"].style.height=revealObjects[o]["fromHeight"]+"px";
		}
	}
	if (revealObjects.length>0) {
		resizeTimer = setTimeout("resizeTheObj()",2);
	}else{
		clearTimeout(resizeTimer);
	}
}
function logoff(src) {
	src.innerHTML="<img src='/skin/loading.gif' />";
	var vars="cmd=logout";
	sendPostRequest("/index.php",vars,logoutReceived);
}
function logoutReceived(reply) {
	window.location="/";
}
function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}
function Delete_Cookie( name, path, domain ) {
document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
