//JL Engine 2.3
//Coded by Miquel O. Brazil (c)2003

// Global variables
//creates a new image object to place each photos properties in
var photoObj = new Array(40);

//function to initialize image object
//passes url and window name to each subsequent function
function imageLoad(iurl,iname,point)
{	
	point = Number(point);
	photoObj[point] = new Image();
	photoObj[point].src = iurl;
	checkImage(iurl,iname,point);
}

//determines if image is completely loaded to begin processing
//variables and other data
function checkImage(iurl,iname,point)
{
	if(photoObj[point].width == 0 || photoObj[point].height == 0 || photoObj[point].complete == false){
		//recursive element to continue checking for image loading
		var redo = setTimeout("checkImage('" + iurl + "','" + iname + "','" + point + "')",1000);
	}else{
		setProps(iurl,iname,point);
	}
}

//sets the variables used in the window properties for the pop-up
function setProps(iurl,iname,point)
{
	if(photoObj[point].complete){
		var iwidth = photoObj[point].width;
		var iheight = photoObj[point].height;
		if(photoObj[point].width == iwidth & photoObj[point].height == iheight & photoObj[point].complete == true){
			buildImage(iurl,iname,point,iwidth,iheight);
		}else{
			var redo2 = setTimeout("checkImage('" + iurl + "','" + iname + "','" + point + "')",1000);
		}
	}
}

//organizes the properties of the image for the pop-up view
function buildImage(iurl,iname,point,iwidth,iheight,niwidth,niheight)
{
	var miurl = "buildpage.htm?iurl=" + iurl + "&iwidth=" + iwidth + "&iheight=" + iheight;
	var changeWidth = new Number(10);
	var changeHeight = new Number(20);
	var dimension = "width=" + String(Number(photoObj[point].width + changeWidth)) + ",height=" + String(Number(photoObj[point].height + changeHeight));
	var features = ",left=450,top=75,screenX=450,screenY=75,status=no,scrollbars=no,resize=no,toolbar=no,";
	var featureset = dimension + features;
	var openIt = openWin(miurl,iname,featureset);
}
function openWin(miurl,iname,featureset)
{
	var photoWindow = window.open(miurl,iname,featureset);
	photoWindow.focus();
}
