jQuery(document).ready(function($) {
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		DD_belatedPNG.fix('.view-cart, .phone, .ico-star, .product, .btn-holder a, .item-btns a, .media .btn, .featured-box, .txt-stockcar, img, .product-desc .btns a');
	};
	
	
	/**
	 * MODALS
	 */
	$('div.modal').jqm({
		toTop: true,
		onShow: function(hash){
			hash.scrollBack = $(window).scrollTop();
			
			$('#YouTubeFrame').html('<iframe width="560" height="349" src="http://www.youtube.com/embed/' + $(hash.t).attr('rel') +  '" frameborder="0" allowfullscreen></iframe>');
			
			$('html, body').animate({scrollTop:0}, function(){
				$('.hover',hash.w).removeClass('hover');
				hash.w.fadeIn();
			});

		},
		onHide: function(hash){
			$('html, body').animate({scrollTop:hash.scrollBack});
			document.stopModalScroll = false;
			hash.w.fadeOut('normal',function(){
				hash.o.remove();
				$('#YouTubeFrame').html('');
			});
		},
		overlay: 80
	});

	$('div.jqmClose').hover(function(){$(this).addClass('hover')},function(){$(this).removeClass('hover')});

	
	if(document.location.hash && document.location.hash.match('preview'))
	{
		$('a.jqModal:first').click();
	}
	
});
