function clearform(which,text){

	var $txt = text
	if (which.value==$txt) {
		which.value='';
	} else if (which.value=="") {
		which.value=$txt;
	}

}

function setClass( hEl, sClass )
  {
    hEl.className = sClass
 }

// Show visitors and change color DIVS
if( typeof( MO ) == 'undefined' )
{
	MO = {};
}
MO.Kaldata = function()
{
	var sCurrentId = null;
	var getXYPos = function( sId )
	{
		function getOffset( hE )
		{
			var hO = [ hE.offsetTop, hE.offsetLeft ];
			hE = hE.offsetParent;
			while( hE )
			{
				hO[ 0 ] += hE.offsetTop;
				hO[ 1 ] += hE.offsetLeft	;
				hE = hE.offsetParent;
			}
			return hO;
		}
		var hE = document.getElementById( sId );
		var hPos = getOffset( hE );
		hPos[ 0 ] += hE.offsetHeight;
		return hPos;
	}

	var hKaldata = {
		//sId - id of the target element
		showEl : function( sIdTarget, sIdShow, aCorrect )
		{
			aCorrect = aCorrect || [ 0, 0 ];
			var hT = document.getElementById( sIdTarget );
			var aP = getXYPos( sIdTarget );
			var hS = document.getElementById( sIdShow );
			hS.style.left = aP[ 1 ] + aCorrect[ 0 ] + 'px';
			hS.style.top = aP[ 0 ] + aCorrect[ 1 ] + 'px';
			if( !hS.style.visibility || hS.style.visibility == 'hidden' )
			{
				hS.style.visibility = 'visible';
				sCurrentId = sIdShow;
			}
			else
			{
				hS.style.visibility = 'hidden';		
				sCurrentId = null;
			}
		},
		close : function( hEvent )
		{
			hEvent = hEvent || window.event;
			hTarget = hEvent.srcElement || hEvent.target;
			if( sCurrentId != null && hTarget.tagName != 'A' )
			{
				var hS = document.getElementById( sCurrentId );
				hS.style.visibility = 'hidden';		
				sCurrentId = null;
			}
		},
		showHide : function( aShowElements, aHideElements )
		{
			var aShow = [];
			var aHide = [];
			var hEl;
			var hI;
			if( typeof( aShowElements ) == 'string' )
			{
				aShow.push( aShowElements );
			}
			else
			{
				for( hI = 0; hI < aShowElements.length; hI++ )
				{
					aShow.push( aShowElements[ hI ] );
				}
			}
			if( typeof( aHideElements ) == 'string' )
			{
				aHide.push( aHideElements );
			}
			else
			{
				for( hI = 0; hI < aHideElements.length; hI++ )
				{
					aHide.push( aHideElements[ hI ] );
				}
			}
			for( hI in aShow )
			{
				hEl = document.getElementById( aShow[ hI ] );
				if( hEl )
				{
					hEl.style.display = 'block';
				}
			}
			for( hI in aHide )
			{
				hEl = document.getElementById( aHide[ hI ] );
				if( hEl )
				{
					hEl.style.display = 'none';
				}
			}
		},
		setupSearchEngine : function()
		{
			var hEl = document.getElementById( 'engine' );
			var hSEl = document.getElementById( 'keyword' );
			var nIdx = hEl.selectedIndex;
			if( nIdx == 0 )
			{
				hEl.form.action = 'search.php';
				hEl.form.method = 'post';
				hSEl.name = 'searchfor';
			}
			else if( nIdx == 1 )
			{
				hEl.form.action = '/google.html';
				hEl.form.method = 'get';
				hSEl.name = 'q';
				hSEl.size = '20';
				hSEl.maxlength = '255';
			}
		},
		init : function()
		{
			var hEngineEl = document.getElementById( 'engine' );
			if( hEngineEl.attachEvent )
			{
				hEngineEl.attachEvent( 'onchange', hKaldata.setupSearchEngine );
			}
			else if( hEngineEl.addEventListener )
			{
				hEngineEl.addEventListener( 'change', hKaldata.setupSearchEngine, false );
			}
			hKaldata.setupSearchEngine();
		}
	}

	if( document.attachEvent )
	{
		document.attachEvent( 'onclick', hKaldata.close );
	}
	else if( document.addEventListener )
	{
		document.addEventListener( 'click', hKaldata.close, false );
	}

	if( window.attachEvent )
	{
		window.attachEvent( 'onload', hKaldata.init );
	}
	else if( window.addEventListener )
	{
		window.addEventListener( 'load', hKaldata.init, false );
	}

	return hKaldata;
}();
//---------------------------------------------------

function ShowElem(Elem,hide1,hide2){

  var FormElem = document.getElementById( Elem )
  var hideElem1 = document.getElementById( hide1 )
  var hideElem2 = document.getElementById( hide2 )
  if(FormElem)
   if((FormElem.style.display == "none") || (FormElem.style.display == "")) {
    FormElem.style.display = "block";
	if (hideElem1)
	hideElem1.style.display = "none";
	if (hideElem2)
	hideElem2.style.display = "none";
   }

}

//-------------------------------------------------------