
<!-- 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.kpetunia.com/alaska.htm";
Lucky[1]= "http://www.kpetunia.com/balance.htm";
Lucky[2]= "http://www.kpetunia.com/blue_whales_baja.htm";
Lucky[3]= "http://www.kpetunia.com/c'estmoi.html";
Lucky[4]= "http://www.kpetunia.com/chaos.htm";
Lucky[5]= "http://www.kpetunia.com/nest/index.html";
Lucky[6]= "http://kpetunia.com/family.htm";
Lucky[7]= "http://www.kpetunia.com/enlightenment.htm";
Lucky[8]= "http://www.kpetunia.com/fever.htm";
Lucky[9]= "http://www.kpetunia.com/fishydeal.htm";
Lucky[10]= "http://www.kpetunia.com/fucking_flower.htm";
Lucky[11]= "http://www.kpetunia.com/glacier.htm";
Lucky[12]= "http://www.kpetunia.com/grace.htm";
Lucky[13]= "http://www.kpetunia.com/greece.htm";
Lucky[14]= "http://www.kpetunia.com/hungrycaterina.htm";
Lucky[15]= "http://www.kpetunia.com/ice_story.htm";
Lucky[16]= "http://www.kpetunia.com/joseph_has_a_new_hobby.htm";
Lucky[17]= "http://www.kpetunia.com/kathat.htm";
Lucky[18]= "http://www.kpetunia.com/magneticmind.htm";
Lucky[19]= "http://www.kpetunia.com/mah_boy.html";
Lucky[20]= "http://www.kpetunia.com/orcaresearch.htm";
Lucky[21]= "http://www.kpetunia.com/orcas_san_juan.htm";
Lucky[22]= "http://www.kpetunia.com/orcas.htm";
Lucky[23]= "http://www.kpetunia.com/osha_report.htm";
Lucky[24]= "http://www.kpetunia.com/pantanal.htm";
Lucky[25]= "http://www.kpetunia.com/paraguay.htm";
Lucky[26]= "http://www.kpetunia.com/perfectday.htm";
Lucky[27]= "http://www.kpetunia.com/peripatetic.htm";
Lucky[28]= "http://www.kpetunia.com/picotruncado.htm";
Lucky[29]= "http://www.kpetunia.com/roadstories.htm";
Lucky[30]= "http://www.kpetunia.com/southamerica.htm";
Lucky[31]= "http://www.kpetunia.com/spanish_lessons.htm";
Lucky[32]= "http://www.kpetunia.com/staci.htm";
Lucky[33]= "http://www.kpetunia.com/viking-2.htm";
Lucky[34]= "http://www.kpetunia.com/viking-3.htm";
Lucky[35]= "http://www.kpetunia.com/viking.htm";
Lucky[36]= "http://www.kpetunia.com/writing.htm";
Lucky[37]= "http://www.kpetunia.com/work.htm";
Lucky[38]= "http://www.kpetunia.com/yoga.htm";
Lucky[39]= "http://www.kpetunia.com/dreamboards.htm";
Lucky[40]= "http://www.kpetunia.com/brasil.htm";
Lucky[41]= "http://www.kpetunia.com/chaos_01_09.htm";
Lucky[42]= "http://www.kpetunia.com/chaos_01-06.htm";
Lucky[43]= "http://www.kpetunia.com/chaos_02-06.htm";
Lucky[44]= "http://www.kpetunia.com/chaos_02-08.htm";
Lucky[45]= "http://www.kpetunia.com/chaos_03-06.htm";
Lucky[46]= "http://www.kpetunia.com/chaos_02-09.html";
Lucky[47]= "http://www.kpetunia.com/chaos_04-09.htm";
Lucky[48]= "http://www.kpetunia.com/chaos_05-06.htm";
Lucky[49]= "http://www.kpetunia.com/chaos_05-07.htm";
Lucky[50]= "http://www.kpetunia.com/chaos_05-08.htm";
Lucky[51]= "http://www.kpetunia.com/chaos_06-06.htm";
Lucky[52]= "http://www.kpetunia.com/chaos_07-08.htm";
Lucky[53]= "http://www.kpetunia.com/chaos_08-08.htm";
Lucky[54]= "http://www.kpetunia.com/chaos_9-2009.htm";
Lucky[55]= "http://www.kpetunia.com/chaos_10-08.htm";
Lucky[56]= "http://www.kpetunia.com/chaos_11-08.htm";
Lucky[57]= "http://www.kpetunia.com/chaos_04-09.htm";
Lucky[58]= "http://www.katandjoseph.com";
Lucky[59]= "http://www.kpetunia.com/friends.htm";
Lucky[60]= "http://www.kpetunia.com/vikings.jpg";
Lucky[61]= "http://www.kpetunia.com/nest/menesting.html";
Lucky[62]= "http://www.kpetunia.com/new_years_resolution_1978";
Lucky[63]= "http://katsassfanclub.wordpress.com/";

// 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]; }
}
