/***********************************************
* Drop Down/ Overlapping Content- ?Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
//target = location to show drop box
//content = which popup to show
//offsettype = where to show
function show_dropbox (target, content ,offsettype) {
	var locationbox = document.getElementById(target);
	return overlay(locationbox, content, offsettype);
}

function getposOffset(overlay, offsettype){
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;
	while (parentEl!=null){
	totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
	parentEl=parentEl.offsetParent;
}	
return totaloffset;
}

function overlay(curobj, subobjstr, opt_position){
	if (document.getElementById){
	var curobj = document.getElementById (curobj)
	var subobj=document.getElementById(subobjstr)
	//dropdown to match parent in width including 20px padding and 1px border
	if (subobj.style.width ==""){
	 subobj.style.width=(curobj.offsetWidth) +"px";
	 }
	//subobj.style.width=(curobj.offsetWidth - 18) +"px";
	subobj.style.display=(subobj.style.display!="block")? "block" : "none"
	var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
	var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
	subobj.style.left=xpos+"px"
	subobj.style.top=ypos+"px"
	
	return false
}
else
return true
}


function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}