/*#############################################################
DHTML JavaScript for dropdownnav.xsl,subleftnav.xsl,pagecontent.xsl
[may also be used with variations of the above xsl's ]
currently supports ie5+ and mozilla 6, one level of submenu only.
4-25-2002 -Christian Chambless
#############################################################*/
		var opensubmenu;
		var openNestedSubMenu;
		var blnNestedInit;
		var blnInitialize;
		var blnDrawLeft;
		var blnIsLeftNav;		
		var activeimage;
		var pwin;

			blnInitialized = false;
			blnNestedInit = false;
			blnDrawLeft = false;
			blnIsLeftNav = false;			
			
		function show(id,parent){

		

		//## display  main menu set  ##
			if(blnInitialized==true) {
				hide();
			}
			blnInitialized = true;
			opensubmenu = document.getElementById(id);
			//## only needs re-position if using ie, netscape positions submenus correctly within its own table cell. 
			if(document.all){
				//hide all select boxes
				setSelectsVisibility('hidden');
				opensubmenu.style.left=( parseInt(parent.offsetLeft) ) + 'px';
				opensubmenu.style.top=(  parseInt(parent.offsetTop) ) + parent.offsetHeight + 'px';
			}
			//## subLeftNav.xsl sets blnIsLeftNav=true; prior to calling show() in the onMouseOver event
			//## then we know to position the submenu differently
			if(blnIsLeftNav){
				opensubmenu.style.left=( ( (parseInt(parent.offsetLeft)-10) + (parseInt(parent.offsetWidth)) ) ) + 'px';
				if(document.all){
					opensubmenu.style.top=(parseInt(parent.offsetTop))+ 'px';
				}
			}
				n = 'tbl'+id;
				tbl = document.getElementById(n);
				opensubmenu.style.width = parent.offsetWidth;
				tbl.style.width = parent.offsetWidth;
			opensubmenu.style.visibility='';
			blnIsLeftNav=false;
			blnDrawLeft=false;
		}

		function showNestedSubMenu(id,parent){
		//##id =string,parent=dhtml object
		//## display sub menu set, parent object used for positioning
			var offsetx = 0;
			openNestedSubMenu = document.getElementById(id);
/*##########################
			container = parent;
			tbl = document.getElementById("dropDownTable");
			iContainerRightEdge =parseInt(container.offsetWidth)+ parseInt(container.offsetLeft);
			iDropDownRightEdge = parseInt(openNestedSubMenu.parentElement.offsetLeft) +parseInt(openNestedSubMenu.offsetWidth);

			//iContainerRightEdge = 600;
			//alert('dd:'+iDropDownRightEdge + 'con:'+iContainerRightEdge);
			//alert(tbl.offsetLeft +'w:'+tbl.offsetWidth);
			if(iDropDownRightEdge>iContainerRightEdge){
				blnDrawLeft=true;
				//openNestedSubMenu.style.left = (iContainerRightEdge - parseInt(openNestedSubMenu.offsetWidth));
				//openNestedSubMenu.style.left =  (iContainerRightEdge-iDropDownRightEdge);//+ parseInt(parent.offsetLeft);
			}
//##########################################################			
*/
			//## calculate left pixel offset if we need to draw to the left 
			if(document.all){
				if( blnDrawLeft==true  && blnNestedInit!=true ){
				 offsetx = ( (parseInt(parent.offsetWidth)+parseInt(openNestedSubMenu.offsetWidth)) * -1) + 20;
				}
			}
			var	iLeftPos =(offsetx + ( (parseInt(parent.offsetLeft)-10) + (parseInt(parent.offsetWidth)) ) );
			// if(iLeftPos<0){iLeftPos=0;}
			//alert(parent.offsetLeft);
			
			openNestedSubMenu.style.left= iLeftPos + 'px';
			
			bottomEdge = parseInt(parent.offsetTop) + parseInt(openNestedSubMenu.offsetHeight);
			if(bottomEdge>300){		
				openNestedSubMenu.style.top=( ( parseInt(parent.offsetTop)-(parseInt(openNestedSubMenu.offsetHeight)/2)+15) + 'px');
			}
			else{				
				openNestedSubMenu.style.top=( ( parseInt(parent.offsetTop) ) + 'px');
			}
			openNestedSubMenu.style.visibility='';
			blnNestedInit =true;
		}		
	
		function hide(){
		//## hide main menu set	
			if(document.all){
				setSelectsVisibility('');
			}
			blnInitialized = false;
			opensubmenu.style.visibility='hidden';
		}
		function hideNested(){
		//## hide sub menu set
			if(blnNestedInit==true){
				openNestedSubMenu.style.visibility='hidden';
			}
			blnNestedInit = false;
			
		}
		function doclick(id){
		//## transfers table cell clicks to href tags
			document.getElementById(id).click();
		}
