window.addEvent('domready', function(){
	
	/* SLIDER */
	var BugReport_Info = new Fx.Slide('BugReport_Info').hide();
	BugReport_Info.element.style.display='block';
	
	var BugReport_Form = new Fx.Slide('BugReport_Form');
		
	/* ENDE */
	
	/* AJAX */
	var AjaxSendReport = new CJAjax(CJPath + 'info/ajax/',
	{
		OnComplete: function(Output){		
			try{
				if(Output == 'ERROR'){
					throw new Exception();
				}
				
				if(Output!=1){
					BugReport_Form.slideIn();
					BugReport_Info.element.innerHTML='Da ist sogar beim Bugreport ein Fehler aufgetreten... Hmmm, dann am besten eine E-Mail an <a href="mailto:support@cachjudge.com">support@cachejudge.com</a>';
					BugReport_Info.slideIn();
				}
			}catch(e){}
		}
	});
	AjaxSendReport.AddParameter('call', 'AddBugReport');
	AjaxSendReport.AddParameter('message', '');
						
						/* ENDE */
	
	/* EVENTS */
	
	$('BugreportSend').addEvent('click', function(){
		if($('BugreportMessage').value.length<=3){
			BugReport_Info.element.innerHTML = 'Bitte gib Deine Fehlerbeschreibung ein...';
			if(!BugReport_Info.open){
				BugReport_Info.slideIn();
			}
		}else{

			AjaxSendReport.EditParameter('message', $('BugreportMessage').value);
			AjaxSendReport.CallFull();
			
			BugReport_Form.slideOut();
			BugReport_Info.element.innerHTML = 'Danke für Deine Nachricht. Wir werden uns schnellstmöglich darum kümmern.';
			BugReport_Info.slideIn();
		}
		
	});
	
	
	
	

});