// JavaScript Document
/* 
	Author: Maxmiliano Reipert Andriani
	URL: http://www.maxandriani.art.br
	Email: contato@maxandriani.art.br
	Cliente: Catharine Hill
*/
jQuery(document).ready(function(){
	// Event page
	// Choose profetional meeting or celebrities
	jQuery('.content').children('.eventCenterBlock2').children('li').children('a').click(function(){
		// When click
		$page=jQuery(this).attr('href');
		$subpage=jQuery('.content').children($page).children('.subnav').children('li:first').children('a').attr('href');
		// fadeOut this div
		jQuery(this).parent().parent().css({display:'none'});
		// show page in href
		//window.alert($subpage);
		jQuery('.content').children($page).fadeIn('500');
		jQuery('html, body').animate({scrollTop: jQuery('.nav').offset().top}, 2000);
		jQuery('.content').children($page).children($subpage).fadeIn('500');
	});
	
	// Animate menu itens
	jQuery('.subnav').children('li').children('a').click(function(){
		// Remove all actual-item class
		jQuery('.subnav').children('li').removeClass('active-item');
		//window.alert('Classe removida');
		// Add class in current clicked item
		jQuery(this).parent('li').addClass('active-item');
		// Get page content
		$page='#'+jQuery(this).parent('li').parent('.subnav').parent().attr('id');
		//window.alert($page);
		$subpage=jQuery(this).attr('href');
		//window.alert($subpage);	
		// Hide allt elementos not .subnav
		jQuery('.content').children($page).children().not('.subnav').css({display:'none'});
		//window.alert('Removido');
		// Show current click element target
		jQuery('.content').children($page).children($subpage).fadeIn('500');
		//window.alert('Trocado');
	});
	
	// Animate sub Menu - professional-meeting-agenda
	jQuery('#professional-meeting-agenda').children('li').children('a').click(function(){
		// Get $page and $subpage var
		$page='#'+jQuery(this).parent('li').parent('#professional-meeting-agenda').parent().attr('id');
		$subpage=jQuery(this).attr('href');
		jQuery('.content').children($page).children().not('.subnav').css({display:'none'});
		// Show clicked page
		jQuery('.content').children($page).children($subpage).fadeIn('500');
	});
	
	// Quando clicar em eventos, não recarregar a página
	jQuery('.nav').children('li.active-item').children('a').attr('href','#eventCenterBlock2');
	jQuery('.nav').children('li.active-item').children('a').click(function(){
		// When click
		$subpage=jQuery('.content').children().not('.eventCenterBlock2').css({display:'none'});
		$subpage=jQuery('.content').children('.eventCenterBlock2').fadeIn('500');
		jQuery('html, body').animate({scrollTop: jQuery('.nav').offset().top}, 2000);
	});
	
	// Celebrities-premio-2011
	// Animate sub Menu - professional-meeting-agenda
	//jQuery('#celebrities-premio-2011').children('li').children('a').click(function(){
		jQuery('.celebritiesPremiacaoAberto').children('li').children('a').click(function(){
		//celebritiesPremiacaoAberto
		// Get $page and $subpage var
		//$page='#'+jQuery(this).parent('li').parent('#celebrities-premio-2011').parent().attr('id');
		$page='#'+jQuery(this).parent('li').parent('.celebritiesPremiacaoAberto').parent().attr('id');
		$subpage=jQuery(this).attr('href');
		jQuery('.content').children($page).children().not('.subnav').css({display:'none'});
		// Show clicked page
		jQuery('.content').children($page).children($subpage).fadeIn('500');
	});
	
	// Paginação de fotos
	jQuery('.galleryContentBlock').children('.pag').children('ul').children('li').children('a').click(function(){
		// Get $page and $subpage var
		$page='#'+jQuery(this).parent('li').parent('ul').parent('.pag').parent().parent().attr('id');
		//window.alert($page); // professional-meeting-gallery
		$subpage=jQuery(this).attr('href');
		//window.alert($subpage);
		jQuery('.content').children($page).children().not('.subnav').css({display:'none'});
		// Show clicked page
		jQuery('.content').children($page).children($subpage).fadeIn('500');
	});
	
	//Paginacao da agenda
	// Paginação de fotos
	jQuery('.calendarBlock').children('a').click(function(){
		// Get $page and $subpage var
		//$page='#'+jQuery(this).parent('li').parent('ul').parent('.pag').parent().parent().attr('id');
		$page='#'+jQuery(this).parent().attr('id');
		//alert($page);
		//window.alert($page); // professional-meeting-gallery
		$subpage=jQuery(this).attr('href');
		//window.alert($subpage);
		jQuery($page).css({display:'none'});
		//jQuery('.content').children($page).children().not('.subnav').css({display:'none'});
		// Show clicked page
		jQuery($subpage).fadeIn('500');
	});
	
	
	// Lightbox
	jQuery('.lightbox').lightBox();
});


 $(document).ready(function(){		
			$("#contato").validate({
		rules: {
			nome: {
				required: true,
				minlength: 3
			},
			email: {
				required: true,
				email: true
			},
			mensagem: {
				required: true,
				minlength: 10
			}
		},
		messages: {
			nome: {
				required: "Por favor digite seu nome",
				minlength: "São necessárias no mínimo 3 letras"
			},
			email: "Por favor insira um endereço de e-mail válido",
			
			mensagem: {
				required: "Sua mensagem é muito importante",
				minlength: "Mínimo 10 caracteres"
			}
		}
	});
}); 

