var which_page ="";
var leaving=true; 
var need_under=false;
var no_more=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];
               if (the_value == 'seenit') { need_under = true; }
               if (the_value == 'seenit2') { no_more=true; }
             }

 
}

var ButUp = new Array(3)
var ButDn = new Array(5)

ButUp[0]=new Image()
ButUp[0].src="pics/accounts-button1.gif"
ButUp[1]=new Image()
ButUp[1].src="pics/accounts-button2.gif"
ButUp[2]=new Image()
ButUp[2].src="pics/accounts-button3.gif"
ButUp[3]=new Image()
ButUp[3].src="pics/roller.gif"


ButDn[0]=new Image()
ButDn[0].src="pics/accounts-button1r.gif"
ButDn[1]=new Image()
ButDn[1].src="pics/accounts-button2r.gif"
ButDn[2]=new Image()
ButDn[2].src="pics/accounts-button3r.gif"
ButDn[3]=new Image()
ButDn[3].src="pics/roll1.gif"
ButDn[4]=new Image()
ButDn[4].src="pics/roll2.gif"
ButDn[5]=new Image()
ButDn[5].src="pics/roll3.gif"


function switchButton(spr,what_img,roll,instate)
{
 
	 if(roll==1) 
	{ 
		document [what_img].src=ButDn[spr].src
   	 	document.merline.src=ButDn[instate].src
	}

  	else

 	{
		 document [what_img].src=ButUp[spr].src 
		 document.merline.src=ButUp[3].src
	}


}

// Disable the browser version check.
// if (navigator.appName.indexOf('Netscape') > -1)
//  {
//  browser = 'ns';
//  version = navigator.appVersion.charAt(0);
//  bv = browser + version;
//}

//if (navigator.appName.indexOf('Explorer') > -1)
//  {
//  browser = 'ie';
//  version = navigator.appVersion.charAt(0);
//  bv = browser + version;
//}

//if (!browser) {
//  browser = 'other';
//  version = 'other';
//  bv = 'other';
//}
//  if (version < 7) alert(' You are currently running an outdated web browser. \nThis website requires Internet Explorer or Netscape version 4 or better. \n \n Please consider updating to a newer browser.  \n Updating will allow you to use new and more advanced features of your browser.  \n\n http://www.microsoft.com \n http://www.netscape.com');

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();
}


var popWin = null    
var winCount = 0
var winName = "popWin" 
function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){ 
  var d_winLeft = 20  
  var d_winTop = 20   
  winName = "popWin" + winCount++  
  closePopWin()           
  if (openPopWin.arguments.length >= 4)    
    winFeatures = "," + winFeatures 
  else  
    winFeatures = ""  
  if (openPopWin.arguments.length == 6)   
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop) 
  else 
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop) 
  popWin = window.open(winURL, winName, "width=" + winWidth  
           + ",height=" + winHeight + winFeatures) 
  } 
function closePopWin(){     
  if (navigator.appName != "Microsoft Internet Explorer"  
      || parseInt(navigator.appVersion) >=4)  
    if(popWin != null) if(!popWin.closed) popWin.close()  
  } 
function getLocation(winWidth, winHeight, winLeft, winTop){ 
  return "" 
  } 


function now()
{
alert(temp[0]);
document.thepic.src=picture
}

function popwindow(url) {
  demote = open(url, "Popwindow", "width=675,height=375,left=50,top=50,leftmargin=60,margintop=0,margin-top=0,topmargin=0,rightmargin=0,bottommargin=0");
}

function openindex(which_page)
{

 // Check to make sure the add does not keep coming up
 if (no_more==false) {

   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-question-under.php"; }

   //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=400"
   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-question.php"; }

   var winfeatures="location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,width=490,height=400";
   on_enter=window.open(popunder,"",winfeatures)

  }
  // End need_under

 }
 // End no_more

}