
$(document).ready(function(){

	Cufon.replace('div.body h2', { fontFamily: 'eurojet2', hover: false});
	Cufon.replace('body.home div.body p', { fontFamily: 'eurojet2', hover: false});
	Cufon.replace('#content h1', { fontFamily: 'eurojet2', hover: false});
	Cufon.replace('#content #body h2', { fontFamily: 'eurojet2', hover: false});
	Cufon.replace('#content p.parent_title', { fontFamily: 'eurojet2', hover: false});
	Cufon.replace('div.child h2', { fontFamily: 'eurojet2', hover: true});
	Cufon.replace('div.box h2', { fontFamily: 'eurojet2', hover: false});
	Cufon.replace('#menu li h2', { fontFamily: 'eurojet2', hover: false});
	Cufon.replace('div.item h2', { fontFamily: 'eurojet2', hover: true});
	Cufon.replace('#contact #primary h2', { fontFamily: 'eurojet2', hover: true});
	Cufon.replace('#catering h2', { fontFamily: 'eurojet2', hover: true});

//	Cufon.replace('#menu li a', { fontFamily: 'font_eefa', hover: true, textShadow: '#000 1px 1px' });
//	Cufon.replace('#primary h1', { fontFamily: 'font_eefa', hover: false});
//	Cufon.replace('#footer div.box h2', { fontFamily: 'font_eefa', hover: false});


	$('div.empty div.wpcf7').append('<p class="close">close</p>');
	$('div.temporary div.wpcf7').append('<p class="close">close</p>');
	$('div.wpcf7 p.close').click(function(){ $(this).parent().fadeOut(); });
	if ($('div.wpcf7 div.wpcf7-validation-errors').length > 0)
	{
		$('div.wpcf7').fadeIn();
	}
	if ($('div.wpcf7 div.wpcf7-mail-sent-ok').length > 0)
	{
		$('div.wpcf7').fadeIn();
	}

	$('#menu li').hover(function(){
		$(this).addClass('hover');
	},function(){
		$(this).removeClass('hover');
	});


	$mail_content = $('#corporate_cnt div.body').html();
	$('div.send_to_mail textarea').text($mail_content);
	$('p.send_to_mail a').click(function(){
		$('div.wpcf7').fadeIn();
		return false;
	});


	$('#fleet_cnt table td:odd').addClass('odd');
	$('#corporate_cnt table tr:first').addClass('first');
	$('#corporate_cnt table tr').find("td:first").addClass('first');

	$('#corporate_cnt table tr td').each(function(){
		if ($(this).text() != '')
		{
			$(this).addClass('cnt');
		}
	});


$('#fleet_cnt div.item:first').addClass('dont_do_animation');

$('.ajax-link').click(function(){
//	alert(allowClick);

	if ($(this).parent().hasClass('selected'))
	{
	} else {
		if (allowClick){ 
			$('#fleet_cnt div.item').removeClass('selected');
			$(this).parent().addClass('selected');
			if ($('#fleet_cnt div.item').hasClass('dont_do_animation'))
			{
				$('#fleet_cnt div.item').removeClass('dont_do_animation');
			} else {
				allowClick = false; 
			}
			
			$('p.loading').css('display','block');
			
			if ($('#fleet_cnt').hasClass('selected'))
			{
			} else {
			  $('#fleet_cnt').animate(
				{ 
				  height: $('#fleet_cnt').height()+ 420
				},350,function() {
				  $('#fleet_cnt').addClass('selected');
				});
			}

			$('#ajax-content').fadeOut();
			
			if ($(this).attr('id') == 'nr47')
			{
				$('#ajax-content').removeClass();
				$('#ajax-content').addClass('pos_1');
				if ($('#fleet_cnt div.item').hasClass('fisrt'))
				{
				} else {
					document['mymovie'].changePlane(0);
				}
				$('#ajax_content_cnt').load('http://www.eurojet.ro/?page_id=123', 
				function(){
					Cufon.replace('div.fleet_item h2', { fontFamily: 'eurojet2', hover: true}); 
					$('div.ngg-gallery-thumbnail a').lightBox();
					$('#ajax-content').fadeIn();
					$('p.loading').css('display','none');
				});
			} else if ($(this).attr('id') == 'nr44')
			{
				$('#ajax-content').removeClass();
				$('#ajax-content').addClass('pos_2');
				document['mymovie'].changePlane(1);
				$('#ajax_content_cnt').load('http://www.eurojet.ro/?page_id=131', 
				function(){
					Cufon.replace('div.fleet_item h2', { fontFamily: 'eurojet2', hover: true}); 
					$('div.ngg-gallery-thumbnail a').lightBox();
					$('#ajax-content').fadeIn();
					$('p.loading').css('display','none');
				});
			} else if ($(this).attr('id') == 'nr39')
			{
				$('#ajax-content').removeClass();
				$('#ajax-content').addClass('pos_3');
				document['mymovie'].changePlane(2);
				$('#ajax_content_cnt').load('http://www.eurojet.ro/?page_id=140', 
				function(){
					Cufon.replace('div.fleet_item h2', { fontFamily: 'eurojet2', hover: true}); 
					$('div.ngg-gallery-thumbnail a').lightBox();
					$('#ajax-content').fadeIn();
					$('p.loading').css('display','none');
				});
			}
		}
	}
	return false;
});


	$('div.fleet_item h3').live('click',function(){
		$('div.fleet_item *').removeClass('selected');
		$(this).addClass('selected');
		$(this).next().addClass('selected');
	});


	$('#catering h2:first').addClass('selected')
	$('#catering div.body:first').addClass('selected')
	$('#catering h2').click(function(){
		$('#catering *').removeClass('selected');
		$(this).addClass('selected');
		$(this).next().addClass('selected');
	});


	$('#ajax_content_cnt p.close').live('click', function(){
		$current_fleet_cnt = $(this).parent().parent().parent().parent().attr('class');
//		alert($current_fleet_cnt);
		$('#fleet_cnt div.'+$current_fleet_cnt).addClass('dont_do_animation');
		allowClick = true;
		$('#ajax-content').fadeOut();
		$('#fleet_cnt div.item').removeClass('selected');
		$('#fleet_cnt').removeClass('selected');
		$('#fleet_cnt').animate(
			{ 
			  height: $('#fleet_cnt').height() - 420
			},350,function() {
		});
		$('#ajax-content').fadeOut();
	});


	$('#departure_date').datePicker();
	$('#returning_date').datePicker();
	
	$('div.press_release div.child:first').addClass('selected');
//	$('div.child div.body p:first').addClass('selected');	
	
	
	$('div.child div.body').each(function(){
		$(this).children('p:first').addClass('visible');
	});
	
	if ($('#page').hasClass('lang_en')) {
		$('div.press_release div.child div.body').append('<p class="read_more visible"><strong>read more...</strong></p>');
	} else {
		$('div.press_release div.child div.body').append('<p class="read_more visible"><strong>citeste mai mult...</strong></p>');
	}
	
	$('div.press_release div.child').click(function(){
			$('div.press_release div.child').removeClass('selected');		
			$(this).addClass('selected');
			Cufon.replace('div.child h2', { fontFamily: 'eurojet2', hover: true});			
		});


});

var allowClick = true;
function clickIsEnabled(val){
  allowClick = val;
}
