function doClear(theText) { if (theText.value == theText.defaultValue) { theText.value = "" } }
function doDefault(theText) { if (theText.value == "") { theText.value = theText.defaultValue } }

//Main_Menu
var old_div_bottom; 
var timer;

function showPopup( div_bottom )
{
	if( timer )clearTimeout( timer );

	if( old_div_bottom )
	{
		old_div_bottom.className = 'menu_item';	
	}
	
	var div_bottom2 = document.getElementById( div_bottom );
	div_bottom2.className = 'menu_item show_popup';	
	
	old_div_bottom = div_bottom2;
}

function hiddePopup()
{
	timer = setTimeout("hiddePopupTimer()", 1000);
}

function hiddePopupTimer()
{
	old_div_bottom.className = 'menu_item';	
}

//Left_Menu
var OldList;
function ListMenu(){
	var menu = document.getElementById("menuAll");
	var items = menu.getElementsByTagName("li");
	for (var i=0; i<items.length; i++)
	{
			if( items[i].parentNode.className == "menu_list" )
			{
				var span = items[i].getElementsByTagName("a");
				if ( span[0] ) span[0].onclick=function ()
				{
					if ( OldList &&  OldList != this) OldList.parentNode.className = "";
					if (this.parentNode.className == "" || this.parentNode.className == "last" )
						{
							if( this.parentNode.className == "last" )this.parentNode.className = "selectlast";
																else this.parentNode.className = "select";
						}
							 else 
						{
							if( this.parentNode.className == "selectlast" )this.parentNode.className = "last";
																	  else this.parentNode.className ="";
						}
						
					OldList = this;	
					return false;
				}				
			}
	}
}

/*================PopupPass================*/
function PopupShow(div) {
	var map = document.getElementById(div);
	var selects = map.getElementsByTagName("select");
	var selects_all = document.getElementsByTagName("select");
	var opacitys = document.getElementById("opacity");
		for (var i=0; i < selects_all.length; i++) {
				selects_all[i].style.visibility = "hidden";
			}
		for (var k=0; k < selects.length; k++) {
				selects[k].style.visibility = "visible";
			}
			
	map.style.display = 'block';
	opacitys.style.display = 'block';
	
	PopupResize(div);
	return false;
} 


function PopupOff(div) {
	var map = document.getElementById(div);
	var selects = document.getElementsByTagName("select");
	var opacitys = document.getElementById("opacity");
		for (var k=0; k < selects.length; k++) {
				selects[k].style.visibility = "visible";
			}
	map.style.display = 'none';
	opacitys.style.display = 'none';	
	return false;
} 


window.onresize = function(){
	return PopupResize();
}

function PopupResize(div) {
	var opacity_container = document.getElementById("opacity");
	opacity_container.onclick = function () { PopupOff(div); }
	var body_container = document.getElementById("body");
	if (opacity_container && body_container) {
		opacity_container.style.height = body_container.offsetHeight + "px";
		opacity_container.style.width = body_container.offsetWidth + "px";
	}
}

var oldDiv, oldHeader;
function HideNewsBlock( td, div, box )
{
	if( !oldDiv )
	{
		allBlock = document.getElementById( box );
		var blocks = allBlock.getElementsByTagName('div');
		
		for( var i=0;i<blocks.length;i++ )
		{
			if( blocks[i].className == 'information' )
			{
				if( blocks[i].style.display == '' )oldDiv = blocks[i];
			}
		}
		
		allBlock = document.getElementById( 'inset_header' );
		blocks = allBlock.getElementsByTagName('td');
		
		for( var i=0;i<blocks.length;i++ )if( blocks[i].className == 'active tab' )oldHeader=blocks[i];
	}
	
	if( oldDiv )
	{
		oldDiv.style.display = 'none';
		if( oldHeader.className =='active' )oldHeader.className = 'last';
			else oldHeader.className = 'tab';
	}
	var newDiv = document.getElementById( div );

	newDiv.style.display = '';
	td.className = td.className + " active";
	
	oldDiv = newDiv;
	oldHeader = td;	
	return false;
}

