$(window).load(function() {
    $('.slider').nivoSlider({
			effect: 'boxRandom',
			boxCols: 10,
			boxRows: 4,
			pauseTime: 10000,
			directionNav: false
		});
		
		$('.gallery a').slimbox({
			counterText: false,
			overlayOpacity: 0.7
		});
		
		
		var ytPopup = $('<div class="yt_popup"></div>')
			.append('<div class="background"></div>')
			.append(
				$('<div class="popup"></div>')
					.append('<a href="" class="exit"></a>')
					.append(
						$('<div class="content"></div>')
							.append($('<iframe></iframe>').hide())
					)
			)
			.hide()
			.appendTo('body');
			
		ytPopup.find('.exit, .background').click(function() {
			ytPopup.fadeOut(500);
			ytPopup.find('iframe').attr('src', '').hide();
			return false;
		});
			
		$('.videos a').each(function() {
			$(this).click(function() {
				ytPopup.find('iframe').attr('src', 'http://www.youtube.com/embed/'+$(this).data('yt-id')+'?hd=1');
				//alert('http://www.youtube.com/embed/'+$(this).data('yt-id')+'?hd=1')
				//http://www.youtube.com/watch?v=HemKMxisXg0&feature=player_embedded
				//http://www.youtube.com/embed/HemKMxisXg0?rel=0&hd=1
				ytPopup.fadeIn(500, function() {
					ytPopup.find('iframe').show();
				});
				return false;
			});
		});
		
		
		
		
		$('input[type=text], input[type=email], input[type=password], textarea').placeholder();
		
		
		
		// IE
		if(/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) {
			$('.card address div').prepend('<div class="icon"></div>');
			$('.left_column nav').append('<div class="clear"></div>');
			$('.quick_find .columns').append('<div class="clear"></div>');
		}
});




// HTML5 in IE
if(/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) {
	(function(){
		var html5elmeents = ['address','article','aside','audio',
			'canvas','command','datalist','details','dialog',
			'figure','figcaption','footer','header','hgroup',
			'keygen','mark','meter','menu','nav','progress',
			'ruby','section','time','video'];
		for(var i = 0; i < html5elmeents.length; i++){
			document.createElement(html5elmeents[i]);
		}
	})();
}
