<!--
Lightware.Mail={
	MailRegex:/^[\w.\_\-]{1,100}@(?:[\w.\-\_]{2,63}\.)+[a-z]{2,6}$/i,
	Window:null,
	Mail:null,
	Message:null,
	Type:null,
	Init:function(){
		this.Window=document.createElement('div');
		this.Window.className='LwMail_Window';
		this.Window.style.width='400px';
		var position=Lightware.GetMiddleOfScreen();
		this.Window.style.left=(position[0]-200)+'px';
		this.Window.style.top=(position[1]-150)+'px';
		var innerWindow='<label>Emailadresse:</label><input id="LwMail_Email" name="email" tye="text" class="LwMail_Email"/>';
		innerWindow+='<label><input type="checkbox" name="copy" checked="checked"/>Kopie dieser Nachricht an meine Emailadresse senden</label>';
		innerWindow+='<label>Nachricht:</label><textarea id="LwMail_Message" name="message" class="LwMail_Message"></textarea>';
		innerWindow+='<div class="LwMail_ButtonHolder"><button type="button" onclick="Lightware.Mail.Submit()">Senden</button>';
		innerWindow+='<button type="Button" onclick="Lightware.Mail.CloseWindow()">Abbrechen</button><input id="LwMail_Type" name="type" type="hidden" /></div>';
		this.Window.innerHTML=innerWindow;
		Lightware.$('LwFormContainer').insertBefore(this.Window,Lightware.$('LwFormContainer').firstChild);
		this.Mail=Lightware.$('LwMail_Email');
		this.Message=Lightware.$('LwMail_Message');
		this.Type=Lightware.$('LwMail_Type');
		this.Mail.focus();
	},
	CloseWindow:function(){
		if (this.Window!=null){
			Lightware.$('LwFormContainer').removeChild(this.Window);
		}
	},
	Submit:function(){
		//if (this.Mail==null) this.Mail=Lightware.$('LwMail_Email');
		//if (this.Message==null) this.Message=Lightware.$('LwMail_Message');
		var mail=trim(this.Mail.value);
		var message=trim(this.Message.value);
		var ok=true;
		if (!mail.match(this.MailRegex)){
			var error=document.createElement('div');
			error.innerHTML='Die Emailadresse ist ungültig!';
			error.className='LwMail_Error';
			this.Window.insertBefore(error,this.Window.getElementsByTagName('label')[1]);
			ok=false;
		}
		if (message==''){
			var error=document.createElement('div');
			error.innerHTML='Die Nachricht darf nicht leer sein!';
			error.className='LwMail_Error';
			this.Window.insertBefore(error,this.Window.lastChild);
			ok=false;
		}
		if (ok){
			var form=document.forms[0];
			form.submit();
		}
	},
	MessageSent:function(){
		this.Window=document.createElement('div');
		this.Window.className='LwMail_Window';
		this.Window.style.width='400px';
		var position=Lightware.GetMiddleOfScreen();
		this.Window.style.left=(position[0]-200)+'px';
		this.Window.style.top=(position[1]-150)+'px';
		this.Window.innerHTML='<div class="LwMail_Sent">Ihre Nachricht wurde versandt, wir melden uns in kürze.</div>';
		Lightware.$('LwFormContainer').appendChild(this.Window);
		setTimeout('Lightware.Mail.CloseWindow()',2000);
	},
	Error:function(){
		this.Window=document.createElement('div');
		this.Window.className='LwMail_Window';
		this.Window.style.width='400px';
		var position=Lightware.GetMiddleOfScreen();
		this.Window.style.left=(position[0]-200)+'px';
		this.Window.style.top=(position[1]-150)+'px';
		this.Window.innerHTML='<div class="LwMail_Sent">Ihre Nachricht konnte nicht versandt werden.</div>';
		Lightware.$('LwFormContainer').appendChild(this.Window);
		setTimeout('Lightware.Mail.CloseWindow()',2000);
	}
}
//-->