$(document).ready(function() {

	$('.jsblock').show(); $('.nonjsblock').hide();
	getInvestorTypeTranslation();
	getDisclaimer();
});

function getDisclaimer(){

	var	countryID =  $('#select-country option:selected').val();
	var investorTypeID = $('input:checked').val();
	var languageID = $('#titlelanguage a.selected').text();

	if(countryID != 0 && investorTypeID && languageID)
	{
		$('#disclaimertext').hide();
		$('#loadingbox').show();
		$.asyncAction('Universe.getDisclaimerContent',	{ country: countryID, investorType: investorTypeID, language: languageID }, function(result) {  setDisclaimer(result) });
	}
};

function getInvestorTypeTranslation(){

	var	countryID =  $('#select-country option:selected').val();
	var languageID = $('#titlelanguage a.selected').text();

	if(countryID != 0 && languageID)
	{
		var translationID = 'Text.' + countryID + 'investorType';
		$.asyncAction('Translation.getTranslationByLanguage',	{ translation: translationID, language: languageID }, function(result) {  setInvestorTypeTranslation(result) });
	}
}

function setDisclaimer(result){
	if(result)
	{
		$('#disclaimertext').html(result);
	}
		$('#loadingbox').hide();
		$('#disclaimertext').show();
};

function setInvestorTypeTranslation(result){
	if(result)
	{
		$('#investor-pro-js').html(result);
	}
};

jQuery.extend({
    asyncAction: function(action, data, callback) {
        $.extend(data, { action: action });
        $.getJSON('/async.php', data, function(json) {
            if (json.error) {
                alert(json.error);
            } else {
                callback(json.result);
            }
        });
    }
});
