function onLoad(y,firstPg){

scrollNav(y,firstPg);
toggleThumbnails();
}

function scrollNav(y,firstPg) {
   
	var h = document.getElementById('t'+ firstPg).offsetHeight;
  
	var yoffset = h * (y - firstPg);

	document.getElementById('thumbnailStack').scrollTop+=yoffset;
	
}
function chkToggle(pg){

if (view == 'tn')
{ var seeNotes = "?toggle=notes";
document.getElementById('nextButton').href += seeNotes;
 
   document.getElementById('prevButton').href += seeNotes;


 
}

}
function toggleThumbnails() {

if (view == 'tn')
	{
	    
		document.getElementById('thumbnailStack').style.display = 'block';
		document.getElementById('metadata').style.display = 'none';
				document.getElementById('toggleLink').firstChild.nodeValue = 'Viewing Notes';
        view = 'notes';
	}
	else if (view == 'notes')
	{
		document.getElementById('thumbnailStack').style.display = 'none';
		document.getElementById('metadata').style.display = 'block';
		document.getElementById('toggleLink').firstChild.nodeValue = 'View thumbnails';
        view = 'tn';
	}
	
	
	
}


function grabPg(pages){

var pg = document.getElementById('pgTxtBox').value 

var lastPg = 0; 
for (var i in pages){
lastPg++;
}
if (pages[pg]){
    window.location = pages[pg]+'.html';
    return true;
 }
 else{
 alert('Image: ' + pg + ' not found.\nPlease enter an image number between '+ 1 + ' and ' + lastPg); 
 }
}


function resizeIframe() {
			var myWidth = 0, myHeight = 0;
			  if( typeof( window.innerWidth ) == 'number' ) {
			    //Non-IE
			    myWidth = window.innerWidth;
			    myHeight = window.innerHeight;
			  } else if( document.documentElement &&
			      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			    //IE 6+ in 'standards compliant mode'
			    myWidth = document.documentElement.clientWidth;
			    myHeight = document.documentElement.clientHeight;
			  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			    //IE 4 compatible
			    myWidth = document.body.clientWidth;
			    myHeight = document.body.clientHeight;
			  }
	
			


		    //height -= document.getElementById('frame').offsetTop;
			 var frameHeight = myHeight - 40;

			 //width -= document.getElementById('frame').offsetLeft;;	 
			
			 var frameWidth = myWidth - 260;

		    // not sure how to get this dynamically


			

			 document.getElementById('viewframe').style.height = frameHeight + "px";   
			 document.getElementById('viewframe').style.width = frameWidth + "px";
};




