$(document).ready(function() {
	
	shoutboxInterval = setInterval(shoutboxRefresh,10000);
	shoutboxRefresh();
	$('#shoutboxPosting').hide();
	
	//Shoutbox standaard text legen
	$('#shoutboxInput').click(
		function(){
			if( $(this).val() == 'Typ hier je bericht' ){
				$(this).val('');
			}
		}
	);
	
	//Verzenden shoutbox bericht
	$('#shoutboxLink').click(function(){
		
		var waarde = $('#shoutboxInput').val();
		
		$('#shoutboxPost').slideUp('fast', function(){
			$('#shoutboxPosting').slideDown('fast');
		});
		
		var aantal = waarde.length;
		
		$.ajax({
		type: "POST",
		url: "shoutbox/send/",
		data: "val="+waarde,
		success: function(msg){
			
			var browserName=navigator.appName; 

			if (browserName=="Microsoft Internet Explorer")
			{
				top.location.href = '/live/live/index.php/index.php';


			}else{
			
				shoutboxRefresh();
			
				$('#shoutboxInput').val('Typ hier je bericht');
				$('#shoutDone').html(msg);

				$('#shoutboxPosting').slideUp('fast',function(){
					$('#shoutboxPost').slideDown('fast', function(){
						$('.fleft nom').fadeOut(4000,function(){
							$(this).empty();
						})
					});
				});
			}
		}
		});
		
	})
	function shoutboxRefresh(){
	
		var browserName=navigator.appName; 
		
		if (browserName != "Microsoft Internet Explorer")
		{
	
		$.get("http://www.ajaxclub.nl/live/live/index.php/shoutbox/recieveMessages",
		function(data){
			$('#shouts').html(data);
		});
		
		}

	}


	
});