var address = "bwindow.html";//popup url
var contentframe = "http://www.newscandinavia.ru/";//used with onExitFrames();
var fs=false;// fullscreen true/false
var w=400;// width
var h=300;// height
// comment out if you do not want an exit popup just use doPopUp(); for regular popups
//onExitFrames(contentframe);
// ---------------------------------------
// FUNCTIONS// ---------------------------------------
function onExitFrames(myurl) {
 document.write("<FRAMESET ROWS='100%,*' SCROLLING=no BORDER=0 frameborder=no framespacing=0 onunload=doPopUp(",address, ",",fs,",",w,",",h,")>");
 document.write("<FRAME src="+myurl+" SCROLLING=auto BORDER=0 frameborder=0>");
 document.write("<FRAME src="+this.location.url+" SCROLLING=no name=VSmall BORDER=0 frameborder=0></frameset>");
}
// normal popup
function popup(address, mylocation, mystatus, mytoolbar, scrollbar, w, h) {
  var extra = "location="+ mylocation +",status="+ mystatus +",toolbar="+ mytoolbar +",width="+ w +",height="+ h +",scrollbar="+ scrollbar;
  window.open(address,'newwindow',extra);
}
// fullscreen popup (netscape safe, hopefully)
function fullscreen(address) {
  if (detectBrowser()=="IE") {
    window.open(address, 'newwindow', 'fullscreen=yes,scroll=no');
  } else {
    mywindow = window.open(address, 'newwindow', 'location=no,status=no,toolbar=no,scrollbar=no,width='+screen.width+',height='+screen.height);
    mywindow.focus();
    mywindow.moveTo(50,50);
  }
}
// detect users agent (browser)
function detectBrowser() {
 if (parseInt(navigator.appVersion) >= 4) {
  if (navigator.appName == "Netscape") {
   browser = "Netscape";
  } else {
   browser = "IE";
  }
 }
 return browser;
}

//execute all functions together to perform a popup
function doPopUp(address, fs, w, h, quest) {
    var expdate = new Date ();
      expdate.setTime(expdate.getTime() + (24*60*60*1000));
    if (fs) {
      fullscreen(address);
    } else {
      popup(address,'no','no','no','no',w,h);
    }
}
