
$(document).ready(function() {

console.log('0');
  $.getJSON('http://twitter.com/status/user_timeline/devuurwerkbril.json?count=10&callback=?', function(res, i) {
    var items = [];
console.log('a');
    $.each(res, function(key, val) {

      timestamp = new Date(val.created_at);

      var curr_min = timestamp.getMinutes();
      curr_min = curr_min + "";      
      if (curr_min.length == 1) { curr_min = "0" + curr_min; }

      datestring = timestamp.getDate() + '-' + (timestamp.getMonth()+1) + '-' + timestamp.getFullYear() + ' ' + timestamp.getHours() + ':' + curr_min;

      items.push('<span><small>' + datestring + '</small> <a href="http://twitter.com/#!/devuurwerkbril/status/'+val.id_str+'" target="_blank">' + val.text + '</a></span>');
    });

    $("marquee").html(items.join(''));
    $('marquee').marquee();

  });
  	
	$("#header").corner('4px');
	/*$("#content").corner('4px');*/
	
	$(".streepjesode input").focus(function(){
		val = $(this).val();
		rel = $(this).attr('rel');
		
		if(val == rel){
			$(this).val('');
			$(this).css('color','#000');
		}
			
	});

	$(".streepjesode input").blur(function(){
		val = $(this).val();
		rel = $(this).attr('rel');

		if (val == ''){
			$(this).val(rel);
			$(this).css('color','#888');
		}
	});


	
	$('#slide_summer_led').cycle({ 
	    fx:   'scrollLeft',
	    delay: 1000 
	});
	
	$('#slide_partners').cycle({ 
	    fx:   'scrollLeft',
	    delay: 1000 
	});
	
	
	
	$("#gobutton").click(function(){
		
		code = $("input#streepjescode").val();
		rel = $("input#streepjescode").attr('rel');
		if(rel == code){
			alert('Voer een geldige code in');
		} else {
			location.href = '/actie/meedoen.html?code='+code;
		}
		
	});
	
});
