// JavaScript Document
var VRWindow ; // needs to be a global variable
var newWindow ; 
function makeBig()
{
  window.moveTo(0,0);
  window.resizeTo(screen.availWidth,screen.availHeight);
}

function openNewWindowX(url) 
{
  //newWindow=window.open(url,'piagetfull', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=900,height=740,left = 400,top = 4000');
  var wid = screen.availWidth;
  var hei = screen.availHeight ;
  if(newWindow == null || newWindow.closed)
{
//  newWindow=window.open(url,'jetflyfull', //'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+wid+',height='+hei+',left=0,top=0');
  newWindow=window.open(url,'jetflyfull','toolbar=0, scrollbar=1, location=0,statusbar=0,menubar=0,resizable=0,width='+wid+',height='+hei+',left=0,top=0');
  }
  else if(!newWindow.closed)
{
newWindow.focus();
}
  //newWindow.moveTo(0,0);
  //newWindow.resizeTo(screen.availWidth,screen.availHeight);
}

function openVRWindow(url) 
{
  //newWindow=window.open(url,'piagetfull', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=900,height=740,left = 400,top = 4000');
  var hpos = Math.round(screen.availWidth/2)  - 500;
  var vpos = 150;
if(VRWindow == null || VRWindow.closed)
{
 VRWindow=window.open(url,'VR', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=465,left='+hpos+',top='+ vpos+'');
}
else if(!VRWindow.closed)
{
VRWindow.focus();
}
}

function getQuery(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
//  alert('Query Variable ' + variable + ' not found');
}