// JavaScript Document
$(document).ready(function(){
  $("#left-column").accordion({ active: false, autoHeight: false, navigation: true, alwaysOpen: false, animated: "slide",header: '.accordion_toggle' });
  $("#vertical_nested_container").accordion({ active: true, autoHeight: true, navigation: true, alwaysOpen: false, animated: "bounceslide",header: '.vertical_accordion_toggle' });
  $(".accordion_toggle").click(function(event){ window.location.hash=this.hash; });	
  $("#login").accordion({ active: true, autoHeight: false, navigation: true, alwaysOpen: false, animated: "slide",header: '.login_toggle' });
  $("#media_container").load("/media/video.php?yt=wcYFShfyNao");
  $("#events").load("/media/event.php"); 
  $(".noisiagame").colorbox({width:"1118", height:"700", iframe:true});
  $(".pictureviewer").colorbox({});
  $(".newslink").colorbox({width:"700", height:"470", iframe:true});

  $('input[type="text"],input[type="password"]').addClass("loginfield");
  $('input[type="text"],input[type="password"]').focus(function() {
	  $(this).removeClass("loginfield").addClass("loginfieldFocus");
	  if (this.value == this.defaultValue){ 
		  this.value = '';
	  }
	  if(this.value != this.defaultValue){
		  this.select();
	  }
  });
  $('input[type="text"],input[type="password"]').blur(function() {
	  $(this).removeClass("loginfieldFocus").addClass("loginfield");
	  if ($.trim(this.value) == ''){
		  this.value = (this.defaultValue ? this.defaultValue : '');
	  }
  });
  
});
  
function loadVideo(yt) {
  $("#media_container").load("/media/video.php?yt="+yt+"");
}

function loadDate(m,j,s) {
  $("#calendar").load("/news/calendar.php?maand="+m+"&jaar="+j+"&stamp="+s+"");
}

function showsPage(page) {
    $("#events").load("/media/event.php?page="+page+"");
}
  

function embedPlayer() {
    var params = { allowScriptAccess: 'always', bgcolor: '#97989C' };
    var atts = { id: 'myytplayer' };
    swfobject.embedSWF('http://www.youtube.com/p/52AFF4ADCE11B45E&hl=en_GB&hd=1&enablejsapi=1&amp;playerapiid=ytplayer', 
            'ytapiplayer', '629', '377', '8', null, null, params, atts);
}

function onYouTubePlayerReady(playerId) {
    ytplayer = document.getElementById('myytplayer');
    setInterval(updateytplayerInfo, 250);
    updateytplayerInfo();
    ytplayer.addEventListener('onStateChange', 'onytplayerStateChange');
}
  