/* 
 * system.forms.notification.js
 * version 1.0.1
 * Copyright (C) Jason Mingl (Ratheous)
 *
 * Requires: system.forms.js  2.0.0+
 *
 *	05/03/2007 : 1.0.1 - changed iframe hiding to display:none
 *	04/29/2007 : 1.0.0 - Moved out of system.forms.js v2.1.1
 *
 */

system.forms.warning_notification = new Object;
system.forms.warning_notification.tooltip = function(opts)
{
	this.frame = $(opts.frame);
	this.container = $(opts.container);
	this.x = opts.x;
	this.y = opts.y;
	this.initialized = false;
	this.message = "";
	this.field_message = function(f)
	{
		if(!(f instanceof system.forms.field))
			{ this.hide(); return; }
		if(f.warning || f.error)
			this.show(f.message_target, f.message);
		else { this.hide(); }
	};
	this.show = function(target, message)
	{
		var offset = system.tools.get_elem_offset(target);
		system.tools.set_elem_position(this.frame, offset.left + this.x, offset.top + this.y);
		if(this.container.innerHTML != message)
			this.container.innerHTML = message;
		this.frame.style.visibility = "visible";
		this.iframe = system.tools.iframe_shim(this.frame, "iFrameShimElement");
	};
	this.hide = function() { this.frame.style.visibility = "hidden"; if(this.iframe){this.iframe.style.display = "none";} };
}; var form_tooltip = system.forms.warning_notification.tooltip;