expireHideEnqueteReq = 3650;
expireHideGeolocMod = 1;

var ContentsNames = {
	  '/'                               : 'Home'
	, '/productos/'                      : 'Productos'
	, '/productos/camaras_finePix/'      : 'Cámaras FinePix'
	, '/productos/camaras_finepix/real_3d/real3DW3/index.php'                   : 'Imagen 3D'
	, '/productos/fotografia/index.php'          : 'Fotografía'
	, '/productos/myphotobook/index.php'           : 'My Photobook'
	, '/productos/papel/index.php'             : 'Papel Inkjet'
	, '/productos/artesgraficas/index.php'              : 'Artes Gráficas'
	, '/productos/magneticos/index.php' : 'Magnéticos'
	, 'http://fujimed.com.mx/index.php'      : 'Healthcare'
	, '/productos/fotoacabado/index.php'       : 'Equipo de Fotoacabado'
	, '/productos/cine/index.php'       : 'Cine'
	, '/productos/powis/index.php'      : 'Powis'
	, '/soporte/servicio/index.php'                       : 'Soporte'
	, '/noticias/noticia22.php'                          : 'Noticias'
	, '/sobrefujifilm/quienes.php'                         : 'Nosotros'
	, '/sobrefujifilm/contacto.php'                       : 'Contacto'
	, 'http://www.fujifilm.com/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");
	});

});
