$(document).ready(function(){	
	$('#flag_container').click(function() {
		if($('#flag_dropdown').hasClass('flag_show')){
			$('#flag_dropdown').removeClass('flag_show');
		}else{
			$('#flag_dropdown').addClass('flag_show');
		}
	});
	
});

function getLang(url){
		
	var location_string = window.location.href;
	location_string = location_string.split('/');
	var location = location_string[location_string.length-1];
	
	var imgUrl = url + '/wordpress/wp-content/themes/envault/library/images/';
	var flagCss;
	if(location == 'suomi'){
		flagCss = 'transparent url("' + imgUrl + 'suomi_flag.png") no-repeat center right';
		$('#flag').css('background', flagCss);	
	}else if(location == 'deutsch'){
		flagCss = 'transparent url("' + imgUrl + 'deutsch_flag.png") no-repeat center right';
		$('#flag').css('background', flagCss);
	}else if(location == 'eesti'){
		flagCss = 'transparent url("' + imgUrl + 'eesti_flag.png") no-repeat center right';
		$('#flag').css('background', flagCss);
	}else if(location == 'espanol'){
		flagCss = 'transparent url("' + imgUrl + 'espanol_flag.png") no-repeat center right';
		$('#flag').css('background', flagCss);
	}else if(location == 'francais'){
		flagCss = 'transparent url("' + imgUrl + 'francais_flag.png") no-repeat center right';
		$('#flag').css('background', flagCss);
	}else if(location == 'svenska'){
		flagCss = 'transparent url("' + imgUrl + 'svenska_flag.png") no-repeat center right';
		$('#flag').css('background', flagCss);
	}
	
}

function lang_select(siteUrl){
		location.href = siteUrl;	
}

