// remove frames
  if (top != self) {
    top.location.href = location.href;
  } 

//  function imgPopup(imgURL,winName,posX,posY)
/* 
   imgPopup launches Popup resized to Screen + Image
     maxWdScrn + maxHtScrn define maximum width + height of Popup
     setTimeout JavaScript Method resolves load problem in IE + Netscape with <IMG> tag
     jsTrim function removes spaces from Image URL
   Call Parameters:
     - ImageFilename - must be located in http://www.cbdusa.com/images/ScreenShot/ folder
     - Title of Popup window
     - Screen X-axis position of Popup
     - Screen Y-axis position of Popup
   Sample Call: 
     JavaScript:imgPopup('ImageFilename', 'Screenshot Title', 20, 20);
*/

var maxWdScrn = 800;
var maxHtScrn = 600;

function jsTrim(strText) {
  while (strText.substring(0,1) == ' ') 
     strText = strText.substring(1, strText.length);
  while (strText.substring(strText.length-1,strText.length) == ' ')
     strText = strText.substring(0, strText.length-1);
  return strText;
} 

function imgPopup(imgURL,winName,posX,posY) {
  imgURL = "http://www.the-town.com/images/ScreenShot/" + imgURL;
  imgURL = jsTrim(imgURL);
  popupWin=window.open("","PopupWin","toolbar=no,location=no,directories=no,status=no,copyhistory=no,scrollbars=yes,resizable=yes,width=250,height=150,screenX="+posX+",screenY="+posY+",top="+posX+",left="+posY);
  popupWin.document.open();
  popupWin.document.write("<html><head>\n");
  popupWin.document.write("<script language='javascript'>\n");
  popupWin.document.write("var maxWdScrn = " + maxWdScrn + ";\n");
  popupWin.document.write("var maxHtScrn = " + maxHtScrn + ";\n");
  popupWin.document.write("var imgW = 0;\n");
  popupWin.document.write("var imgH = 0;\n");
  popupWin.document.write("var tmpImg;\n");
  popupWin.document.write("var waitingTimer;\n");
  popupWin.document.write("var tmpURL;\n");
  popupWin.document.write("tmpImg=new Image();\n");
  popupWin.document.write("var addWd = 0;\n");
  popupWin.document.write("var addHt = 0;\n");

  popupWin.document.write("var sAgent = window.navigator.userAgent;\n");
  popupWin.document.write("if (sAgent.indexOf(\"MSIE\") > 0) {\n");
  popupWin.document.write("  addWd = 28;\n");
  popupWin.document.write("  addHt = 31;\n");
  popupWin.document.write("}\n");

  popupWin.document.write("function callLoadImg(imgURL) {\n");
  popupWin.document.write("  tmpImg.src = imgURL;\n");
  popupWin.document.write("  imgW = tmpImg.width+addWd;\n");
  popupWin.document.write("  imgH = tmpImg.height+addHt;\n");
  popupWin.document.write("  if(imgW>maxWdScrn) imgW=maxWdScrn;\n");
  popupWin.document.write("  if(imgH>maxHtScrn) imgH=maxHtScrn;\n");
  popupWin.document.write("  window.resizeTo(imgW,imgH);\n");
  popupWin.document.write("}\n");

  popupWin.document.write("function loadImg(imgURL) {\n");
  popupWin.document.write("  tmpURL = imgURL;\n");
  popupWin.document.write("  tmpImg.src = imgURL;\n");
  popupWin.document.write("  waitingTimer = setTimeout(\"callLoadImg(tmpURL)\", 0);\n");
  popupWin.document.write("}\n");

  popupWin.document.write("</script>\n");
  popupWin.document.write("<title>" + winName + "</title></head>\n");
  popupWin.document.write("<body bgcolor='#FFFFFF' leftmargin=0 topmargin=0 marginheight=0 marginwidth=0 onLoad=javascript:loadImg(\""+imgURL+"\");>\n");
  popupWin.document.write("<img src='" + imgURL + "' border='0'>");

  popupWin.document.write("</body></html>");
  popupWin.document.close();
  popupWin.focus();
}

// Details Window 
  function details(url) {
    link = window.open("Details_" + url + ".htm","ShowDetails","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=400,height=400,left=0,top=0");
  }

// Info Window 
  function info(url) {
    link = window.open(url + ".htm","ShowInfo","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=440,height=240,left=0,top=0");
  }

// BrowserInfo Window 
  function BrowserInfo() {
    link = window.open("brwsinfo.asp","BrwsInfo","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=640,height=440,left=0,top=0");
  }

// Print This Page using print.css
  function PrintWindow() {
	  var originalTitle;

    // modify title before printing
  	originalTitle = document.title;
  	document.title = document.title + " from The-Town.com";
  
  	// print
  	window.print();
  
    // reset to original value after printing
  	document.title = originalTitle;
}
