
imgError = "../../JPEGs/nophoto.jpg";//popups can only be done from "homepage/Search/XX/XX_examplepage.html
imgNull="../../JPEGs/spacer.jpg";
imgPath = "images/280/";  //if images are being poped from somewhere else, the path needs to be set in the script block
dimsPath = "images/dimensions/"; 
dimsImgPath=imgPath;
illusPath = "images/illustrations/";
PositionX = 1;
PositionY = 200;
defaultWidth  = 500;
defaultHeight = 300;
var AutoClose = true;

if (parseInt(navigator.appVersion.charAt(0))>=4){
  var isNN=(navigator.appName=="Netscape")?1:0;
  var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
  var isWC=(isNN==0 && isIE==0)?1:0;
}
var optNN='scrollbars=yes,resizable=yes,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=yes,resizable=yes,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optWC='scrollbars=yes,resizable=yes,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle){
  if (isNN){imgWin=window.open('about:blank','',optNN);}
  if (isIE){imgWin=window.open('about:blank','',optIE);}
  if (isWC){imgWin=window.open('about:blank','',optWC);}
  with (imgWin.document){
      writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');

      //Start Client Scripting
      writeln('<sc'+'ript>');

      //Browser Detection IE or NN, Major version 4 and above
      writeln('var isNN,isIE;');
      writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
      writeln('isNN=(navigator.appName=="Netscape")?1:0;');
      writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');

      //resize window to fit image - reSizeToImage
      writeln('function reSizeToImage(){');
      //if Internet Explorer - isIE = True (1) or False (0)?
      writeln('if (isIE){');
      //writeln('window.resizeTo(100,100);');
      writeln('width=(document.images[0].width + 12);');
      writeln('height=(document.images[0].height + 64);');
      writeln('window.resizeTo(width,height);}');
      //If Netscape Navigator
      writeln('if (isNN){');       
      writeln('window.innerWidth=document.images["George"].width;');
      writeln('window.innerHeight=document.images["George"].height;}}');

      //Write the tiltle of the window
      writeln('function doTitle(){document.title="'+imageTitle+'";}');

      //close scripts
      writeln('</sc'+'ript>');

      //call required funcitons in body onload event
      if (!AutoClose) writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
      else writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');

      //add image container
      writeln('<img name="George" src="'+imageURL+'" style="display:block" onError="this.onerror=null;this.src=\'' + imgError +'\';"></body></html>');

  //Close imgWin.document object
  close();
	
//Terminate popImage function	
}
}


function popURL(URL)
{
  if (isNN){Win=window.open(URL,'',optNN);}
  if (isIE){Win=window.open(URL,'',optIE);}
  if (isWC){Win=window.open(URL,'',optWC);}
  with(Win.document)
  {
	  body.onLoad=new function(){self.focus();};
	  body.onBlur=new function(){self.close();};
  }
}

