// JavaScript Document


//Begin Centered Popup
// Centered Pop-Up Window (v1.0)
// (C) 2002-2003 www.smileycat.com
// Free for all users, but leave in this header

//Use the line below in html code as the link
//   <a href="#null" onclick="newWindow('your_site.html','','750','450','resizable,scrollbars,status,toolbar')">Click Here</a>

// Variables:

// 750 - width
// 450 - height
// resizable - window can be resized
// scrollbars - window displays the scrollbar on the right
// status - window displays the status bar at the bottom
// toolbar - window displays the toolbar at the top

// Note: href="#null" makes the link display as a link. Don't leave it out!
var win = null;
function newWindow(mypage,myname,w,h,features) {
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}
//End Centered Popup


//Begin Image Popup Open Resize Center
//http://www.howtocreate.co.uk/perfectPopups.html
//<a href="../scripts/ImageUrl" onclick="return popImage(this.href,'ImageTitle');">link</a>

//really not important (the first two should be small for Opera's sake)
PositionX = 10;
PositionY = 10;
defaultWidth  = 10;
defaultHeight = 10;

//kinda important
var AutoClose = true;

//don't touch
function popImage(imageURL,imageTitle,scrollbars,resizable)
	{
		var imgWin = window.open('','_blank',''+scrollbars+','+resizable+',title=yes,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
		if( !imgWin )
			{
				return true;
			} //popup blockers should not cause errors
		
			imgWin.document.write('<?xml version="1.0"?>');
			imgWin.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">');
			imgWin.document.write('<head>');
			imgWin.document.write('<title>'+imageTitle+'</title>');
			imgWin.document.write('<script type="text/javascript">');
				imgWin.document.write('function resizeWinTo()');
					imgWin.document.write('{');
						imgWin.document.write('if( !document.images.length )');
							imgWin.document.write('{');
								imgWin.document.write('document.images[0] = document.layers[0].images[0];');
							imgWin.document.write('}');
							
						imgWin.document.write('var oH = document.images[0].height, oW = document.images[0].width;');
						
						// Between here and the next comment keeps the image popup from being larger than screen when image is larger than screen.
						imgWin.document.write('if( window.opera )');
							imgWin.document.write('{');
								imgWin.document.write('var mH = screen.availHeight-300; var mW = screen.availWidth-150;');
								imgWin.document.write('if( oH > mH ) {oW =oW+16; oH = mH; }');
								imgWin.document.write('if( oW > mW ) { oW = mW; }');
						imgWin.document.write('}');
							
						imgWin.document.write('if(navigator.userAgent.indexOf("Netscape6")!=-1)');
							imgWin.document.write('{');
								imgWin.document.write('var mH = screen.availHeight-150; var mW = screen.availWidth-150;');
								imgWin.document.write('if( oH > mH ) { oH = mH; }');
								imgWin.document.write('if( oW > mW ) { oW = mW; }');
							imgWin.document.write('}');
						
						imgWin.document.write('if(navigator.userAgent.indexOf("Netscape")!=-1)');
							imgWin.document.write('{');
								imgWin.document.write('var mH = screen.availHeight-150; var mW = screen.availWidth-150;');
								imgWin.document.write('if( oH > mH ) { oW = oW+15; oH = mH; }');
								imgWin.document.write('if( oW > mW ) { oW = mW; }');
							imgWin.document.write('}');
							
						imgWin.document.write('if (navigator.userAgent.indexOf("Firefox")!=-1)');
							imgWin.document.write('{');
								imgWin.document.write('var mH = screen.availHeight-150; var mW = screen.availWidth-150;');
								imgWin.document.write('if( oH > mH ) { oW = oW+16; oH = mH; }');
								imgWin.document.write('if( oW > mW ) { oW = mW; }');
							imgWin.document.write('}');
							
						imgWin.document.write('if( !window.firefox && !window.netscape && !window.opera )');
							imgWin.document.write('{');
								imgWin.document.write('var mH = screen.availHeight-150; var mW = screen.availWidth-150;');
								imgWin.document.write('if( oH > mH ) { oH = mH; }');
								imgWin.document.write('if( oW > mW ) { oW = mW; }');
							imgWin.document.write('}');
						//End keep image popup from being larger than screen.
						
						imgWin.document.write('if( !oH || window.doneAlready )');
							imgWin.document.write('{');
								imgWin.document.write('return;');
							imgWin.document.write('}');
						imgWin.document.write('window.doneAlready = true;');
						
						imgWin.document.write('var x = window;');
						imgWin.document.write('x.resizeTo( oW + 200, oH + 200 );');
						imgWin.document.write('var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;');
							imgWin.document.write('if( x.innerWidth )');
								imgWin.document.write('{');
									imgWin.document.write('myW = x.innerWidth; myH = x.innerHeight;');
								imgWin.document.write('}');
							imgWin.document.write('else if( d && d.clientWidth )');
								imgWin.document.write('{');
									imgWin.document.write('myW = d.clientWidth; myH = d.clientHeight;');
								imgWin.document.write('}');
							imgWin.document.write('else if( b && b.clientWidth )');
								imgWin.document.write('{');
									imgWin.document.write('myW = b.clientWidth; myH = b.clientHeight;');
								imgWin.document.write('}');
							imgWin.document.write('if( window.opera && !document.childNodes )');
								imgWin.document.write('{');
									imgWin.document.write('myW += 16;');
								imgWin.document.write('}');
						imgWin.document.write('x.resizeTo( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + ( (oH + 200 ) - myH ) );');
						imgWin.document.write('var scW = screen.availWidth ? screen.availWidth : screen.width;');
						imgWin.document.write('var scH = screen.availHeight ? screen.availHeight : screen.height;');
							//imgWin.document.write('if( !window.opera )');
								//imgWin.document.write('{');
									imgWin.document.write('x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2));');
								//imgWin.document.write('}');
					imgWin.document.write('}');
			imgWin.document.write('</script>');
			imgWin.document.write('</head>');
			imgWin.document.write('<body style="background: #FFFFFF; text-align:center; color:#FFFFFF; font-family:arial, sans-serif; font-size:12px;" onLoad="resizeWinTo();">');<!-- onblur="self.close();" -->
			// Make sure to specify correct location of the background url on next line for the animated Loading... gif.
			//You can copy the loading.gif to your site and use it from there, but please do not link to the image on my site.
			imgWin.document.write('<div style="position:absolute; top:0px; left:0px; background: url(images/loading.gif) no-repeat top left;">');
			imgWin.document.write('<img style="display:block;" src='+imageURL+' alt="" title="" onload="resizeWinTo();" />');
			imgWin.document.write('</div>');
			imgWin.document.write('</body>');
			imgWin.document.write('</html>');
		
		imgWin.document.close();
		
		if( imgWin.focus )
			{
				imgWin.focus();
			}
		return false;
	}
<!-- End Image Popup Open Resize Center -->

