


window.addEvent('domready', function() {
	var el = $('bunn_kontakt');
	
	

	
	/*  Kontaktskjema   */
	document.getElementById('bunn_kontakt').style.visibility = 'visible';
el.fade('hide');	
	
	$('vis_kontakt').addEvent('click', el.fade.bind(el, 'toggle'));
	
	
	
		$('kontaktskjema').addEvent('submit', function(e) {
			//Prevents the default submit event from loading a new page.
			e.stop();
			//Empty the log and show the spinning indicator.
			var log = $('skjema_status').empty().addClass('ajax-loading');
			//Set the options of the form's Request handler. 
			//("this" refers to the $('myForm') element).
			this.set('send', {onComplete: function(response) { 
				log.removeClass('ajax-loading');
				log.set('html', response);
			}});
			//Send the form.
			this.send();
	});
	
	

	/*  Vise/skjule bakgrunn   */
	
	var bak = $('main');
	var meny = $('meny');

	var forsinkelse = function(){ meny.fade('toggle'); };

		
	$('demp').addEvent('click', function() {
	

		bak.fade('toggle');
		forsinkelse.delay(400);
		
	});

	
	/* For menyelementer  */
	$$('.mlink').each(function(postTitle) {
	    postTitle.addEvent('mouseover', function() {
	    
	    this.set('tween', {duration: 200, transition: 'quart:inOut'});
	      this.tween("padding-right", "0", "12px");
	      
	      
	    });
	    postTitle.addEvent('mouseout', function() {
	      
	      this.set('tween', {duration: 300, transition: 'quart:inOut'});
	      this.tween("padding-right", "0");
	    });
	  });

	/* Kontakt-skjema */
	



	
});
