/**
 * @author Mateusz 'MatheW' Wójcik
 */

window.addEvent('domready', function(){
    
   $('contactForm').onsubmit= function(){
	   Loading();
	   
   		$('contactForm').send({
			onComplete: function(){
   				destroyLoading();
   				Info();
				eval("var resp=" + this.response.text);
				var x=new Element('p');
				x.innerHTML=resp.message;
				x.injectInside($('info'));
				var tmp=new Element('input');
				tmp.type='button';
				tmp.value='Zamknij';
				tmp.onclick=function(){destroyInfo();}
				tmp.injectInside($('info'));
				if(resp.reset==1){
					$('contactForm').reset();
				}
				}
		});
   		
   		
		return false;		
   }
   
   $('all').setStyle('height', window.getHeight());
   
});
