$(document).ready(function() {
	startMenu();
});

Cufon.DOM.ready(function() {
	Cufon.replace('.startpage h2', {
		fontFamily: 'Futura Std Medium'
	});
		
	Cufon.replace('#navigation .submenu a', {
		fontFamily: 'Futura Std Book',
		hover: true,
		forceHitArea: true
	});
		
	Cufon.replace('#navigation ul li a, .btn-black', {
		fontFamily: 'Futura Std Book'
	});
	
	Cufon.replace('.rage', {
		fontfamily: 'Rage Italic'
	});
});

function startMenu() {
	$('#navigation li').hover(function () {
		$(this).addClass("hover");		
		if (this.parentNode.className == 'submenu') {
			var parentWidth = this.parentNode.clientWidth;
			
			$(this).find('ul:first').css('left', parentWidth + 'px');
		}
		else {
			$(this).find('ul:first').css('left', '0px');
		}
	}, function () {
		$(this).removeClass("hover");
		$(this).find('ul:first').css('left', '-9999px');
	});
}

function toggleNewsletterBox() {
	$('.box-newsletter').toggle();

	if( $('.list-adwords').css( 'margin-top' ) == '100px' ) {
		$('.list-adwords').css( 'margin-top', '0px' );
	} else {
		$('.list-adwords').css( 'margin-top', '100px' );
	}
}

function toggleAuthorBox() {
	$('.box-author').toggle();
}

function openPopupNewsletter() {
	$.openPopupLayer({
		name: "mySecondPopup",
		width: 422,
		url: "/popupnewsletter.php",
		success: function() {
        	Cufon.replace('#navigation ul li a, .btn-black', {
        		fontFamily: 'Futura Std Book'
        	});
		}
	});
}

function toogleZoomIcon() {
	$('.icon-zoom').toggle();
}

function toogleZoomIconSmall() {
	$('.small_icon_zoom').toggle();
}
