$(document).ready(function(){
						   
	$('#tagline').text($('#whats-new .mtc-tagline').text());
	
	$('#overlay').hide();
	$('.mtc-modal').hide();
	$('.mtc-modal-int').hide();
	$('.mtc-modal-close').hide();
	$('#overlay').removeClass('noshow');
	$('.mtc-modal').removeClass('noshow');
	$('#overlay').click(function(){
		$('.mtc-modal').hide();
		$('#overlay').hide();
	});
	$('.mtc-modal-close a').click(function(){
		$('.mtc-modal').hide();
		$('#overlay').hide();
	});
	
	$('#card-container .card-img-container img, #card-container .card-img-container h2').click(function(){
		var pos = $(this).parent().parent().position();		
		var card = $(this).parent().parent().attr('card');
		var cardID = $(this).parent().parent().attr('id');
		var getz = $(this).parent().parent().css('zIndex');
		var getW = $(this).parent().parent().width();
		var getH = $(this).parent().parent().height();
		var ww = ($(window).width()-515)/2;
		var wh = ($(window).height()-360)/2;
		
		$('#tagline').text($('.mtc-tagline',card).text());		
		$(this).parent().parent().siblings('.front-center')
			.animate({'top':pos.top,'left':pos.left,'zIndex':getz},	 200,  'easeInQuad').removeClass('front-center');
		$(this).parent().parent().removeClass('front-center')
			.animate({'top':90,'left':330,'zIndex':202},
					 200,
					 'easeInQuad',
					 function(){
						$(card).css({'top':wh,'left':ww+150,'width':'300px','height':'337px','opacity':0})
						.show().delay(100)
						.animate({'width':'515px','height':'360px','opacity':1,'left':ww});
						$('> .mtc-modal-int',card).delay(350).fadeIn('fast');
						if($.browser.msie){
							$('#overlay').css({'background':'#000','filter':'alpha(opacity=40)','display':'block'});
						}else{
							$('#overlay').delay(520).fadeIn('fast');	
						}
						$(card).mouseenter(function(){
							$('> .mtc-modal-close',this).delay(200).fadeIn('fast');
						});
						$('> .mtc-modal-close',card).mouseover(function(){
							$(this).show();
						});
						$(card).mouseleave(function(){
							$('> .mtc-modal-close',this).delay(200).fadeOut('fast');
						});
				})
			.addClass('front-center');
	});
	
	/*$('#sign-in').click(function(){
		var ww = ($(window).width()-515)/2;
		var wh = ($(window).height()-460)/2;
		$('#sign-in-modal .mtc-modal-int').show();
		$('#sign-in-modal').css({'top':wh,'left':ww+150,'width':'300px','height':'337px','opacity':0}).show()
			.animate({'width':'515px','height':'460px','opacity':1,'left':ww});
		$('#overlay').delay(520).fadeIn('fast');
		$('#sign-in-modal').mouseenter(function(){
			$('> .mtc-modal-close',this).delay(200).fadeIn('fast');
		});
		$('> .mtc-modal-close','#sign-in-modal').mouseover(function(){
			$(this).show();
		});
		$('#sign-in-modal').mouseleave(function(){
			$('> .mtc-modal-close',this).delay(200).fadeOut('fast');
		});
	});*/
	
	$('#card-container .card-img-container').mouseenter(function(){
		if($.browser.msie){
			$(this).animate({'top':-5});
			$(this).children('.img-glass').animate({'top':10});
		}else{
			$(this).animate({'top':-5});
			$(this).children('.img-glass').animate({'top':10,'opacity':.4});			
		}
	});
	
	$('#card-container .card-img-container').mouseleave(function(){
		var pos = $(this).position();
		if($.browser.msie){
			$(this).animate({'top':pos.top+5});	
			$(this).children('.img-glass').animate({'top':0});
		}else{
			$(this).animate({'top':pos.top+5});
			$(this).children('.img-glass').animate({'top':0,'opacity':1});			
		}		
	});	
	
	$('#google-search').focusin(function() {
         $('.search').addClass('logo-off');
    });
	
	$('#google-search').focusout(function() {
        if($(this).val()==''){
			$('.search').removeClass('logo-off');
		}else{}
    });
});

