﻿function FN_openWin(page){

	screenHeight=screen.height/2;
	myWidth=defaultWidth;

	myX=(screen.width-myWidth) / 2 
	myY=20 // compensate for mac/windows bars

	myWidth+=20;


	myY=(screen.height-screenHeight)/2 // center on page

	newPage="emailer.php?m="+page;

	commands='toolbar=0,location=0,scrollbars='
	commands+=0
	commands+=',width='
	commands+=myWidth
	commands+=',height='
	commands+=defaultHeight
	commands+=',resizable=0'

	NewWindow = window.open(newPage, "windowname", commands)

	//NewWindow.moveTo(myX,myY);
	NewWindow.focus();
}

function FN_myIMG3(thisPage,mheight,baseDir,caption){

	screenHeight=screen.height/2;
	preWidth=500;
	preHeight=mheight;

	myWidth=preWidth;
	myHeight=preHeight;

	fakWidth=preWidth;
	spacerAdd=20;

	myX=(screen.width-fakWidth) / 2 
	myY=20 // compensate for mac/windows bars


	myY=(screen.height-screenHeight)/2 // center on page

	//newPage="imgpop.php?img="+thisPage

	commands='toolbar=0,location=0,scrollbars='
	commands+=1
	commands+=',width='
	commands+=myWidth+20+spacerAdd
	commands+=',height='
	commands+=myHeight+spacerAdd
	commands+=',resizable=0'

	//NewWindow = window.open(newPage, "windowname", commands)

	//baseDir="images/popups/caritas/";
	caption="";

	bgcolor=document.bgColor;
	if (!bgcolor) bgcolor="white";

	if (!NewWindow || NewWindow.closed ) {
		NewWindow = window.open("", "", commands)
		documentText=windowHtml(baseDir+thisPage,preWidth,preHeight,caption,bgcolor)
			NewWindow.document.write(documentText);
			NewWindow.document.close();

			NewWindow.moveTo(myX,myY);
			NewWindow.focus();
	} else {
		//NewWindow.document.myIMG.src=baseDir+thisPage;
		//	NewWindow.document.myIMG.width=preWidth;
		//	NewWindow.document.myIMG.height=preHeight;
		//NewWindow.window.resizeTo(myWidth+20+spacerAdd,myHeight+spacerAdd+40)

		NewWindow.close();
		FN_myIMG3(thisPage,mheight,baseDir,caption);
	}


}