//
//      optical_cortex
//
//      Standard A17's JS helper
//      Copyright 2007 Area 17. All rights reserved.
//

//  Browser Detection

function BrowserDetectLite()
{
  var agent = navigator.userAgent.toLowerCase();

  // Browser version.
  this.versionMajor = parseInt(navigator.appVersion);
  this.versionMinor = parseFloat(navigator.appVersion);

  // Browser name.
  this.gecko        = (agent.indexOf("firefox") != -1) || (agent.indexOf("camino") != -1);
  this.webkit       = (agent.indexOf("webkit") != -1);
  this.ie     = (agent.indexOf("msie") != -1);

  // Platform type.
  this.win   = (agent.indexOf("win")!=-1 || agent.indexOf("16bit")!=-1);
  this.mac   = (agent.indexOf("mac")!=-1);
}

var is = new BrowserDetectLite();

//  Pop-up window opening

function pop(url, width, height, style)
{
  var style = (style == null) ? "POP" : style;

  var x = 0; var y = 0; var offset = 30;

  if (screen) { x = (screen.availWidth - width) / 2 };
  if (screen) { y = (screen.availHeight - height) / 2 };

  if (style == 'standard')
  {
    var popped = window.open(url,'popup','width='+width+',height='+(height)+',status=no,menubar=no,scrollbars=no,resizable=no,screenX='+x+',screenY='+y+',left='+x+',top='+y);
  }

  if (style == 'scroll')
  {
    var popped = window.open(url,'popup','width='+width+',height='+(height)+',status=no,menubar=no,scrollbars=yes,resizable=no,screenX='+x+',screenY='+y+',left='+x+',top='+y);
  }

  if (style == 'fullscreen')
  {
    var h = screen.availHeight;
    var w = screen.availWidth;
    var popped = window.open(url,'popup','width='+w+',height='+h+',status=no,menubar=no,scrollbars=no,resizable=no,screenX=0,screenY=0,left=0,top=0');
  }

  if (!popped.opener) { popped.opener = window; }
  popped.focus();
  return popped;
}

//  Image Preloader

var images = new Array() ;

var preload = function(e)
{
  var image = new Image() ;
  image.src = e ;
  return image ;
}
