var framespage="mac2.php";

if (top.location==document.location) {
   //alert('Changing, individual page selected');
   var query=document.location.href.match(/\?.*/); 
   if (query==null) query="";
   top.location=framespage+query;
} else {
   var pcl=parent.location.href;
   var pclPage=pcl.substring(pcl.lastIndexOf("/")+1);
   if (pclPage.match("^"+framespage)!=framespage) {
      //checks framepage to see if it var framespage (not inc quuery)
      parent.location=framespage;
   }
}