$().ready(function()
{
    /***********************************NEWSLETTER************************************/
	
	if($('#newsletter').length > 0)
	{				
		/*$('#subscribe #form').children().not($('input#signup')).wrapAll('<div id="innerForm"></div>');
		
		if($('#newsletter ul.errors').length == 0)
		{
			$('#subscribe #innerForm').hide();		
			$('#subscribe input#signup').addClass('up');
		}

		$('#subscribe .up').live('click', function(e) {
				e.preventDefault();
				$('#innerForm').slideDown();
				$(this).toggleClass('up');
			});*/
			
		$('#subscribe #form').hide();
		
		$('#newsletter button').click(function(e){
			$('#subscribe #form').slideDown();
			$('#newsletter button').hide();
		})
		
		if($('#newsletter ul.errors').length != 0)
		{
			$('#subscribe #form').show();	
			$('#newsletter button').hide();			
		}
	}
	
	/*************************************MENU****************************************/
	
	if($('#menu').length > 0)
	{
		/*$('ul.main li ul').hide();*/
		/*$('ul.main li.active ul').show();*/
		
		$('li.active').each(function(i){
			var count = parseInt(i + 1);
			$(this).children('a:first').addClass('selected');
			$(this).children('ul:first').addClass('level-'+count);
		});
		/*
		$('ul.main > li > a').each(function(){
			var nextAttr = $(this).next('ul').children('li:first').children('a').attr('href');
			
			if(nextAttr)
			{
				$(this).attr('href', nextAttr);
			}			
		})
		*/
	}
	
	/********************************GALLERY*********************************************/
	
	$("img[rel]").overlay({
		// some mask tweaks suitable for modal dialogs
		mask: {
			color: '#000000',
			loadSpeed: 200,
			opacity: 0.8
		},
	
		closeOnClick: true
	});
	
	/************************************FORMS*****************************/
	if($('ul.errors').length > 0)
	{
		$('ul.errors').next().addClass('error');
		$('ul.errors').hide();
	}
	
	/************************************SLIDESHOW**************************************/
	
	if($('.slideshow').length > 0)
	{
		$('.slideshow').cycle({
			fx: 'fade',
			speed:  2000,
			timeout:4000
		}); 
	}
	
	/**************************************************************************************
	 * BRUTE MODE ACTIVE
	 */
	/**************************************************************************************/
	
	/************************************F**KING BREADCRUMBS*****************************/
	if($('#content-home').length > 0 || $('#content-sitemap').length > 0)
	{
		$('#breadcrumbs').hide();
		$('.content-txt').css({paddingTop: "60px"});
	}
	
	/************************************F**KING MENU*****************************/
	
	if($('ul#pictures').length > 0)
	{
		$('a#menu-29').addClass('selected');
		$('a#menu-29').parent('li').parent('ul').show();
		$('a#menu-29').parent('li').addClass('active');		
		$('a#menu-29').parent('li').parent('ul').addClass('level-1');
		$('a#menu-29').parent('li').parent('ul').prev('a').addClass('selected');
		$('a#menu-29').parent('li').parent('ul').parent('li').addClass('active');
	}
	
});
