$(function() {

				
	$('#forsidescroll').newsScroll({
		speed: 500,
		delay: 7000
	});

	$('div.galimg a').lightBox({fixedNavigation:true});

	$("input#TilmeldButton").click(function() { 
		$.ajax({
			type: "POST",
			url: "/signup.php",
			data: "email="+$("#mail").val(),
			success: function(msg){
			 	if (msg=="ok") {
					$("#mail").animate({opacity: 0}, 500, "linear", function() {$("#mail").remove()});
					$("#Nyhedsbrev div").html('<p style="color:#fff; font-size:14px; font-weight:bold;">Du er nu tilmeldt!</p>');
				} else {
					alert("Der skete en fejl!");
				}
			}
		});
	});
	
	$('a#kodeord').click(function() {
	
		$('div#kodeord').toggle();
	
	});
	
	$('#gensend').click(function() {
		
		$.ajax({

	        type: 'POST',
	        url: '/ajax/gensend.php',
	        data: 'name=' + $('#name').val(),
	
        	success: function(response) {
        		alert(response);
    		}	
		}); 
	
	});
	
	$("#logouploader").fileUpload({
		'uploader':  '/uploadify/uploader.swf', 
  		'script':    '/ajax/logo.php', 
  		'folder':    '/upload/',
  		'cancelImg': '/uploadify/cancel.png',
  		'fileExt':	 '.jpg;.jpeg;.gif;.png',
  		'onComplete':function(event, queueID, fileObj, response, data){
  			$('#image').val(response);
  			$('#preview').html('<img src="'+response+'" style="max-width:270px;" />');
  		}
	});
	
});

function sendComment(id)
{
	
	$.ajax({
		
		type: 'POST',
		url: '/ajax/comments.php',
		data: "id=" + id + "&comment=" + $('#comment').attr('value'),
		success: function(msg){
			
			$('#comments').html(msg);
			
		}
		
	});
	
}

function showCPR()
{
	
	$('#cpr').toggle();
	
}

function removeCmt(id)
{
	
	$.ajax({
		
		type: 'POST',
		url: '/ajax/cmtdelete.php',
		data: 'id='+id,
		
		success: function(msg) {
			
			$('#cmt'+id).fadeOut();
			
		}
		
	});
	
}
