<!--
//////////////////////////////////////////////////////////////////////////////
//
// JavaScript PopUp Window Script - 
//
// Opens a new child window, takes the following parameters:
//  loc = URL
//  name = window name
//  w = width
//  h = height
//  pos = position ('left', 'right', 'center'
//  scroll = include scrollbars ('yes' or 'no')
//  toolbar = include scrollbars ('yes' or 'no')
//  menubar = include scrollbars ('yes' or 'no')
//  addressbar = include scrollbars ('yes' or 'no')
//  directories = include scrollbars ('yes' or 'no')
//  resize = include scrollbars ('yes' or 'no')
//  status = include scrollbars ('yes' or 'no')
//
//////////////////////////////////////////////////////////////////////////////
function popUpWindow(loc,name,w,h,pos,scroll,toolbar,menubar,addressbar,directories,resize,status)
{
  goWhere = loc;
  windowName = name;
  wWidth = w;
  wHeight = h;

  if(pos=="center"){
    leftLoc = window.screen.width/2 - w/2;
    topLoc = window.screen.height/2 - h/2;
  }
  else if(pos=="left"){
    leftLoc = 0;
    topLoc = 0;
  }
  else if(pos=="right"){
    leftLoc = window.screen.width - w - 10;
    topLoc = 0;
  }

  sBars = scroll;
  tBar = toolbar;
  mBar = menubar;
  aBar = addressbar;
  dBar = directories;
  statusBar = status;
  canResize = resize;
  
  // USE THIS TO OPEN THE WINDOW THE NORMAL WAY
  return window.open(goWhere,windowName,config='height='+wHeight+',width='+wWidth+',left='+leftLoc+',top='+topLoc+',toolbar='+tBar+',menubar='+mBar+',scrollbars='+sBars+',resizable='+canResize+',location='+aBar+',directories='+dBar+',status='+statusBar+'');

  // USE THIS TO 'GROW' THE WINDOW OPEN
  //return zoomBox(loc,name,w,h,scroll,toolbar,menubar,addressbar,directories,resize,status)

}




var maxW,maxH,fromX,fromY,toX,toY,adjX,adjY,zBox,zStep=0,zLink,zNew;
var fX, fY, sX, sY, tX, tY


function popUp(loc,name,w,h,pos,scroll,toolbar,menubar,addressbar,directories,resize,status,bReOpen,theWin) {
  if(window.event) {
    fX = window.event.x;
    fY = window.event.y;
    sX = window.screenLeft;
    sY = window.screenTop;
    if(pos=="center"){
      tX = document.body.clientWidth/2 - w/2;
      tY = document.body.clientHeight/2 - w/2;
    }
    else if(pos=="left"){
      tX = 0;
      tY = 0;
    }
    else if(pos=="right"){
      tX = window.screen.width - w - 10;
      tY = 0;
    }
  }else {
    fX = 0;
    fY = 0;
    sX = window.screenX + (window.outerWidth - window.innerWidth);
    sY = window.screenY + (window.outerHeight - window.innerHeight);
    if(pos=="center"){
      tX = window.innerWidth/2 - w/2;
      tY = window.innerHeight/2 - w/2;
    }
    else if(pos=="left"){
      tX = 0;
      tY = 0;
    }
    else if(pos=="right"){
      tX = window.screen.width - w - 10;
      tY = 0;
    }
  }

	if ( theWin != null ) {
		if (theWin.closed) {
			theWin = popUpWindow(loc,name,w,h,pos,scroll,toolbar,menubar,addressbar,directories,resize,status); }
		else { 
		   if (bReOpen) {
		      theWin.close();
		      theWin = popUpWindow(loc,name,w,h,pos,scroll,toolbar,menubar,addressbar,directories,resize,status); }
		   else { 
		      theWin.location = loc;
		      theWin.focus(); }
		}
	}
	else { 
		theWin = popUpWindow(loc,name,w,h,pos,scroll,toolbar,menubar,addressbar,directories,resize,status);
	}
	
  return theWin;
}


function zoomBox(loc,name,w,h,scroll,toolbar,menubar,addressbar,directories,resize,status) {
  scrollH=(window.pageYOffset!=null)?window.pageYOffset:document.body.scrollTop;
  
  maxW=w?w:window.innerWidth?innerWidth:document.body.clientWidth;
  maxH=h?h:window.innerHeight?innerHeight:document.body.clientHeight;

  toX=tX;
  toY=tY+scrollH;

  fromX=fX;
  fromY=fY;

  adjX=toX + sX;
  adjY=toY + sY;
  if((Number(adjX) + Number(w)) >= window.screen.width) adjX = window.screen.width - w;
  if((Number(adjY) + Number(h)) >= window.screen.height) adjY = window.screen.height - h;

  if (document.createElement && document.body.appendChild && !zBox) {
  	zBox=document.createElement("div");
  	zBox.style.position="absolute";
  	document.body.appendChild(zBox);
  } else if (document.all && !zBox) {
  	document.all[document.all.length-1].outerHTML+='<div id="zBoxDiv" style="position:absolute"></div>';
  	zBox=document.all.zBoxDiv;
  } else if (document.layers && !zBox) {
  	zBox=new Layer(maxW);
  	zBox.style=zBox;
	}

  zLink=loc;

  return doZoom();
}

function doZoom() {
  zStep+=1;
  zPct=(10-zStep)/10
  if (document.layers) {
  	zBox.moveTo(toX+zPct*(fromX-toX),toY+zPct*(fromY-toY));
  	zBox.document.open();
  	zBox.document.write("<table width='"+maxW*(1-zPct)+"' height="+maxH*(1-zPct)+" border=2 cellspacing=0><tr><td></td></tr></table>");
  	zBox.document.close();
	} else {
  	zBox.style.border="2px solid #999999";
  	zBox.style.left=toX+zPct*(fromX-toX);
  	zBox.style.top=toY+zPct*(fromY-toY);
  	zBox.style.width=maxW*(1-zPct);
  	zBox.style.height=maxH*(1-zPct);
	}
  zBox.style.visibility="visible";
  if (zStep < 10) setTimeout("doZoom("+fromX+","+fromY+","+toX+","+toY+")",30);
  else {
  	zBox.style.visibility='hidden';
  	zStep=0;
 		theWin = window.open(zLink,'','width='+maxW+',height='+maxH+',left='+adjX+',top='+adjY+',scrollbars,resizable');
 		zNew=null;
	  return theWin;
	}
}




//////////////////////////////////////////////////////////////////////////////
//
// Wrapper for popupWindow() function
// Accepts the same parameters, adds two:
//		bReOpen: if true closes and opens an existing window, if false, re-uses existing open window
//		theWin: a page var of the new/existing window
//
//////////////////////////////////////////////////////////////////////////////

function popUpX(loc,name,w,h,pos,scroll,toolbar,menubar,addressbar,directories,resize,status,bReOpen,theWin) {
	
	if ( theWin != null ) {
		if (theWin.closed) {
			theWin = popUpWindow(loc,name,w,h,pos,scroll,toolbar,menubar,addressbar,directories,resize,status); }
		else { 
		   if (bReOpen) {
		      theWin.close();
		      theWin = popUpWindow(loc,name,w,h,pos,scroll,toolbar,menubar,addressbar,directories,resize,status); }
		   else { 
		      theWin.location = loc;
		      theWin.focus(); }
		}
	}
	else { 
		theWin = popUpWindow(loc,name,w,h,pos,scroll,toolbar,menubar,addressbar,directories,resize,status);
	}
	
  return theWin;
}

//-->