// This is the function to check the intro skip cookie

function ReDirect (URL) {
GetCookie('SplashSkip');
if (Splash == 'TRUE') {
  window.location=(URL);
  }
else {}
}
var Splash = GetCookie('SplashSkip');

// The above block of script creates the redirect function that will kick
// the user out of the splash page when called. The first thing the function
// does is look for a cookie called SplashSkip. If that cookie has a value of 
// TRUE then it changes the URL of the current page to whatever the value for URL is as defined below. 

// Setting Splash equal to the GetCookie function with the SplashSkip variable allows us 
// to look for the cookie named SplashSkip without having to hardcode the value into the GetCookie function. 

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
  var j = i + alen;
  if (document.cookie.substring(i, j) == arg)
    return getCookieVal (j);
  i = document.cookie.indexOf(" ", i) + 1;
  if (i == 0) break; 
  }
  return null;
}

// The two functions above actually retrieve the values of any cookies passed to them, while making 
// sure the script doesn't fall apart on older browsers, or on a browser with no cookie(s) set. 

ReDirect('../joomla/index.php');

// This piece of script above is the only function that is run as soon as the page begins to load. 
// The ReDirect function as defined above now kicks in, which checks for the specified cookie.
// If that cookie doesn't exist then the function ends, as you can see in the else {} 
// statement above. The target URL is placed in the parentheses. 

function SetCookie (name, value) {
  // Enter number of days the cookie should persist
  var expDays = 30;
  var exp = new Date(); 
  exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
  expirationDate = exp.toGMTString();
  // Set cookie with name and value provided
  // in function call and date from above
  document.cookie = name + "=" + escape(value)
  document.cookie += "; expires=" + exp.toGMTString();
}

// This final snippet of code creates the function that sets the cookie. 
// This function is called after the page has loaded, and so only runs if 
// the user wasn't moved to a new page by the redirection function that loaded
// as soon as the page opened. You set the number of days the cookie lasts on 
// the user's machine by changing the value of expDays. 

// -->

