/**
 * @author reeko
 */

var ErrorBox = {
	box:null,
	header:null,
	title:null,
	text:null,
	button:null,
	defaultTitle:null,
	defaultText:null,
	
	init:function()
	{
		if(this.box === null)
		{
			this.box = $('errorBox');
			this.header = $("errorBox_header");
			this.title = $('errorBox_title');
			this.text = $('errorBox_text');
			this.button = $('errorBox_button');
			this.defaultHeader=this.header.innerHTML;
			this.defaultTitle=this.title.innerHTML;
			this.defaultText=this.text.innerHTML;
		}
	},
	
	show:function()
	{
		this.init();
		
		this.header.innerHTML = this.defaultHeader;
		
		this.button.style.display = "block";
		
		switch (this.show.arguments.length) {
			case 1:
				this.title.innerHTML = this.defaultTitle;
				this.text.innerHTML = this.show.arguments[0];
				break;
			case 2:
				this.title.innerHTML = this.show.arguments[0];
				this.text.innerHTML = this.show.arguments[1];
				break;
			default:
				this.title.innerHTML = this.defaultTitle;
				this.text.innerHTML = this.defaultText;
				break;
		}
		Overlay.show(this.box);
	},
	
	preloader:function()
	{
		this.init();
		this.header.innerHTML = TEXTS['Bitte_warten_Sie'];
		this.title.innerHTML = TEXTS['Das_Formular_wird_für_den_Versand_vorbereitet'];
		this.text.innerHTML = "";
		this.button.style.display = "none";
		Overlay.show(this.box);
	},
	
	hide:function()
	{
		Overlay.hide();
	}
}
