/* Popup Image code */
/* original code snagged from www.glittersweet.com */
/* and modified by M. Bucher */
	
PositionX = 10;
PositionY = 10;
defaultWidth  = 200;
defaultHeight = 200;

var AutoClose = false;

function popImage(imageURL,imageTitle){
	var imgWin = window.open('','PopWin','scrollbars=yes,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
	if( !imgWin ) { return true; } //popup blockers should not cause errors
	imgWin.document.write('<html><head><title>Music To My Ears<\/title>'+
		'<link href="/css/mtme_popup.css" rel="stylesheet" type="text/css">'+
		'<script type="text\/javascript">\n'+
		'function resizeWinTo() {\n'+
		'var maxWidth = 960; var maxHeight = 720;\n'+
		'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
		'var imgH = document.images[0].height, imgW = document.images[0].width;\n'+
		'if( !imgH || window.doneAlready ) { return; }\n'+ //in case images are disabled
		'window.doneAlready = true;\n'+ //for Safari and Opera
		'var x = window; x.resizeTo( imgW + 200, imgH + 300 );\n'+
		'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
		'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
		'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
		'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
		'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
		'x.resizeTo( imgW = imgW + ( ( imgW + 300 ) - myW ), imgH = imgH + ( (imgH + 300 ) - myH ) );\n'+
		'if( imgW > maxWidth ) {x.resizeTo( maxWidth, imgH ); }\n'+
		'if( imgH > maxHeight ) {x.resizeTo( imgW, maxHeight ); }\n'+
		//'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
		//'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
		'}\n'+
		'<\/script>'+
		'<\/head><body onload="resizeWinTo();"'+(AutoClose?' onblur="self.close();"':'')+'>'+
		'<h3 class="alignCenter">'+imageTitle+'<\/h3>'+
		'<center><img src='+imageURL+' alt="Loading image ..." title="" onload="resizeWinTo();"><\/center>'+
		'<br clear="all"><a href="javascript:window.close();">Close Window<\/a>'+
		'<\/body><\/html>');
	imgWin.document.close();
	if( imgWin.focus ) { imgWin.focus(); }
	return false;
}


/*  Pop Up Text Window code  */

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
