var imgPopupWnd = null;
//var otherPopupWnd = null;

function popupimages(url,w,h)
{
    if (imgPopupWnd && !imgPopupWnd.closed)
    imgPopupWnd.close();
/*    setTimeout("wopen2(\"" + url + "\"," + w + "," + h + ");",200); */
    setTimeout("showBigImage('" + url + "'," + w + "," + h + ", '');",200);
}
/*
function wopen2(url,w,h)
{
    w += 20;
    h += 20;
    imgPopupWnd = window.open("" + url + "","BD4Image","width=" + w + ",height=" + h + ",scrollbars=0,menubar=0,toolbar=0,resizable=0,status=0,directories=0,top=0,left=0");
}
*/
function writeEmailLink(address,description)
{
    var i = address.indexOf('$');
    var fixedEmail = address.substring(i+1,address.length) + String.fromCharCode(64) + address.substring(0,i);
    var linkStr = '<a href="' + 'mai' + 'lto:' + fixedEmail + '" title="' + fixedEmail + '">';

    if (description == '')
      description = fixedEmail;
    document.write(linkStr + description + '<\/a>');
}

/*
function frameSync()
{
 if (parent.left.location.href!="http://northwest-aero.com/bd4arc/index.html")
   parent.left.location.href="index.html";
}
*/

function showBigImage(url, picwidth, picheight, description)
{
  if (!imgPopupWnd || imgPopupWnd.closed)
  {
    usrwidth = screen.width;
    usrheight = screen.height;

    winwidth = picwidth + 20;
    winheight = picheight + 50;

    var X = (usrwidth - winwidth) / 2;
    var Y = (usrheight - winheight) / 2;

    properties = "toolbar=no,statusbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width="+winwidth+",height="+winheight+",";

    checkie = navigator.appName.indexOf("icrosoft");
    if (checkie == -1)
    {
      properties = properties+"screenX="+X+",screenY="+Y;
    }
    else
    {
      properties = properties+"left="+X+",top="+Y;
    }

    imgPopupWnd = window.open('','imgPopupWnd',properties);

    imgPopupWnd.document.open();
    imgPopupWnd.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"');
    imgPopupWnd.document.write('  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
    imgPopupWnd.document.write('<HTML><HEAD>');
    imgPopupWnd.document.write('<TITLE>'+description+'</TITLE>');
    imgPopupWnd.document.write('</HEAD>');
    imgPopupWnd.document.write('<BODY style+"vertical-align: center; text-align: center; margin: none; background-color: black;">');
//    imgPopupWnd.document.write('<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" TOPMARGIN="0" BOTTOMMARGIN="0">');
    imgPopupWnd.document.write('<div style="text-align:center"><A HREF="JavaScript:self.close()"><IMG SRC="'+url+'" HSPACE="0" VSPACE="0" BORDER="0" style="border: solid 1px black"></A></div>');
    imgPopupWnd.document.write('<div style="text-align:right; margin-top: 3px"><input type="submit" onclick="window.close()" value="Close"/></div>');
    imgPopupWnd.document.write('</BODY>');
    imgPopupWnd.document.write('</HTML>');
    imgPopupWnd.document.close()

    imgPopupWnd.focus();
  }
  else
  {
    imgPopupWnd.focus();
  }
}
/*
function openPopupWnd(url, width, height)
{
  if (!otherPopupWnd || otherPopupWnd.closed)
  {
    usrwidth = screen.width;
    usrheight = screen.height;

//    winwidth = picwidth + 20;
//    winheight = picheight + 50;

    var X = (usrwidth - width) / 2;
    var Y = (usrheight - height) / 2;

    properties = "toolbar=no,statusbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width="+width+",height="+height+",";

    checkie = navigator.appName.indexOf("icrosoft");
    if (checkie == -1)
    {
      properties = properties+"screenX="+X+",screenY="+Y;
    }
    else
    {
      properties = properties+"left="+X+",top="+Y;
    }

    otherPopupWnd = window.open(url,'otherPopupWnd',properties);
    otherPopupWnd.focus();
  }
  else
  {
    otherPopupWnd.focus();
  }
}
*/