// INIT
is_ie = navigator.userAgent.toLowerCase().indexOf("msie") != -1 ? true : false;

// FUNCTIONS
function openAttachments( addition ) {
	window.open( 'index.php?action=attachment&go=upload&' + addition, 'attachments', 'width=802,height=600' );
}

function toggleMenu( menu, object ) {
	menu=document.getElementById(menu);
	object=document.getElementById(object);
	alert(object.style.left);
	if( menu.style.display == '' ) {
		menu.style.display = 'none';
	} else {
		menu.style.left = object.x;
		menu.style.top = object.y + object.height;
		menu.style.display='';
	}
	return( false );
}


function sx_showbox( whichBox ) {

	box = document.getElementById( "box_" + whichBox );
	button = document.getElementById( whichBox );
	
	box.style.top = sx_absoluteTop( button ) + button.height;
	box.style.left = sx_absoluteLeft( button );
	
	if( box.style.display == '' ) {
	
		box.style.display = 'none';
		
	} else {
	
		box.style.display = '';
		
		if( whichBox == "forecolor" ) {
		
			document.getElementById( "box_hilitecolor" ).style.display = 'none';
			
		} else if( whichBox == "hilitecolor" ) {
		
			document.getElementById( "box_forecolor" ).style.display = 'none';
			
		}
		
	}
	
}

function sx_absoluteLeft( obj ) {

	posLeft = obj.offsetLeft;
	
	while( ( obj = obj.offsetParent ) != null ) {
	
		posLeft += obj.offsetLeft;
		
	}
	
	return( posLeft );
	
}

function sx_absoluteTop( obj ) {

	posTop = obj.offsetTop;
	
	while( ( obj = obj.offsetParent ) != null ) {
	
		posTop += obj.offsetTop;
		
	}
	
	return( posTop );
	
}