var which_page ="";
var leaving=true; 
var need_under=false;



if (document.cookie) { 

        // load the cookie into a variable and unescape it
	var the_cookie = document.cookie;

        // var the_cookie = unescape(the_cookie);
        // I dont unescape the cookie because the cookie contains a search engine URL with special charecters in it that I need.

	// separate the values from the cookie name
        // PHP seperates the cookies with a semicolon - ;
	var split_pairs = the_cookie.split(";");

        var name_value_pair = "";

             for (var loop = 0; loop < split_pairs.length; loop++)
             {
             name_value_pair = split_pairs[loop];
             var final_values = name_value_pair.split("=");
             var name = final_values[0];
             var the_value = final_values[1];
             // the_info[name] = the_value;  -- for associatie arrays... not really needed.
             // to see where i got this from: http://hotwired.lycos.com/webmonkey/98/29/index1a_page10.html?tw=programming
               if (the_value == 'seenit') { need_under = true; }
             }
 
}

var ButUp = new Array(0)
var ButDn = new Array(5)

ButUp[0]=new Image()
ButUp[0].src="pics/long-middle.gif"

ButDn[0]=new Image()
ButDn[0].src="pics/roll1.gif"
ButDn[1]=new Image()
ButDn[1].src="pics/roll2.gif"
ButDn[2]=new Image()
ButDn[2].src="pics/roll3.gif"
ButDn[3]=new Image()
ButDn[3].src="pics/roll4.gif"
ButDn[4]=new Image()
ButDn[4].src="pics/roll5.gif"
ButDn[5]=new Image()
ButDn[5].src="pics/roll6.gif"

function switchButton(roll,instate)
{
 
	 if(roll==1) 
	{ 
   	 	document.roller.src=ButDn[instate].src
	}

  	else

 	{
		 document.roller.src=ButUp[0].src
	}


}

function popup2(url) { 
var win = window.open(url, "win", "width=475, height=450,left=50,scrollbars=yes,top=50"); 
win.focus();
}

function popup(url) { 
var win = window.open(url, "win", "width=375,height=400,left=50,scrollbars=yes,top=50"); 
win.focus();
}

function openindex(which_page)
{

  if (need_under == true) {

  //specify page to pop-under

    if (which_page == 'special') { var popunder="special_under.php"; }
    if (which_page == 'opening') { var popunder="opening_under.php"; }
    if (which_page == 'leaving') { var popunder="leaving_front_vote.htm"; }

  //specify popunder window features
  //set 1 to enable a particular feature, 0 to disable
  // var winfeatures="width=800,height=510,scrollbars=0,resizable=0,toolbar=1,location=1,menubar=1,status=1,directories=0"

  var winfeatures="location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,width=490,height=550"
  newwindow=window.open(popunder,"name",winfeatures)
  newwindow.blur()
  window.focus()


 } else {

  if (which_page == 'special') { var popunder="special_over.php"; }
  if (which_page == 'opening') { var popunder="opening_over.php"; }  
    if (which_page == 'leaving') { var popunder="leaving_front_vote.htm"; }

  var winfeatures="location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,width=490,height=550";
  on_enter=window.open(popunder,"",winfeatures)

 }

}