Handling Popup if popup name is constant

selenium.click("stringlocator");

selenium.waitforpagetoload("40000");
selenium.selectwindow("popname");
perform actions on popup
selenium.selectwindow("null"); //return to mainwindow
selenium.selectwindow("mainwindow");
perform actions on mainwindow