// JavaScript Document
var currentpos=0;
var currentthumbpos=0;
var moveamount=69;
var thumbnailnum;
var maxthumbvisible = 1; //Define how many thumbnails will be visible at one time in the thumbbox--for now this should only be 3 since it's actually the css that controls the size of the viewable box
var current_imgid=0;
var moving = false;
var finishedsizing=0;
var preloadimg="no"//Preload images ("yes" or "no"):
var myloadedimage = new Array();
     myloadedimage[0]=1;
var imggallery=new Array()
var firstimagestart=1;
var nextorprev=0;
var fadeout=1;
function areweready(loadarea, imgindex, img_id){
	if ( finishedsizing++ ) { 
		modifyimage(loadarea, imgindex, img_id);
		finishedsizing = 0;
	}
}
function modifyimage(loadarea, imgindex, img_id ){
	if(myloadedimage[imgindex]==null){
		var mynewimage=new Image()
			mynewimage.onload=function(){
				loadimagenow();
			}
				mynewimage.src=imggallery[imgindex][0]
		}else{
			loadimagenow();
	}
	function loadimagenow(){

		if (document.getElementById) {
				if(current_imgid!=img_id){
					var imgobj=document.getElementById(loadarea);
				
					var photonum=document.getElementById('photocount')
			
					imgobj.innerHTML=returnimgcode(imggallery[imgindex]);
					
					photonum.innerHTML=(Number(imgindex)+1)+" of "+imggallery.length+" Photos";
					var phototitle=document.getElementById('imgtitle')
   phototitle.innerHTML="<strong>"+tempgallery[imgindex][4]+"</strong>" + ' ' + "<br />" +tempgallery[imgindex][7] + '<br />';   
					 initImage(loadarea);
					current_imgid=img_id;
					myloadedimage[imgindex]=1;
				}
			}
		return false
	}
}
function returnimgcode(theimg){
	var imghtml="";
	var url =  theimg[9];
	if (theimg[1]!="")
		imghtml='';
	imghtml+='<img src="'+theimg[0]+'" border="0" id="'+theimg[8]+'" />'; 
	if (theimg[1]!="")
		imghtml+='';
	return imghtml;
}
function initImage(imageId) {

	var fader = new Fx.Style(imageId,'opacity', {duration:fadespeed});
	fader.set(0);
	fader.start(0,1);
}
function checkbutton(mynum){}function checknext(mynum){}
function mm_shl() { //v6.0
	var obj,args=arguments;
	if ((obj=MM_findObj(args[0]))!=null) {
		if (obj.style) {
			obj=obj.style;
		}
		obj.visibility=args[1];
	}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function addposition(addwidth){
	if ( !moving ) {	
Stop();
		 // if animagic is still moving the image..don't update the current position till it's done
		if(addwidth=="minus"){
			currentpos-=1;
		}else if(addwidth=="plus"){
			currentpos+=1;
		}
	}
	return currentpos;
}



