/**
 * _forWebParser.js 
 * by Julius_Davies@inovera.ca
 * February 19th, 2002 
 *
 * Farely hackish bunch of javascript functions to enhance
 * usability of my webparser.  This is not really meant to
 * be at all maintainable, and is irrevokably tied to all
 * the "id=xxxx" attributes I set on HTML elements at random
 * inside my ISOParserServlet.
 */


previousTarget = null; 
previousPositionTarget = null; 
placeHolder = null; 

function showHide(s) { 
	target = document.getElementById( "info" + s ); 
	if ( target.style.display != "block" ) { 
		target.style.display = "block"; 
	} 
	else { 
		target.style.display = "none"; 
	} 
} 

function resetISO() { 
	target = document.getElementById( "iso" ); 
	target.defaultValue = ""; 
} 
  
function highlightData( parsed_ ) { 
   cleanup(); 
   target = document.getElementById( "parsed_" + parsed_ ); 
   positionTarget = document.getElementById( "info_" + parsed_ ); 
   if ( target == null ) 
   { 
      target = document.getElementById( "parsed_ERROR" ); 
      positionTarget = document.getElementById( "info_ERROR" ); 
      if ( target == null )
         return; 
      target.style.backgroundColor = "red"; 
   } 
   else 
   { 
      target.style.backgroundColor = "green"; 
   } 
   target.style.textDecoration = "underline"; 
   target.style.color = "white"; 
   positionTarget.style.display = "block"; 
   previousTarget = target; 
   previousPositionTarget = positionTarget; 
} 
 
function cleanup() 
{ 
   if ( previousTarget != null ) 
   { 
      previousTarget.style.backgroundColor = "white"; 
      previousTarget.style.textDecoration = "none"; 
      if ( previousTarget.id == "parsed_ERROR" ) 
         previousTarget.style.color = "red"; 
      else 
         previousTarget.style.color = "green"; 
   } 
   if ( previousPositionTarget != null ) 
      previousPositionTarget.style.display = "none"; 
   if ( previousPositionTarget != placeHolder ) 
   { 
      previousPositionTarget = placeHolder; 
      previousPositionTarget.style.display = "block"; 
   } 
}
