$(document).ready(function(){
	//Set Full Background
	setTimeout(function(){
		$('.fbg').fullBg();				
	},200)
	
	
	//Find sections and append bottom 15degree image to it
	$.each($('.w1, .w2, .w3, .w4, .w5'), function(){
		var c = $(this).attr('class');
		var color;
		var newclass;
		var newimage;
		if(c.indexOf('nob') == -1)
		{
			if(c.indexOf('yellow') != -1){ color = 'yellow' }
			if(c.indexOf('white') != -1){ color = 'white' }
			if(c.indexOf('w1') != -1){ newclass = 'b1'; newimage = 'b_w1_'+color+'.png' }
			if(c.indexOf('w2') != -1){ newclass = 'b2'; newimage = 'b_w2_'+color+'.png' }
			if(c.indexOf('w3') != -1){ newclass = 'b3'; newimage = 'b_w3_'+color+'.png' }
			if(c.indexOf('w4') != -1){ newclass = 'b4'; newimage = 'b_w4_'+color+'.png' }
			if(c.indexOf('w5') != -1){ newclass = 'b5'; newimage = 'b_w5_'+color+'.png' }
			
			var bottom = $('<div />').css('background-image', 'url(/images/'+newimage+')').addClass(newclass)
			$(this).append(bottom);
		}
	});
	
	
	//Agenda Clicks //ITEM SMALL IS PICTURE 
	$('.item, .small_item, .item_small, .album, .activiteit, #highlights').live('click',function(){
		var el = $(this);
		var url = el.find('a').attr('href');
		window.location = url;
	})
	
	$('.album').mouseenter(function(){
		$(this).find('img').animate({'opacity':0.7},100);
	}).mouseleave(function(){
		$(this).find('img').animate({'opacity':1},100);
	})
	
	
	//Logo click
	$('.logo').click(function(){
		window.location = '/home';
	})
	
	//Sponsor Click
	$('.sponsor_image img').click(function(){
		var el = $(this);
		var url = el.attr('url');
		var id = el.attr('id');
		$.post('/php/update_clicks.php',{'id':id}, function(data){
			window.open(url, 'Jctodo sponsor', 'toolbar=no, width=980, height=700');
		})
	})
	
})//END DC READY

