expireHideEnqueteReq = 3650;
expireHideGeolocMod = 1;

var ContentsNames = {
	  '/'                               : 'Home'
	, '/products/'                      : 'Products'
	, '/products/digital_cameras/'      : 'Digital Cameras'
	, '/products/3d/'                   : '3D Image Products'
	, '/products/film_camera/'          : 'Films & Cameras'
	, '/products/binoculars/'           : 'Binoculars'
	, '/products/supplies/'             : 'Supplies'
	, '/products/medical/'              : 'Medical Systems'
	, '/products/life_science_systems/' : 'Life Science Systems'
	, '/products/graphic_systems/'      : 'Graphic Systems'
	, '/products/photofinishing/'       : 'Photofinishing Products'
	, '/products/motion_picture/'       : 'Motion Picture Films'
	, '/products/optical_devices/'      : 'Optical Devices'
	, '/products/recording_media/'      : 'Recording Media'
	, '/products/industrial_products/'  : 'Industrial Products'
	, '/support/'                       : 'Support'
	, '/news/'                          : 'News'
	, '/sustainability/'                : 'Sustainability'
	, '/about/'                         : 'About Us'
	, '/contact/'                       : 'Contact Us'
	, '/worldwide/'                     : 'Worldwide'
};

var CountrySettings = [
	  {
		  code     : 'CN'
		, langname : 'Chinese'
		, lang     : 'zh'
//		, ratio    : 75
		, ratio    : 0
	  }
	, {
		  code     : 'IN'
		, langname : 'English'
		, lang     : 'en'
//		, ratio    : 75
		, ratio    : 0
	  }
	, {
		  code     : 'RU'
		, langname : 'Russian'
		, lang     : 'ru'
//		, ratio    : 75
		, ratio    : 0
	  }
	, {
		  code     : 'BR'
		, langname : 'Portuguese'
		, lang     : 'pt'
//		, ratio    : 75
		, ratio    : 0
	  }
	, {
		  code     : 'TR'
		, langname : 'Turkish'
		, lang     : 'tr'
//		, ratio    : 75
		, ratio    : 0
	  }
];

function getCountrySetting(by_name, value) {
	for (var i = 0, n = CountrySettings.length; i < n; i++) {
		if (value == CountrySettings[i][by_name]) {
			return CountrySettings[i];
		}
	}
	return {
		  code     : 'default'
		, langname : 'English'
		, lang     : 'en'
//		, ratio    : 25
		, ratio    : 0
	};
}
function getCountrySettingByCode(country_code) {
	return getCountrySetting('code', country_code);
}
function getCountrySettingByLang(lang) {
	return getCountrySetting('lang', lang);
}

var CurrentCountrySetting = getCountrySettingByCode(geoip_country_code());

(function($) {

if (typeof(isEncCompletePage) != "undefined" && isEncCompletePage == true) {

	$.cookie("hideEnqueteReq", true, { expires: expireHideEnqueteReq, path: "/" });
	var lastVisitURL = $.cookie("lastVisitURL");

	if (lastVisitURL){
		setTimeout("location.replace(lastVisitURL);", 5000);
	} else {
		setTimeout("location.replace('/');", 5000);
	}

} else {

	var lastVisitURL = location.href;

	$.cookie("lastVisitURL", lastVisitURL);

	var country = geoip_country_code();
	var hideGeolocMod = $.cookie("hideGeolocMod");

	if (hideGeolocMod == null || (typeof(isContactPage) != "undefined" && isContactPage == true)) {
		var sheets = BAJL.StyleSheets();
		sheets.insertRule('#geolocBlockA01 .geolocCode-' + country.toLowerCase() + ' { display: block }');
		sheets.insertRule('#home .worldwidePanelA01 li.geolocCode-' + country.toLowerCase() + ' { display: block }');
	}
}

})(jQuery);

jQuery(function($) {
	$("#geolocBlockA01 .geolocCloseBtn a img").click(function() {
		$.cookie("hideGeolocMod", "true", { expires: expireHideGeolocMod, path: "/" });
		$("#geolocBlockA01 .geolocA01").slideUp("slow");
	});

});
