/*--------------------------------------------------------------------------------------------------------------*/
function OpenWindow (win_href, win_title, win_width, win_height, win_center, with_scrollbars, win_resizable, with_bar)
{

	if (win_height > screen.availHeight - 50)
		win_height = screen.availHeight - 50;

	win_width = win_width - 0;
	if (with_scrollbars == 'true')
	{
		win_width += 20;
	}
	
	var win_flags = "width=" + win_width + ",height=" + win_height;
	win_flags += ",resizable=yes,dependent=yes";
	
	if (with_scrollbars == 'true')
	{
		win_flags += ",scrollbars=yes";
	}
	
	if (win_center)
	{
		var win_left = Math.ceil ((screen.availWidth - win_width) / 2);
		var win_top  = Math.ceil ((screen.availHeight - win_height) / 3);
		win_flags	+= ",left=" + win_left + ",top=" + win_top;
	}
	
	win_flags += ",resizable=" + ((win_resizable == "true") ? "yes" : "no");
	win_flags += ",location=" + ((with_bar == "true") ? "yes" : "no");
	win_flags += ",menubar=" + ((with_bar == "true") ? "yes" : "no");
	win_flags += ",toolbar=" + ((with_bar == "true") ? "yes" : "no");

//	alert (win_flags);
	 
	window.open (win_href, win_title, win_flags);
}


/*--------------------------------------------------------------------------------------------------------------*/
function FIND(item) 
{
	if( window.mmIsOpera ) return(document.getElementById(item));
	if (document.all) return(document.all[item]);
	if (document.getElementById) return(document.getElementById(item));
	return(false);
}


/*--------------------------------------------------------------------------------------------------------------*/

function ShowPara (para_name)
{
	var para = FIND (para_name);

	if (para)
	{
		if (para.style.visibility != "visible")
		{
			para.style.visibility = "visible";
			para.style.display = "block";
		}
		else
		{
			para.style.visibility = "hidden";
			para.style.display = "none";
		}
	}
}


/*--------------------------------------------------------------------------------------------------------------*/
function SwapMenuIcon(icon_image)
{
	var srcname = icon_image.src;
	var gif_pos = srcname.indexOf (".gif");
	var name_pos = srcname.indexOf ("_open");
	var newname = "";
	if (name_pos >= 0)
		newname = srcname.substr (0, name_pos) + "_close";
	else
	{
		name_pos = srcname.indexOf ("_close");
		newname = srcname.substr (0, name_pos) + "_open";
	}
	newname += ".gif";
	icon_image.src = newname;
}

/*--------------------------------------------------------------------------------------------------------------*/

function HighLight (id, on)
{
	var elem = document.getElementById(id);
	if (elem) 
	{
		elem.style.color = on ? '#ff0000' : '#666666';
	}
}

/*--------------------------------------------------------------------------------------------------------------*/

function GetQueryValue (query_name)
{
	var result = "";
	var url_str = document.location.href;
	var query_pos = url_str.indexOf ("?") + 1;
	if (query_pos >= 0)
	{
		var query_str = url_str.substr (query_pos);
		
		if (query_name != "")
		{
			var query_collection = query_str.split ("&");
			var single_query_str;
			var single_query;
			var query_val;
			var found = false;
			
			for (var i = 0; i < query_collection.length && !found; i++)
			{
				single_query= query_collection [i].split ("=");
				if (single_query[0] == query_name)
				{
					query_val = single_query[1] + "";
					if (query_val != "undefined")
					{
						result = query_val;
					}
					found = true;
				}
			}
		}
		else
		{
			result = query_str;
		}
		return unescape (result);
	}
}

/*--------------------------------------------------------------------------------------------------------------*/

function GoHyperlinkBox (box_id)
{
	if (box_id.value != "")
	{
		var url_array = box_id.value.split ("|");
		if (url_array[1] == "")
		{
			window.location.href = url_array[0];
		}
		else
		{
			window.open (url_array[0], url_array[1]);
		}
	}
}