var picview = 0;
var pics = new Array();
pics[0] = { "name" : "josh_and_mer.jpg",
            "title" : "Camping at White River, 2007"
           };
pics[1] = { "name" : "2-web.jpg",
            "title" : "Camping at White River with Jess and Alex, 2007"
           };
pics[2] = { "name" : "4-web.jpg",
            "title" : "Camping at Pickett Butte Fire Lookout tower, 2008"
           };
pics[3] = { "name" : "6-web.jpg",
            "title" : "Meredith and Kelly"
           };
pics[4] = { "name" : "11-web.jpg",
            "title" : "Meredith and Josh posing"
           };
pics[5] = { "name" : "12-web.jpg",
            "title" : "Another photobooth picture"
           };
pics[6] = { "name" : "9-web.jpg",
            "title" : "J&M forever..."
           };
pics[7] = { "name" : "14-web.jpg",
            "title" : "Sara and Meredith at Empire State Building, 2001"
           };
pics[8] = { "name" : "13-web.jpg",
            "title" : "Keith, Kelly, and Meredith at Octoberfest, Mt. Angel, 2006"
           };
pics[9] = { "name" : "RAW_0007.jpg",
            "title" : "Engagement Photo: Crystal Springs Rhododendron Gardens"
           };
pics[10] = { "name" : "RAW_0155.jpg",
            "title" : "Engagement Photo: Crystal Springs Rhododendron Gardens"
           };
pics[11] = { "name" : "RAW_0176.jpg",
            "title" : "Engagement Photo: East Bank Esplanade"
           };
pics[12] = { "name" : "RAW_0184.jpg",
            "title" : "Engagement Photo: East Bank Esplanade"
           };
pics[13] = { "name" : "RAW_0194.jpg",
            "title" : "Engagement Photo: East Bank Esplanade"
           };
pics[14] = { "name" : "RAW_0002.jpg",
            "title" : "Engagement Photo: Crystal Springs Rhododendron Gardens"
           };
function getPage(id){
        var rndm = Math.random();
        var pars = "sid=" + rndm + "&page=" + id;

  	new Ajax.Request(
  		'php/get_page_info.php',
  		{
  			method: 'post',
  			parameters: pars,
                        onComplete: evalResponse

  		});
}
function next_pic() {
  var pcount = pics.size() - 1;
  var nextpic = ++picview;
  if (nextpic > (pcount)){
    nextpic = 0;
  }
 // alert("pcnt" + pcount + " pic" + nextpic);
  picview = nextpic;
  place_pic(picview);
}
function previous_pic() {
  var pcount = pics.size() - 1;
  var nextpic = --picview;
  if (nextpic < 0){
    nextpic = pcount;
  }
 // alert("pcnt" + pcount + " pic" + nextpic);
  picview = nextpic;
  place_pic(picview);
}

function set_pic() {
  place_pic(picview);
}
function place_pic(num){
  document.getElementById('place_pic').innerHTML = "<img src=\"images/pics/" + pics[num]['name'] + "\"/><br />"
                                                      + pics[num]['title'];
  document.getElementById('pictot').innerHTML = (num + 1) + " of " + pics.size();
   getrandom();
}

function evalResponse(originalRequest){
  //Pages = eval('(' + originalRequest.responseText + ')');
  //setTimeout("eval(" + originalRequest.responseText + ")",50);
  eval( originalRequest.responseText );
  // alert( originalRequest.responseText );
  // alert("evaluated response... this message is to be removed by ietools");
}

function setPage(){
  document.getElementById('content').innerHTML = 
       "<h2>" + PAGE['title'] + "</h2>"
       + PAGE['def'] + "<br />";
//       + "\n" + getrandom();

  getrandom();


}

function getrandom(){
        var rndm = Math.random();
        var pars = "sid=" + rndm;

  	new Ajax.Request(
  		'php/get_random_quote.php',
  		{
  			method: 'post',
  			parameters: pars,
                        onComplete: evalResponse

  		});
}

function setrandom(){
    document.getElementById('footer').innerHTML = Quote;
}

function showArrow(){
   document.getElementById('menu_gif').src = "images/menu.gif";
   document.getElementById('menu').style.display = "block";
   document.getElementById('menu_a').href = "javascript:hideArrow()";
}

function hideArrow(){
   document.getElementById('menu_gif').src = "images/menuempty.gif";
   document.getElementById('menu').style.display = "none";
   document.getElementById('menu_a').href = "javascript:showArrow()";
}