var newWindow = null;

function openWindow(theURL) { //v2.0
	hspace = screen.width - 750; //- window width
	vspace = screen.height - 450; //- window height
	lft = hspace / 2;
	tp = vspace / 2;
	window.open(theURL,'portfolio','width=750,height=450' + ",left=" + lft + ",top=" + tp + 'status=yes,dependent=no,hotkeys=no,location=no,menubar=no,resizable=no,scrollbars=no,toolbar=no');
}

function openWindowScroll(theURL) { //v2.0
	hspace = screen.width - 720; //- window width
	vspace = screen.height - 600; //- window height
	lft = hspace / 2;
	tp = vspace / 2;
	window.open(theURL,'textWindow','width=720,height=600' + ",left=" + lft + ",top=" + tp + 'status=yes,dependent=no,hotkeys=no,location=no,menubar=no,resizable=no,scrollbars=yes,toolbar=no');
}

function openWindowText(theURL) { //v2.0
if (newWindow != null) {
		newWindow.close();
	}
	hspace = screen.width - 660; //- window width
	vspace = screen.height - 500; //- window height
	lft = hspace / 2;
	tp = vspace / 2;
	newWindow = window.open(theURL,'textWindow','width=660,height=500' + ",left=" + lft + ",top=" + tp + 'status=yes,dependent=no,hotkeys=no,location=no,menubar=no,resizable=no,scrollbars=yes,toolbar=no');
}


function openImageWindow(theURL,theImageNo,wd,hgt) {
	if (newWindow != null) {
		newWindow.close();
	}
	hspace = screen.width - wd; //- window width
	vspace = screen.height - hgt; //- window height
	lft = hspace / 2;
	tp = vspace / 2;
	newWindow = window.open(theURL,theImageNo,'width=' + wd +',height=' + hgt + ",left=" + lft + ",top=" + tp + 'status=yes,dependent=no,hotkeys=no,location=no,menubar=no,resizable=no,scrollbars=no,toolbar=no');
}


function openImageWindowScroll(theURL,theImageNo,wd,hgt) {
	if (newWindow != null) {
		newWindow.close();
	}
	hspace = screen.width - wd; //- window width
	vspace = screen.height - hgt; //- window height
	lft = hspace / 2;
	tp = vspace / 2;
	newWindow = window.open(theURL,theImageNo,'width=' + wd +',height=' + hgt + ",left=" + lft + ",top=" + tp + 'status=no,dependent=no,hotkeys=no,location=no,menubar=no,resizable=no,scrollbars=yes,toolbar=no');
}

function openOverlord(theURL) { //v2.0
	hspace = screen.width - 900; //- window width
	vspace = screen.height - 600; //- window height
	lft = hspace / 2;
	tp = vspace / 2;
	window.open(theURL,'portfolio','width=900,height=600' + ",left=" + lft + ",top=" + tp + 'status=yes,dependent=no,hotkeys=no,location=no,menubar=no,resizable=no,scrollbars=yes,toolbar=no');
}

function setImage(){
	imageCount = window.name
	document.galleryImage.src=imageList[imageCount]
    document.galleryImage.width=widthList[imageCount]
    document.galleryImage.height=heightList[imageCount]
}
 

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 setImage2(){
	imageCount = window.name
	document.popupImage.src=imageList[imageCount]
    document.popupImage.width=widthList[imageCount]
    document.popupImage.height=heightList[imageCount]
	imageCount += 1
	theCaption = 'captionText' + imageCount
	var obj = MM_findObj(theCaption);
	obj.style.visibility = "visible"
}
 
