// This has 2 functions for opening popup window and to handle links from popup window opening in main window and closing popup

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function aplink(link){
var par = window.opener.document;
 par.location.href = link;
 this.window.close();
}