self.djp=true;
// Randomizer
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
function rnd() {
  rnd.seed = (rnd.seed*9301+49297) % 233280;
  return rnd.seed/(233280.0);
};

function rand(number) {
  return Math.ceil(rnd()*number);
};

// opens a new window
function openNewWindow(mypage,mytitle, width, height, scrollb){

  // if we're in a popup && our parent is an iturf site and still opened
  // then open the new window using the opener's openNewWin function
  if (top.opener && top.opener.top.djp) {
    return top.opener.top.openNewWindow(mypage,mytitle, width, height, scrollb);
  }
  if (mytitle == '') mytitle = null;
  if (width == null || width == '') width = 460;
  if (height == null || height == '') height = 430;
  if (scrollb == null || scrollb =='') scrollb = 0;
  else scrollb = 'yes'; 

  top.newwin=window.open(mypage, mytitle,'width='+ width +',height='+ height +',toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars='+scrollb+',resizable=yes');
  if (newwin.opener == null) {
    newwin.opener = self;
  }
  // if we're in a popup already, make my parent also my child's parent (this doesnt seem to work)
  if (top.opener) {
    newwin.opener = top.opener;
  }
  newwin.focus();
  return(true);
}

function reloadOpener(file, framename, closeMe)  {
  if (top.opener) {       // parent window still exists
    myOpener = top.opener;
    myOpenerTop = top.opener.top; // our opener should always be a top, but enforce anyway
    // check that we're really going to an iturf window (my initials...)
    if (! myOpenerTop.djp) {
      return false; // parent win is not an iturf site
    } 

    // check for possible frameset to jump to...
    if (framename) {
      if (! eval('myOpenerTop.'+framename)) {
        // i found my parent but i cant find my required frame
        if (closeMe) top.close();
        return false;
      } else {
        // i found the frame i'm lookin for 
        tmpframe = eval('myOpenerTop.'+framename);
        tmpframe.location.href = file;
        if (closeMe) top.close();
        return true;
      }
    } else {
      //frame name was not defined, so refresh the main page
      myOpenerTop.location.href = file;
      if (closeMe) top.close();
      return true;
    }
  } else { 
    // this window opener is NULL (i cant find my parent)
    return false;
  }
}
function FeedbackPop (mypage){ return(openNewWindow(mypage,'feedback',560,300,'scroll'));}
function MailFriendPop (mypage){ return(openNewWindow(mypage,'emailfriend',400,325,''));}
function FrontPopup (mypage){ return(openNewWindow(mypage,'frontpop',287,185,''));}
function BSBPop (mypage){ return(openNewWindow(mypage,'bsbpop',382,214,''));}
function MailHelpPop (mypage){ return(openNewWindow(mypage,'help',400,550,''));}
function ItemPop (mypage){ return(openNewWindow(mypage,'itempop',690,810,'scroll'));}
function GPAPop (mypage){ return(openNewWindow(mypage,'gpapop',500,500,''));}


self.djpLoaded=1;

