
var queryParameters = new Array();

window.onload=init;

function init(){
  getparameters();
  initpanproject();
  startbearing = queryParameters['bearing'];
  initge();
//  initpan();
//  selectpan(queryParameters['pan']);
}

function getparameters(){
  var query = window.location.search.substring(1);
  var parms = query.split('&');
  for (var i=0; i<parms.length; i++) {
    var pos = parms[i].indexOf('=');
    if (pos > 0) {
      var key = parms[i].substring(0,pos);
      var val = parms[i].substring(pos+1);
      queryParameters[key] = val;
    }
  }
}

function initpanproject(){
  document.onmousemove = mousemove;

  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  var vpwidth = myWidth - 200;
  var vpheight = Math.round(vpwidth * 0.30);
  var mapheight = myHeight - vpheight - 20;
  var mapwidth = mapheight;
  var mapleft = 10 + (vpwidth - mapwidth) / 2;
  if (mapleft < 250) mapleft = 250;
  $("#map3dcontainer").css({'width' : mapwidth, 'height' : mapheight, 'left' : mapleft});
  $("#viewportdiv").css({'top' : mapheight + 10, 'width' : vpwidth, 'height' : vpheight});
  $("#zoomicons").css({'top' : mapheight + 10, 'left' : vpwidth + 20, 'visibility': 'visible'});
  $("#compass").css({'top' : mapheight + 100, 'left' : vpwidth + 20, 'visibility': 'visible'});
  $("#bearingline").css({'top' : mapheight + 250, 'left' : vpwidth + 20, 'visibility': 'visible'});
}

