// JavaScript Document
// requires jquery.1.3.2
// requires jquery.random.js
// author: kristof vandommele
// www.tales.be



$(document).ready(function(){
						
							$('.kader').hide();	
							$('.description').hide();	
							
							
							// add class left/right/bottom to each case (random)
							// to control the direction of the info on hover
							$('.case').each(function(index) {
								var randomDirection = $.randomBetween(1, 3);
								//alert(randomDirection);
								if (randomDirection == 1){
									//alert('left');
									$(this).addClass('left');
									//this.hide();
									}
								if (randomDirection == 2){
									//alert('right');
									$(this).addClass('right');
									}
								if (randomDirection == 3){
									//alert('bottom');
									$(this).addClass('bottom');
									}
							  });
														   
							$('#workgrid .bottom').hover(
								function(){
									$(this).children('.kader').fadeIn('normal');
									$(this).children().next().next('.description').show();
									$(this).children().next().next('.description').animate(
										{
											top: '-168px'
										  }, 300, function() {
											// Animation complete.
										  }												   
										);
								})	
										
															   
							$('#workgrid .right').hover(
								function(){
									$(this).children().next('.kader').fadeIn('normal');
									$(this).children().next().next('.description').show();
									$(this).children().next().next('.description').animate(
										{
											left: '7px'
										  }, 300, function() {
											// Animation complete.
										  }												   
										);
								})	
											
															   
							$('#workgrid .left').hover(
								function(){
									$(this).children().next('.kader').fadeIn('normal');
									$(this).children().next().next('.description').show();
									$(this).children().next().next('.description').animate(
										{
											left: '7px'
										  }, 300, function() {
											// Animation complete.
										  }												   
										);
								})	
										
										
										
										
										
										
							$('#workgrid .bottom').children().next('.kader').mouseout(
								function(){
									//alert('boe');
									$(this).fadeOut('normal');
									$(this).next('.description').hide();
									$(this).next('.description').animate(
										{
											top: '-134px'
										  }, 300, function() {
											// Animation complete.
										  }												   
										);
									
								})				
										
										
										
							$('#workgrid .right').children().next('.kader').mouseout(
								function(){
									//alert('boe');
									$(this).fadeOut('normal');
									$(this).next('.description').hide();
									$(this).next('.description').animate(
										{
											left: '192px'
										  }, 300, function() {
											// Animation complete.
										  }												   
										);
									
								})				
										
										
										
							$('#workgrid .left').children().next('.kader').mouseout(
								function(){
									//alert('boe');
									$(this).fadeOut('normal');
									$(this).next('.description').hide();
									$(this).next('.description').animate(
										{
											left: '-192px'
										  }, 300, function() {
											// Animation complete.
										  }												   
										);
									
								})	
									
	 
						   })
