var rollover_current = null;

function rollover_image (name, name2, target, href, layer)
{
	this.path = "fileadmin/oei_org_interface";
	this.ext = "gif";
	this.postfix = "RO";

	this.name = name;
	this.name2 = name2;
	this.img = null;
	this.img2 = null;
	this.target = target;
	this.href = href;
	this.layer = layer;

	this.preload = rollover_preload;
	this.over = rollover_over;
	this.out = rollover_out;
	this.click = rollover_click;

	this.is_preloaded = false;
}

function rollover_preload ()
{
	if (document.images)
	{
		if (this.name)
		{
			this.img = new Image();
			this.img.src = this.path + "/" + this.name + "_" + this.postfix + "." + this.ext;
			this.img2 = new Image();
			this.img2.src = this.path + "/" + this.name2 + "." + this.ext;
		}
		this.is_preloaded = true;
	}
}

function rollover_over ()
{
	if (!this.is_preloaded)
		return;

	var img = document.images[this.name];

	if (this.href)
	{
		if (img && this.img)
			img.src = this.img.src;
	}
}

function rollover_out ()
{
	if (!this.is_preloaded)
		return;

	var img = document.images[this.name];

	if (this.href && this != rollover_current)
	{
		if (img)
			img.src = this.path + "/" + this.name + "." + this.ext;
	}
}

function rollover_click ()
{
	var img, target, last;

	if (typeof layer_show == "function")
		layer_show (this.layer);

	if (this.href)
	{
		last = rollover_current;
		rollover_current = this;

		if (last != null && last != this)
			last.out ();

		img = document.images["sub_top_title"];
		if (this.img2 && img)
			img.src = this.img2.src;

		if (this.target)
			target = top.frames[this.target];
		else
			target = top;

		if (target)
			target.location = this.href;
	}
}

function rollover_set_preload (set)
{
	if (typeof set == "object")
		for (i = 0; i < set.length; i++)
			if (set[i])
				set[i].preload ();
}

