var pop //initialize as global variable so that it will only have a null value once

function popUp(URL,width,height,top,left){
/* if we test closed property when window has not been opened (null), the script will die here. So before testing closed property, make sure window has been opened(does not have a null value) */
if(pop!=null && !pop.closed){  
pop.close()//if pop is opened, close it before running open method in order to re-assign properties
}

pop = window.open(URL,"win1","width="+width+",height="+height+",top=+top+,left=+left+,resizable=1")

pop.focus()  // forces the popup to come to the front if it has already been opened, but not closed
}