//kontaktskjema slide forside
$(document).ready(function(){
	$("#ansett_meg").hover(function()	{
		$("#ansett_meg_top").slideUp('fast')
	});
	$("span.down").click(function()	{
		$("#ansett_meg_top").slideDown('fast')
	});
});

//scrol to top
$(document).ready(function() {
    $('#top').click(function () {
		$('#wraper').animate({
			scrollTop: 0
		}, 800);
		return false;
	});
});

//add class to contact field
$(function()	{
	$('textarea').change(function()	{
		$('textarea').addClass("no_display");
		console.log('hey');
	} );
});

//portefolio overlay
/*
$(function(){
	$over = $('.port_over');
	$('.arbeid').hover(function(){
			$over.stop(true, true).fadeIn(300);
		},
		function () {
			$over.fadeOut(300);
		}
	);	
});
*/

//kontakt side slide down
$(function(){
	$("#kontakt_mer").click(function () {
		if ($("#kontakt_advanced").is(":hidden")) {
			$("#kontakt_advanced").slideDown("1000");
		} 
		else {
       		$("#kontakt_advanced").slideUp("1000");
   		}
   	});
});

$(function(){
	$main = $(".port");
	$(".web").click(function () {
		
		if($($main).is(":hidden"))	{
			$main.fadeIn('slow');
		}
		else	{
			$main.fadeOut('slow');
			$('html, body').animate({scrollTop:0}, 'middel');
			$main.fadeIn('slow');
			return false;
		}
   	});
    $('textarea.text_large').autoResize({
	    // On resize:
	    onResize : function() {
	    	animate : true
	        $(this).css({opacity:0.8});
	        
	    },
	    // After resize:
	    animateCallback : function() {
	        $(this).css({opacity:1});
	    },
	    // Quite slow animation:
	    animateDuration : 500,
	    // More extra space:
	    extraSpace : 14
	});
});
