var newWin;

function openWin(url, width, height, winName) {
  if (winName == null) {
    winName = "preview_win";  
    sX = 100;
    sY = 20;
  } else {
    sX = (window.screen.availWidth - width) / 3;
    sY = (window.screen.availHeight - height) / 3; 
  }
  if (newWin != null) { newWin.close(); }
  newWin = window.open(url, winName, 'scrollbars=no,width='+ width +',height='+ height +',screenX='+ sX +',screenY='+ sY +',top='+ sY +',left='+ sX +',dependent=yes,innerWidth='+ width +',innerHeight='+ height +'');
  newWin.focus();
}

function openWinScroll(url, width, height) {
  if (newWin != null) { newWin.close(); }
  newWin = window.open(url, 'preview_win', 'resizable=yes,scrollbars=yes,width='+ width +',height='+ height +',screenX=0,screenY=0,top=0,left=0,dependent=yes,innerWidth='+ width +',innerHeight='+ height +'');
  newWin.focus();
}
/**
 * Writes the doubled transparent divs that sit behind our content divs
 * to give the cool alpha effect.
 *
 * Sets timeout to draw new divs because of a strange IE 5.5 rendering bug
 * where offscreen divs would be drawn but not rendered properly without
 * the wait.
 */
var transparentDivs = new Array();

function writeTransparentDivs() {
  var theBody = document.body;  
  var theElement;
  var contentDivs = document.getElementsByTagName("DIV");
  
  var writtenDivs=0;
	// holds offset pixels because these divs are held inside a table
	// this is bad positioning, but the only way to get this layout to work
	//																																	
	var pixelTop  = 94;
	var pixelRight = 5;
  
  for (var i=0; i < contentDivs.length; i++) {
    if (contentDivs[i].className == "generalContainer") {
      writtenDivs++;
      // create new alpha div to sit behind...
      transparentDivs.push(document.createElement("DIV"));
      num = transparentDivs.length-1;
      transparentDivs[num].className    = "backgroundDiv";
      theElement = contentDivs[i];
      transparentDivs[num].style.top    = theElement.offsetTop + pixelTop;
      transparentDivs[num].style.right  = pixelRight;
      transparentDivs[num].style.width  = theElement.offsetWidth;
      transparentDivs[num].style.height = theElement.offsetHeight;
      
      window.setTimeout("document.body.insertBefore(transparentDivs["+ num +"]);",1);
    }
  }
  
}

function flashGoTo(section) {
  var nav = parent.window.document.flashNav;
  nav.TCallLabel("/", section);
}
