var NewWindow

function FN_myContact(thisPage,mheight,mwidth){

	screenHeight=screen.height/2;

	preWidth=mwidth;
	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=thisPage

	if (document.all){
		myWidth+=12
		myHeight+=20
	}

	commands='toolbar=0,location=0,scrollbars='
	commands+=1
	commands+=',width='
	commands+=myWidth
	commands+=',height='
	commands+=myHeight+spacerAdd
	commands+=',resizable=0'

	if (!NewWindow || NewWindow.closed ) {
		NewWindow = window.open(newPage, "windowname", commands)
			NewWindow.moveTo(myX,myY);
			NewWindow.focus();
	} else {
		NewWindow.close();
		FN_myContact(thisPage,mheight,mwidth);
	}


}



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);
	}


}

function windowHtml(img,w,h,caption,bgcolor){
	html="";
		html+="<html><head><title>Image Detail</title>"
		html+="<meta http-equiv=\"imagetoolbar\" content=\"no\">\n<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\">"
		html+="<link href=\"ocbf.css\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" \/>"
		html+="</head><body bgcolor=\""+bgcolor+"\" leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\" topmargin=\"0\" >"; //background=\""+img+"\"
			html+="<table width=100% height=100% border=0 cellspacing=0 cellpadding=10><tr><td align=center valign=middle>";
				html+="<a href=javascript:window.close()>"
					html+="<img src=\""+img+"\" width=\""+w+"\" height=\""+h+"\" border=0 alt=\"click to close window\" name=\"myIMG\">";
						html+="</a>"
							html+="</td></tr><tr><td>";
								html+=caption
									html+="</td></tr></table></body></html>";	
	return html;
}