var atPic=0;
var fRunning = 0;

function move(jump){
	if (jump==0) {atPic=0; }
	else atPic+=(jump>0?picsPerPage:(-picsPerPage)); //move forward/backwards
	
	if ((atPic+picsPerPage)>numPics) atPic=numPics-picsPerPage; //make sure we don't go past end/start
	if (atPic<0) atPic=0;
	
	for (var changePic=0;changePic<picsPerPage;changePic++){ //change pics
		var picToSwitch=document.getElementById("pic"+changePic);
		if (navigator.appName=="Microsoft Internet Explorer" && picToSwitch.filters.length>0   ) {
			picToSwitch.filters[0].Apply();
		}
		picToSwitch.src=picPrefix+(atPic+changePic)+picPostfix;
		if (navigator.appName=="Microsoft Internet Explorer" && picToSwitch.filters.length>0  ) {
			picToSwitch.filters[0].Play();
		}
		
		var preIndex=(atPic+changePic+picsPerPage);
		if (jump>0 && preIndex<numPics) { //preload next image
			var preload=document.getElementById("pre"+changePic);
			preload.src=picPrefix+(preIndex)+picPostfix;
		}
	}
}

function sizeScreen(){

//alert(window.screenTop);
	//determine overhead (toolbars,etc) size 
  var docWidth = 0, docHeight = 0;
  var broswerWidth=0,browserHeight=0;
  var oldX=0,oldY=0;
 
var ie=false;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
      	window.moveTo(0,0);//alert(window.screenTop);
	window.resizeTo(screen.availWidth,screen.availHeight);
  
    broswerWidth= screen.availWidth;
    browserHeight= screen.availHeight;
    docWidth  = window.innerWidth;
    docHeight = window.innerHeight;
  
    
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    docWidth  = document.documentElement.clientWidth;
    docHeight = document.documentElement.clientHeight;
     broswerWidth  = document.body.clientWidth;
    browserHeight = document.body.clientHeight;
   
 } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
     oldX=window.screenLeft;
     oldY=window.screenTop;
    docWidth  = document.body.clientWidth;
    docHeight = document.body.clientHeight;
   broswerWidth  = docWidth+8;
    browserHeight = docHeight+100;
    ie=true;
  }
  /*alert("oldX"+oldX);
  alert("oldY"+oldY);
  alert("docWidth"+docWidth);
  alert("docHeight"+docHeight);
  alert("broswerWidth"+broswerWidth);
  alert("browserHeight"+browserHeight);
  alert("screen.availWidth"+screen.availWidth);*/
   
  
	var overheadX=broswerWidth-docWidth;
	var overheadY=browserHeight-docHeight;
		if (typeof( overheadX ) == 'number') setWidth+=overheadX; //add overhead to desired size
	if (typeof( overheadY ) == 'number') setHeight+=overheadY;
	if (screen.availWidth<setWidth) setWidth=screen.availWidth; //bound size to available size
	if (screen.availHeight<setHeight) setHeight=screen.availHeight;
	if(ie){ //return to original position
		/*oldX=oldX-overheadX;
		oldY=oldY-overheadY;
		if (oldX+setWidth>screen.availWidth) oldX=screen.availWidth-setWidth; //fit on screen
		if (oldY+setHeight>screen.availHeight) oldY=screen.availHeight-setHeight; //fit on screen
		if(oldY<overheadY) oldY=0;
		if(oldX<overheadX) oldX=0;*/
		//window.moveBy()
		//window.moveTo(0,0);
	} 
}

function showHide( specifyId, visible){
//show or hide an element
	var visibility='hidden';
	if (visible) visibility='visible';
	document.getElementById(specifyId).style.visibility=visibility;
}