
<!-- Paste this code into an external JavaScript file named: feelLucky.js  -->

/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Will Bontrager :: http://www.bontragerconnection.com/ */

// Leave next line as is.
var Lucky = new Array();

// The cookie to keep track of which "lucky" destinations 
// have already been visited needs a name. Okay to change
//  the cookie name.

var FeelLuckyCookieName = "FeelLuckyCookie";

// When a "lucky" destination has been decided upon, shall 
// the browser open a new window with the desitination URL?
// (Specify "y" or "yes" if yes new window; otherwise "".)
var NewWindow = "y";

// Specify your lucky destination URLs here. The first is 
// assigned to Lucky[0], the next to Lucky[1], and so 
// forth, in numerical sequence -- as many as you want.

Lucky[0] = "http://www.godslaidbare.com/pantheons/aztec/nanautzin.php";
Lucky[1] = "http://www.godslaidbare.com/pantheons/aztec/tlaloc.php";
Lucky[2] = "http://www.godslaidbare.com/pantheons/aztec/pulque.php";
Lucky[3] = "http://www.godslaidbare.com/pantheons/aztec/mictlantecuhtli.php";
Lucky[4] = "http://www.godslaidbare.com/pantheons/aztec/chicomecoatl.php";
Lucky[5] = "http://www.godslaidbare.com/pantheons/aztec/coatlicue.php";
Lucky[6] = "http://www.godslaidbare.com/pantheons/aztec/chantico.php";
Lucky[7] = "http://www.godslaidbare.com/pantheons/norse/thor.php";
Lucky[8] = "http://www.godslaidbare.com/pantheons/norse/arvak_alsvid.php";
Lucky[9] = "http://www.godslaidbare.com/pantheons/norse/ragnarok.php";
Lucky[10] = "http://www.godslaidbare.com/pantheons/norse/ymir.php";
Lucky[11] = "http://www.godslaidbare.com/pantheons/norse/skadi.php";
Lucky[12] = "http://www.godslaidbare.com/pantheons/norse/heidrun.php";
Lucky[13] = "http://www.godslaidbare.com/pantheons/indian/agni.php";
Lucky[14] = "http://www.godslaidbare.com/pantheons/indian/hiranyakashipu.php";
Lucky[15] = "http://www.godslaidbare.com/pantheons/indian/kali.php";
Lucky[16] = "http://www.godslaidbare.com/pantheons/indian/taraka.php";
Lucky[17] = "http://www.godslaidbare.com/pantheons/indian/yama.php";
Lucky[18] = "http://www.godslaidbare.com/pantheons/indian/varaha.php";
Lucky[19] = "http://www.godslaidbare.com/pantheons/indian/karttikeya.php";
Lucky[20] = "http://www.godslaidbare.com/pantheons/indian/andhaka.php";
Lucky[21] = "http://www.godslaidbare.com/pantheons/greek/zeus.php";
Lucky[22] = "http://www.godslaidbare.com/pantheons/norse/freyja.php";
Lucky[23] = "http://www.godslaidbare.com/pantheons/norse/odin.php";
Lucky[24] = "http://www.godslaidbare.com/pantheons/greek/pandora.php";
Lucky[25] = "http://www.godslaidbare.com/pantheons/japanese/shoki.php";
Lucky[26] = "http://www.godslaidbare.com/pantheons/greek/alcyone.php";
Lucky[27] = "http://www.godslaidbare.com/pantheons/indian/devi.php";
Lucky[28] = "http://www.godslaidbare.com/pantheons/indian/vishvakarman.php";
Lucky[29] = "http://www.godslaidbare.com/pantheons/indian/annapurna.php";
// No additional JavaScript customizations are required. //

var TabChar = String.fromCharCode(9);
var CurrentCookie = '';
function GetLuckyCookie() {
  var cookiecontent = '';
  if(document.cookie.length > 0) {
  	 var cookiename = FeelLuckyCookieName + '=';
  	 var cookiebegin = document.cookie.indexOf(cookiename);
  	 var cookieend = 0;
  	 if(cookiebegin > -1) {
     	cookiebegin  += cookiename.length;
     	cookieend = document.cookie.indexOf(";",cookiebegin);
     	if(cookieend < cookiebegin) { cookieend = document.cookie.length; }
     	cookiecontent = document.cookie.substring(cookiebegin,cookieend);
    }
  }
  return cookiecontent;
}

function PutLuckyCookie(value) {
  if(CurrentCookie.length > 0) { value = CurrentCookie + TabChar + value; }
  value = escape(value);
  document.cookie = FeelLuckyCookieName + "=" + value;
}

function YesMakeMeLucky() { 
  CurrentCookie = GetLuckyCookie();
  CurrentCookie = unescape(CurrentCookie);
  if(CurrentCookie == '.') { CurrentCookie = ''; }
  var LuckyVisitedList = CurrentCookie.split(TabChar);
  if(LuckyVisitedList.length >= Lucky.length) {
   	document.cookie = FeelLuckyCookieName + "=.";
   	CurrentCookie = '';
   	LuckyVisitedList = Array();
  }
  for(var i = 0; i < LuckyVisitedList.length; i++) { Lucky[LuckyVisitedList[i]] = ''; }
  var LuckyL = new Array();
  for(var i = 0; i < Lucky.length; i++) {
   	if(Lucky[i].length > 0) { LuckyL.push('' + i + TabChar + Lucky[i]); }
  }
  var LuckyDestinationNumber = 0;
  if(LuckyL.length > 1) { LuckyDestinationNumber = Math.ceil((Math.random() * LuckyL.length) - 1); }
  var LuckyNumberPlace = new Array();
  LuckyNumberPlace = LuckyL[LuckyDestinationNumber].split(TabChar);
  PutLuckyCookie(LuckyNumberPlace[0]);
  NewWindow = NewWindow.toLowerCase();
  if(NewWindow.substr(0,1) == "y") { window.open(LuckyNumberPlace[1]); }
  else { document.location = LuckyNumberPlace[1]; }
}

