/**
* @author Den Markin <denmarkin@gmail.com>, http://dmarkin.name
* @version $Id$
* @package RAM Capital
*/

_typeface_js.configure({ disableSelection: true });

$(document).ready( function() {
	
	$('h1#logo').click( function () {
		top.location	= base_url;
	});
	
	// typeface for elements
	$('#header .nav li a').each( function () {
		// $(this).addClass('typeface-js');	// not allow to use :hover
	});
	
	$('.colSide blockquote').each( function () {
		$(this).addClass('typeface-js');
	});
	
/*	$('#header #serviceNavContainer ul.nav li a').each( function () {
		if (location.href == $(this).attr('href')) {
			$(this).addClass('selected');
		}
	});*/
	
	$('#header #mainNavContainer ul.nav li').mouseover( function () {
		$(this).children('ul').show();
	}).mouseout( function () {
		$(this).children('ul').hide();
	});
	
	// for main menu we have subpages
	$('#header #mainNavContainer ul.nav li a').each( function () {
		if (location.href == $(this).attr('href') || -1 != location.href.indexOf($(this).attr('href'))) {
			$(this).addClass('selected');
		}
	});
	$('#header #mainNavContainer ul.nav li ul li a').each( function () {
		$(this).removeClass('selected');
	});
	
	// colSide menu
	$('.colSide ul.nav li a').each( function () {
		if (location.href == $(this).attr('href')) {
			$(this).addClass('selected');
		}
	});
	
	$('#footer ul.nav li ul').each( function () {
		$(this).hide();
	});
	
});

function switchLanguage(lang) {
	l = location.href.replace(country_code, lang);
	location.href=l;
}

function closeWithDisclaimer () {
	country	= readCookie('ram_country');
	if (!country) {
		// show/redirect to country selection
		$('#contentContainer .wrapped').children().hide();
		$('#disclaimerContainer').show();
	} else if ('Switzerland' == country) {
		// show error message
		$('#contentContainer .wrapped').children().hide();
		$('#closedDisclaimer').show();
	} else {
		$('#disclaimerContainer').hide();
		$('#closedDisclaimer').hide();
	}
}

function checkCountry(country) {
	createCookie('ram_country', country, 0);
	if ('Switzerland' == country) {
		// show error message
		$('#closedDisclaimer').show();
		$('#disclaimerContainer').hide();
	} else if ('other' == country) {
		// show content
		$('#contentContainer .wrapped').children().show();
		$('#disclaimerContainer').hide();
	}
}
