// =====================================================
// Taken from public domai
// Modified by Leing Chee Seng for Audio Note Singapore
// =====================================================


//really not important (the first two should be small for Opera's sake) 
PositionX = 10; 
PositionY = 10; 
defaultWidth  = 600; 
defaultHeight = 400; 

//This is to allow the user to click to close the pop-up window
var AutoClose = true; 

// main function to create pop-up window on the fly
// added elements for ANS
function popImage2(imageURL,imageTitle){ 
   var imgWin = window.open('','_blank','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>\n<head>\n<title>'+imageTitle+'<\/title>\n\n<script type="text\/javascript">\n'+ 
      'function resizeWinTo() {\n'+ 
      'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+ 
      //add spaces for images
	  'var oH = document.images[0].height+10, oW = document.images[0].width+10;\n'+ 
      'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled 
      'window.doneAlready = true;\n'+ //for Safari and Opera 
      'var x = window; x.resizeTo( oW + 200, oH + 200 );\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( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + 50 + ( (oH + 200 ) - myH ) );\n'+ 
      'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+ 
      'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+ 
      'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+ 
      '}\n'+ 
      '<\/script>\n'+ 
	  '<link href="..\/audionote2.css" rel=\"stylesheet\" type=\"text\/css\">\n'+
      '<\/head>\n'+
	  '<body onload="resizeWinTo();"'+(AutoClose?' onblur="self.close();"':'')+'>\n'+ 
	  (document.layers?('<layer left="0" top="0">\n'):('<div style="position:absolute;left:0px;top:0px;display:table;">\n'))+ 
      //added
	  '<span class=\"brandheader\"><center>Click on image to close this window</center></span>'+
	  '<center><a href="javascript:window.close();">'+
	  '<img src=\"'+imageURL+'\" alt="Loading image ..." title="" border=0 onload="resizeWinTo();">\n'+ 
	  '</a></center>'+
	  //added
	  '<span class=\"stdtext-10p\"><center>© Audio Note Singapore - High End 2009 - Munich, Germany</center></span>'+
      (document.layers?'<\/layer>':'<\/div>')+
	  '\n\n<script src=\"http:\/\/www.google-analytics.com\/urchin.js\" type=\"text\/javascript\"></script>'+
      '\n<script type=\"text\/javascript\">'+
	  '\n_uacct = \"UA-3277354-1\";'+
	  '\nurchinTracker();'+
	  '\n<\/script>'+
	  
	  '\n<\/body>\n<\/html>'); 
   imgWin.document.close(); 
   if( imgWin.focus ) { imgWin.focus(); } 
   return false; 
}

