var browser = navigator.appName;
var browserNum = parseInt(navigator.appVersion);

if ((browser == "Netscape") && (browserNum < 5))
	{
		// Netscape 4.x
		layerRef = "document.layers['";
		endLayerRef = "']";
		styleRef = "";
		window_size_ref = "this.inner";
	}
	else if ((browser == "Netscape") && (browserNum >= 5))
	{
		// Netscape 6
		layerRef = "document.getElementById('";
		styleRef = ".style";
		endLayerRef = "')";
		window_size_ref = "this.inner";
	}
	else
	{
		// Internet Explorer
		layerRef = "document.all['";
		endLayerRef = "']";
		styleRef = ".style";
		window_size_ref = "document.body.client";
	}
//moveTo(0, 0);
//resizeTo(screen.availWidth, screen.availHeight);

function change_visible(_name, b_visibility)
{
	var str_visible = "visible"
	if (b_visibility == 0)
	{
		str_visible = "hidden"
	}
	eval(layerRef + _name + endLayerRef + styleRef + ".visibility = '" + str_visible + "'");
}

function change_position(_name, p_x, p_y)
{
	eval(layerRef + _name + endLayerRef + styleRef + ".left = '" + p_x + "'");
	eval(layerRef + _name + endLayerRef + styleRef + ".top = '" + p_y + "'");
}

function change_image(l_name, i_name)
{
	eval(layerRef + l_name + endLayerRef + styleRef + ".background = 'url(img/" + i_name + ")'");
}


function index_modify()
{
	eval("size_x = " + window_size_ref + "Width;");
	eval("size_y = " + window_size_ref + "Height;");

	mn_sx = 340;
	mn_sy = 340;
	tt_sx = 650;
	tt_sy = 41;
	bt_sx = 683;
	bt_sy = 32;
	tp_sx = 119;
	tp_sy = 110;

	mn_x = size_x/2 - mn_sx/2;
	mn_y = size_y/2 - mn_sy/2;
	if (mn_y < tt_sy)
		mn_y = tt_sy;
	tt_x = size_x/2 - tt_sx/2;
	bt_x = size_x/2 - bt_sx/2;
	if (bt_x < 0)
		{
			bt_x = 0;
			mn_x = (bt_sx - mn_sx)/2;
			tt_x = (bt_sx - tt_sx)/2;
		}
	tt_y = 2;
	bt_y = size_y - bt_sy - 3;
	if (bt_y < (mn_y+mn_sy+2))
		bt_y = mn_y+mn_sy+2;
	change_position("main-logo", mn_x, mn_y);
	change_visible("main-logo", 1);
	change_position("top-text", tt_x, tt_y);
	change_visible("top-text", 1);
	change_position("bottom-text", bt_x, bt_y);
	change_visible("bottom-text", 1);
	
	d_x = bt_x/3;

	tp_x = mn_x/2 - tp_sx/2;
	tpr_x = mn_x + mn_sx + tp_x;
	m_y = (bt_y - tt_y - tt_sy - 3*tp_sy)/4;
	tp_y = tt_y + tt_sy + m_y;
	change_position("lt", tp_x - d_x, tp_y);
	change_position("rt", tpr_x + d_x, tp_y);
	tp_y = tp_y + tp_sy + m_y;
	change_position("lc", tp_x + d_x, tp_y);
	change_position("rc", tpr_x - d_x, tp_y);
	tp_y = tp_y + tp_sy + m_y;
	change_position("lb", tp_x - d_x, tp_y);
	change_position("rb", tpr_x + d_x, tp_y);
	
	change_visible("lt", 1);
	change_visible("lc", 1);
	change_visible("lb", 1);
	change_visible("rt", 1);
	change_visible("rc", 1);
	change_visible("rb", 1);
}

function index_load()
{
	index_modify();
	change_image("top-text", "titleup.gif");
	change_image("lt", "lt.jpg");
	change_image("lc", "lc.jpg");
	change_image("lb", "lb.jpg");
	change_image("rt", "rt.jpg");
	change_image("rc", "rc.jpg");
	change_image("rb", "rb.jpg");
}
