function hide_div( itm )
{
	if ( ! itm ) return;
	
	itm.style.display = "none";
}

function show_div( itm )
{
	if ( ! itm ) return;
	
	itm.style.display = "";
}

function change_display ( name, level_id, sublevel_id, count, level_pressed )
{
	if ( level_pressed == "1")
	{
		itm1 = document.all[ name + "_" + level_id ];
		if ( !itm1 ) return;

		if ( itm1.style.display == "none" )
		{
			itm2 = document.all[ name + "_" + level_id + "_0" ];
			if ( !itm2) return;
			itm1.style.display = "";
			itm2.style.display = "";

			setcolor_menu1 ( "lev", level_id, "#F66B19" );
			setcolor_menu2 ( "lev", level_id, "0", "#929497" );
		}
		else
		{
			itm1.style.display = "none";
			setcolor_menu1 ( "lev", level_id, "#009BEE" );

			for ( var i = 0; i < count; i++)
			{
				itm2 = document.all[ name + "_" + level_id + "_" + i ];
				if ( !itm2 ) return;
				itm2.style.display = "none";
				setcolor_menu2 ( "lev", level_id, i, "#F66B19" );
			}
		}
	}
	else
	{
		itm1 = document.all[ name + "_" + level_id ];
		if ( !itm1 ) return;
		itm2 = document.all[ name + "_" + level_id + "_" + sublevel_id ];
		if ( !itm2) return;

		if ( itm1.style.display == "none" )
		{
			itm1.style.display = "";
			itm2.style.display = "";

			setcolor_menu1 ( "lev", level_id, "#F66B19" );
			setcolor_menu2 ( "lev", level_id, sublevel_id, "#929497" );
		}
		else
		{
			if ( itm2.style.display == "none" )
			{
				for ( var i = 0; i < count; i++)
				{
					itm3 = document.all[ name + "_" + level_id + "_" + i ];
					if ( !itm3 ) return;
					itm3.style.display = "none";
					setcolor_menu2 ( "lev", level_id, i, "#F66B19" );
				}

				itm2.style.display = "";
				setcolor_menu2 ( "lev", level_id, sublevel_id, "#929497" );
			}
			else
			{
				itm1.style.display = "none";
				itm2.style.display = "none";
				setcolor_menu1 ( "lev", level_id, "#009BEE" );
				setcolor_menu2 ( "lev", level_id, sublevel_id, "#F66B19" );
			}
		}

	}

}

function setcolor_menu1 ( name, level_id, color )
{
	itm = document.all[ name + "_" + level_id ];
	if ( ! itm ) return;

	itm.style.backgroundColor = color;
}

function setcolor_menu2 ( name, level1_id, level2_id, color )
{
	itm = document.all[ name + "_" + level1_id +"_" + level2_id ];
	if ( ! itm ) return;

	itm.style.color = color;

//	alert(itm.style)
//document.write (show_props(itm.style, id))
}

function show_props(obj, obj_name)
{
   var result = "";
   for (var i in obj)
      result += obj_name + "." + i + " = " + obj[i] + "<br>";
   return result;
}

function ChangeColors()
{
	if ( (document.body.style.backgroundColor == "#000000") || (document.body.style.backgroundColor == "") || ( document.body.style.backgroundColor == "rgb(0, 0, 0)" ) )
	{
//	alert ('111');
		document.body.style.backgroundColor = "#FFFFFF";
		document.body.style.color = "#000000";
		document.all['colors_button'].style.backgroundColor = "#000000";
		document.all['colors_button'].style.color = "#FFFFFF";
		document.all['logo_img'].src = "img/cleardesign_logo_white.gif";
		document.all['pipe'].style.display = "none";
		document.all['white_btn'].style.display = "none";
		document.all['black_btn'].style.display = "";
	}
	else
	{
//	alert ('222');
		document.body.style.backgroundColor = "#000000";
		document.body.style.color = "#FFFFFF";
		document.all['colors_button'].style.backgroundColor = "#FFFFFF";
		document.all['colors_button'].style.color = "#000000";
		document.all['logo_img'].src = "img/cleardesign_logo.gif";
		document.all['pipe'].style.display = "";
		document.all['white_btn'].style.display = "";
		document.all['black_btn'].style.display = "none";
	}
//	document.write(show_props (document.body.style, "style"));
//	alert (document.body.style.backgroundColor);
}

function ChangeImage( id, normal_src, thumb_src )
{
	itm = document.all[ "img_" + id ];
	if ( !itm ) return;

	if ( itm.src.indexOf( "_thumb" ) != -1 )
		itm.src = normal_src;
	else
		itm.src = thumb_src;
//	alert (itm.onclick);
//	document.write( show_props(itm, "img") );
//	itm.onclick = '\'ChangeImage( ' + id +', "' + old_src + '", "' + new_src + '")\'';
//	document.write( show_props(itm, "img") );

}