

/***************************************************************************************
     Generic functions and variables. Copyright 2004 (c) www.donjohnsonbigband.com.
 ***************************************************************************************/


// globals for browser version branching
// see: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var agt = navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
           && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
           && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav4up = (is_nav && (is_major >= 4));
var is_nav6up = (is_nav && (is_major >= 5));
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1));
var is_ie4up  = (is_ie && (is_major >= 4));
var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1));
var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1));
var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);


// globals for window openers
if (!(photoWin && !photoWin.closed && photoWin.location)) {
  var photoWin = null;
}

var imageWin = null;
var notesWin = null;
var notes_x = null;
var notes_y = null;
var image_x = null;
var image_y = null;


// a basic window opener
function openWin(mypage, myname, w, h) {
  var win;
  settings = 'height='+h+',width='+w+',top=0,left=0,directories=no,fullscreen=no,hotkeys=yes,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=yes,toolbar=no';
  win = window.open(mypage,myname,settings);
  if (win.window.focus) {
    win.window.focus();
  }
}


// a basic window opener w/ scrollbars
function openWinScrollbars(mypage, myname, w, h) {
  var win;
  settings = 'height='+h+',width='+w+',top=0,left=0,directories=no,fullscreen=no,hotkeys=yes,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=no';
  win = window.open(mypage,myname,settings);
  if (win.window.focus) {
    win.window.focus();
  }
}


// a window opener for images
function viewImage(imageid, w, h) {
  var dx = null;
  var dy = null;
  //w = w + 42;
  //h = h + 42;
  if ((!imageWin) || (imageWin.closed) || (imageWin == "[object Object]")) {
    image_x = w;
    image_y = h;
    imageWin = window.open('/popup/viewimage.html?language='+lang+'&id='+imageid,'djbb_imagewin','toolbar=no,location=no,top=0,left=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+w+',height='+h+',dependent=yes');
  } else {
    dx = w - imageWin.load_x;
    dy = h - imageWin.load_y;
    image_x = w;
    image_y = h;
    imageWin.location.href = '/popup/viewimage.html?language='+lang+'&id='+imageid;
    imageWin.resizeBy(dx, dy);
    if (imageWin.window.focus) {
      imageWin.focus();
    }
  }
}


// a window opener for photos
function viewPhoto(imageid, catid, w, h) {
  var dx = null;
  var dy = null;
  w = w + gallery_width_space;
  h = h + gallery_height_space;
  if (photoWin && !photoWin.closed && photoWin.location) {
    dx = w - photoWin.wx;
    dy = h - photoWin.wy;
    photoWin.location.href = '/popup/viewphoto.html?language='+lang+'&id='+imageid+'&wx='+w+'&wy='+h+'&catid='+catid;
    photoWin.resizeBy(dx, dy);
    if (photoWin.window.focus)
      photoWin.focus();
  } else {
    photoWin = window.open('/popup/viewphoto.html?language='+lang+'&id='+imageid+'&wx='+w+'&wy='+h+'&catid='+catid,'djbb_photowin','toolbar=no,location=no,top=0,left=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+w+',height='+h+',dependent=yes');
  }
}


// a window opener for discography notes
function viewNotes(songid, w, h) {
  var dx = null;
  var dy = null;
  if ((!notesWin) || (notesWin.closed) || (notesWin == "[object Object]")) {
    notes_x = w;
    notes_y = h;
    notesWin = window.open('/popup/viewnotes.html?language='+lang+'&id='+songid,'djbb_notes','toolbar=no,location=no,top=0,left=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+w+',height='+h+',dependent=yes');
  } else {
    dx = w - notesWin.load_x;
    dy = h - notesWin.load_y;
    notes_x = w;
    notes_y = h;
    notesWin.location.href = '/popup/viewnotes.html?language='+lang+'&id='+songid;
    notesWin.resizeBy(dx, dy);
    if (notesWin.window.focus) {
      notesWin.focus();
    }
  }
}


function doTooltip(e, msg) {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.show(e, msg);
}


function hideTip() {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.hide();
}
