function getCookie(Name)
{
 var search = Name + "=";

 if (document.cookie.length > 0)
 {
 offset = document.cookie.indexOf(search);
 if (offset != -1)
 {
 offset += search.length ;
 end = document.cookie.indexOf(";", offset);
 if (end == -1)
 end = document.cookie.length;
 return unescape(document.cookie.substring(offset, end));
 }
 }
 else
 return null;
}

function setCookie(name, value)
{
 fecha_hoy = new Date();
 expire = new Date(fecha_hoy.getFullYear() + 1, fecha_hoy.getMonth(),fecha_hoy.getDate());
 document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))+ "; path=/";
}
function SetHome(home)
{
 if (home != null)
 {
	setCookie("seguros", home);
 }
 if (home == "AR")
 {
	window.location.href = "http://www.serviciosfalabella.com.ar";
 }
 if (home == "CL")
 {
	window.location.href = "http://www.segurosfalabella.cl";
 }
 if (home == "PE")
 {
	window.location.href = "http://www.falabellaseguros.com.pe";
 }
 if (home == "CO")
 {
	window.location.href = "http://www.segurosfalabella.com.co";
 }



}

function AutoRedirect(home)
{

 if (home == "AR")
 {
 window.location.href = "http://www.serviciosfalabella.com.ar";
 }
 if (home == "CL")
 {
 window.location.href = "http://www.segurosfalabella.cl";
 }
 if (home == "PE")
 {
 window.location.href = "http://www.falabellaseguros.com.pe";
 }
 if (home == "CO")
 {
 window.location.href = "http://www.agenciadesegurosfalabella.com";
 }



}
CookieValue = getCookie('seguros');

if (CookieValue != null)
AutoRedirect(CookieValue);