function popImageSpecs(imageURL,imageTitle)
{	
	if(arguments.length==1)
	{
		imageTitle=imageURL;
		imageURL=imgPath+imageTitle+".jpg";
	}
	imageTitle=imageTitle.replace("%20"," ");
	imageTitle=imageTitle.toUpperCase();
  if (isNN)
  	imgWin=window.open('about:blank','',optNN);
  if (isIE)
  	imgWin=window.open('about:blank','',optIE);
  if (isWC)
  	imgWin=window.open('about:blank','',optWC);
  with (imgWin.document)
  {
      writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');

      //Start Client Scripting
      writeln('<sc'+'ript>');

      //Browser Detection IE or NN, Major version 4 and above
      writeln('var isNN,isIE;');
      writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
      writeln('isNN=(navigator.appName=="Netscape")?1:0;');
      writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');

      writeln('window.onblur=function(){this.close();};');
      //resize window to fit image - reSizeToImage
      writeln('function reSizeToImage(){');
      //if Internet Explorer - isIE = True (1) or False (0)?
      writeln('if (isIE){');
      //writeln('window.resizeTo(100,100);');
      writeln('width=(document.getElementById("George").offsetWidth + 12);');
      writeln('height=(document.getElementById("George").offsetHeight + 64);');
      writeln('window.resizeTo(width,height);}');
      //If Netscape Navigator
      writeln('if (isNN){');
      writeln('window.innerWidth=document.getElementById("George").offsetWidth;');
      writeln('window.innerHeight=document.getElementById("George").offsetHeight;}}');

      //Write the tiltle of the window
      writeln('function doTitle(){document.title="'+imageTitle+'";}');

      //close scripts
      writeln('</sc'+'ript>');

      //call required funcitons in body onload event
      if (!AutoClose) writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
      else writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()" xxonblur="self.close()">');
	
      //write a table to put everything in
      writeln('<table name="George" id="George"><tbody><tr>');
      
      //add image container
      writeln('<td><img src="'+imageURL+'" style="display:block" onError="this.onerror=null;this.src=\'' + imgError +'\';"></td>');      
      try
      {
	      if(!Specs[imageTitle])
	      {
		      if(imageTitle.charAt(imageTitle.length-1)=='C')
		      	imageTitle=imageTitle.substr(0,imageTitle.length-1);
		      else
		      	imageTitle+='C';
	      }
     
	      //add spec info
	      if(Specs[imageTitle])
	      {
		      writeln('<td>');
		      var i;
		      for(i=0;i<Specs[imageTitle].length;i++)
		      	writeln(Specs[imageTitle][i][0]+": "+Specs[imageTitle][i][1]+"<br/>");
		      writeln('</td>');
      	  }
      }
      catch(e){}
      
      writeln('</body></html>');

      //Close imgWin.document object
      close();
  }
}

function popImageDims(imageTitle)
{
	imageURL=dimsImgPath+imageTitle+".jpg";
	imageTitle=imageTitle.replace("%20"," ");
	imageTitle=imageTitle.toUpperCase();
	
  if (isNN)
  	imgWin=window.open('about:blank','',optNN);
  if (isIE)
  	imgWin=window.open('about:blank','',optIE);
  if (isWC)
  	imgWin=window.open('about:blank','',optWC);
  with (imgWin.document)
  {
      writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');

      //Start Client Scripting
      writeln('<sc'+'ript>');

      //Browser Detection IE or NN, Major version 4 and above
      writeln('var isNN,isIE;');
      writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
      writeln('isNN=(navigator.appName=="Netscape")?1:0;');
      writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');

      writeln('window.onblur=function(){this.close();};');
      //resize window to fit image - reSizeToImage
      writeln('function reSizeToImage(){');
      //if Internet Explorer - isIE = True (1) or False (0)?
      writeln('if (isIE){');
      //writeln('window.resizeTo(100,100);');
      writeln('width=(document.getElementById("George").offsetWidth + 12);');
      writeln('height=(document.getElementById("George").offsetHeight + 64);');
      writeln('window.resizeTo(width,height);}');
      //If Netscape Navigator
      writeln('if (isNN){');
      writeln('window.innerWidth=document.getElementById("George").offsetWidth;');
      writeln('window.innerHeight=document.getElementById("George").offsetHeight;}}');

      //Write the tiltle of the window
      writeln('function doTitle(){document.title="'+imageTitle+'";}');

      //close scripts
      writeln('</sc'+'ript>');

      //call required funcitons in body onload event
      if (!AutoClose) writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
      else writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()" xxonblur="self.close()">');
	
      //write a table to put everything in
      writeln('<table name="George" id="George"><tbody><tr>');
      
      //add image container
      writeln('<td><img src="'+imageURL+'" style="display:block" onError="this.onerror=function(){this.onerror=null;this.src=\'' + imgError +'\';};this.src=\''+illusPath+imageTitle+'.jpg\';"></td>');
      
      writeln('<td><img src="'+dimsPath+imageTitle+'.jpg" style="display:block" onError="this.onerror=null;this.src=\''+imgNull+'\';"></td>');
      
      writeln('</body></html>');

      //Close imgWin.document object
      close();
  }
}