﻿berryAlloc.countryLanguage = function () {
    this.BindEvents();
    this.Initialize();
};
berryAlloc.countryLanguage.prototype = {
	BindEvents: function () {
		var me = this;
		$('.dropdown').hover(
	            function () { $('ul', this).css('display', 'block'); },
	            function () { $('ul', this).css('display', 'none'); });

		$('#CountryLanguage_Country > li > a').click(function (evt) { me.RegisterCountrySelection($(this).data("code")); });
		$('#CountryLanguage_Language > li > a').click(function (evt) { me.RegisterLanguageSelection($(this).data("code")); });
	},
	Initialize: function () {
		var me = this;
	},

	RegisterCountrySelection: function (code) {
		var language = $("#CountryLanguage_Language > li > a[class='selected']").data("code");
		berryAlloc.setAnalyticsCustomVar(1,'CountryLanguage',code + '-' + language,1); 
		return true;
	},

	RegisterLanguageSelection: function (code) {
		var country = $("#CountryLanguage_Country > li > a[class='selected']").data("code");
		berryAlloc.setAnalyticsCustomVar(1, 'CountryLanguage', country + '-' + code, 1); 
		return true;
	}
};

