$(document).ready(function(){
	$('body').addClass('hasJS');
	
	
	
	$('a.fancybox').each(function(){
		var url = $(this).attr('rel');
		var rel = $(this).attr('href');
		
		$(this).attr('rel', rel).attr('href', url);
	});
		
	$("a.fancybox").fancybox({
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
		'hideOnContentClick'	: false,
		'overlayOpacity'		: 0.7
	});
	
	var video1 = 'http://www.youtube.com/v/fVkvDA_ITEQ?fs=1&amp;hl=en_US';
	var video2 = 'http://www.youtube.com/v/w8aqH4q2Wzw?fs=1&amp;hl=en_US';
	var video3 = 'http://www.youtube.com/v/_C1BH0lSkOI?fs=1&amp;hl=en_US';
	
	var video = randomFromTo(1,3);
	
	if (video == 1){
		$('#flash').flash({
			src: video1,
			width: '434',
			height: '348'
		}, {update: false});
	} else if (video == 2){
		$('#flash').flash({
			src: video2,
			width: '434',
			height: '348'
		}, {update: false});
	} else if (video == 3){
		$('#flash').flash({
			src: video3,
			width: '434',
			height: '348'
		}, {update: false});
	}
	
	$('.social-icon').hover(function(){
		$('img',$(this)).stop().animate({'bottom':'5px'},200);
	}, function(){
		$('img',$(this)).stop().animate({'bottom':'0'},200);
	});	
});

function randomFromTo(from, to){
   return Math.floor(Math.random() * (to - from + 1) + from);
}