///### handle mouse over effects of dropdownnav.xsl
function dropDownPageOver(oPage,sLinkId)
{
	if(document.all)
	{
	oPage.className='menuOver'; 
	document.getElementById(sLinkId).className = 'menuItemOver' ;
	}
}

function dropDownPageOut(oPage,sLinkId)
{
	if(document.all)
	{
	oPage.className='menuOut'; 
	document.getElementById(sLinkId).className = 'menuItem' ;
	}
}
function dropDownPageDown(oPage)
{
	oPage.className='menuDown';
}
///### end handle mouse over effects of dropdownnav.xsl



		
		function clickRowGroup(sID,iRowCount){
			//## suport function for <rowset>/<rowgroup> element transformation in pagecontent.xsl
			titleRow = document.getElementById(sID);
			if(titleRow.className=='expandedGroup'){
				sMode ='none';
				titleRow.className='collapsedGroup';
				sImgName = sID+'_icon';
				document.getElementById(sImgName).src='graphics/collapsed.gif';
			}
			else {
				sMode='';
				titleRow.className='expandedGroup';
				sImgName = sID+'_icon';
				document.getElementById(sImgName).src='graphics/expanded.gif';
			}

			for(i=1;i<=iRowCount;i++){
				sName = sID + i;
				document.getElementById(sName).style.display=sMode;
			}
		}

function setSelectsVisibility(sMode){
	// hides or shows every select on every form, depending on sMode, valid sMode values are 'hidden' and ''
	for(x=0;x<document.forms.length;x++){
		obj = document.forms(x);	
		for(i=0;i<obj.elements.length;i++){
			    if(obj.elements[i].type=="select-one"){
				obj.elements[i].style.visibility=sMode;
				}	
		}
	}
}

function topRightShow(id)
	{
		var parent = document.getElementById(id);
		var dropdown = document.getElementById(id+'DropDown');
		var container = document.getElementById('topRightDropDownContainer');
		var button = document.getElementById(id+'Button');
		if(document.all){
			var iContainerRightEdge = parseInt(container.offsetLeft) + parseInt(container.offsetWidth);
		}else{
			var iContainerRightEdge=parseInt(document.offsetWidth);

		}
		var iDropDownRightEdge = parseInt(dropdown.offsetLeft) + parseInt(dropdown.offsetWidth) +parseInt(container.offsetLeft);
		if(iDropDownRightEdge>iContainerRightEdge){
			dropdown.style.left =  (iContainerRightEdge-iDropDownRightEdge)+ parseInt(parent.offsetLeft);
		}
		if(dropdown.offsetHeight > 300){
			dropdown.style.height='250px';
			dropdown.style.overflow='auto';
		}
		if(parseInt(parent.offsetWidth)>parseInt(dropdown.offsetWidth) )
		{
			dropdown.style.width = parent.offsetWidth;
		}
		button.className='topRightMenuOver';
		dropdown.style.visibility='';

	}
	
	function topRightHide(id)
	{
		var parent = document.getElementById(id);
		var dropdown = document.getElementById(id+'DropDown');
		var button = document.getElementById(id+'Button');		
		button.className='topRightMenu';
		dropdown.style.visibility='hidden';
	}
	
///### handle mouse over effects of topRightDropDown.xsl
function topRightPOver(oPage)
{
	if(document.all)
	{
	oPage.className='topRightMenuItemOver'; 

	}
}

function topRightPOut(oPage)
{
	if(document.all)
	{
	oPage.className='topRightMenuItem'; 
	}
}

///### end handle mouse over effects of topRightDropDown.xsl
