
// check to see if cookie exists
// if yes, redirect to language page

if (GetCookie("lang") == "EN")
{
   document.location.href="http://www.cavs.org.uk/welcome/lang/en";
}
else if (GetCookie("lang") == "CY")
{
   document.location.href="http://www.cavs.org.uk/welcome/lang/cy/";
}

// function to write selected language to cookie
function lang(l)
{
   // set expiry date for 1 year from now
   var d = new Date();
   d.setDate(d.getDate() + 365);
  
   // write cookie
   SetCookie("lang", l, d);
  
   // take user to appropriate language page
   if (l == "EN")
   {
      document.location.href="http://www.cavs.org.uk/welcome/lang/en";
   }
   else if (l == "CY")
   {
      document.location.href="http://www.cavs.org.uk/welcome/lang/cy/";
   }
     
}
