// JavaScript Document
function show(id) {
	var obj = document.getElementById(id);
	if (obj.style.display == "block") {
		fadeDropOut(id);		
	}
	else {
		obj.style.filter = "alpha(opacity=0)";	
		obj.style.opacity = "0.0";
		//obj.style.overflow = "hidden";
		//obj.style.height = "0px";		
		obj.style.display = "block";
		
		if (id.indexOf("right")!=-1) {
		//document.getElementById(id+"_img").src = "images/info_arrow_down.jpg";
		} else {
		//document.getElementById(id+"_img").src = "images/img_collapse.jpg";
		}
		var height = 0;
		
		if (obj.childNodes && obj.childNodes.length > 0) {
        	for (var x = 0; x < obj.childNodes.length; x++) {
            	if (obj.childNodes[x].offsetHeight > 1 && obj.childNodes[x].offsetHeight != null) {
					if(height == 0) {
					   height = obj.childNodes[x].offsetHeight;
					}
					else {
						if (obj.childNodes[x].style.cssFloat != "left") {
							height += obj.childNodes[x].offsetHeight;
						}
					}
				}
            }
		}
		else {
			// nothing exists in the drop	
		}
		
		slideDropOut(id, height);
	}
}


function slideDropOut(id, height) {
	var obj = document.getElementById(id);
	var current = parseInt(obj.style.height.replace("px", ""));
	if (current < height) {
		var step = 20;
		
		if (current + step > height) {
			current = height;	
		}
		else {
			current += step;
		}
		obj.style.height = current+"px";
		
		setTimeout("slideDropOut('"+id+"', "+height+")", 20);
	}
	else {
		fadeDropIn(id);	
	}
}

function fadeDropIn(id) {
	var obj = document.getElementById(id);
	var current = (obj.style.opacity*100);
	
	if (current < 100) {
		var step = 10;
		
		if (current+step > 100) {
			current = 100;	
		}
		else {
			current += step;	
		}
		
		obj.style.opacity = current/100;
		obj.style.filter = "alpha(opacity="+current+")";
		
		setTimeout("fadeDropIn('"+id+"')", 20);
		
	}
	else {
		//done	
	}
	
}

function fadeDropOut(id) {
	var obj = document.getElementById(id);
	
	var current = (obj.style.opacity*100);
	
	if (current > 0) {
		var step = 10;
		
		if (current-step < 0) {
			current = 0;	
		}
		else {
			current -= step;	
		}
		
		obj.style.opacity = current/100;
		obj.style.filter = "alpha(opacity="+current+")";
		
		setTimeout("fadeDropOut('"+id+"')", 20);
		
	}
	else {
		slideDropIn(id);	
	}
	
}

function slideDropIn(id) {
	var obj = document.getElementById(id);
	var current = parseInt(obj.style.height.replace("px", ""));
	if (current > 0) {
		var step = 20;
		
		if (current - step < 0) {
			current = 0;	
		}
		else {
			current -= step;
		}
		obj.style.height = current+"px";
		
		setTimeout("slideDropIn('"+id+"')", 20);
	}
	else {
		
			if (id.indexOf("right")!=-1) {
		//document.getElementById(id+"_img").src = "images/info_arrow_side.jpg";
		} else {
		//document.getElementById(id+"_img").src = "images/img_expand.jpg";
		}
		//document.getElementById(id+"_img").src = "images/img_expand.jpg";
		document.getElementById(id).style.display = "none";
	}
}
