//<![CDATA[
/*!
@file    basic.js
@short   basic javascript functions for www.quatre-mains.net
@date    28-may-2007
@author  Jo-Anne Steenbeeke

@version 01.01  28-may-2007  JSt  Initial release
*/
agt       = navigator.userAgent.toLowerCase();
is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
is_opera  = (agt.indexOf("opera") != -1);
is_mac    = (agt.indexOf("mac") != -1);
is_mac_ie = (is_ie && is_mac);
is_win_ie = (is_ie && !is_mac);
is_gecko  = (navigator.product == "Gecko");

var hideHref4moronicIE = new Array();
var screenH = 0;
var screenW = 0;
var MouseX = 0;
var MouseY = 0;
var newWindow = false;

function getScreen()
{
    if( ! is_ie ) {        //Non-IE
        screenW = new Number(window.innerWidth);
        screenH = new Number(window.innerHeight);
    } else {                                            // In IE
        if (document.documentElement.clientHeight) {    // IE 6.0+ 'standards compliant mode'
            screenW  = new Number(document.documentElement.clientWidth);
            screenH  = new Number(document.documentElement.clientHeight);
        } else {                                        // other IE
            screenW = new Number(document.body.clientWidth);
            screenH = new Number(document.body.clientHeight);
        }
    }
}

function getMouseXY(e)
{
  getScreen();
  if (is_ie)
  { // grab the x-y pos.s if browser is IE
    MouseX = event.clientX + document.body.scrollLeft
    MouseY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    MouseX = e.pageX
    MouseY = e.pageY
  }
  // catch possible negative values in NS4
  if (MouseX < 0){MouseX = 0}
  if (MouseY < 0){MouseY = 0}
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  // window.status = "mouseX : "+ MouseX + " mouseY : "+ MouseY+" screenH : "+screenH+" screenW : "+screenW;
}

if (!is_ie) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;

function NewUrlWindow(url,x,y,p,d)
{
  opts = ( p == '' || p == null ) ? 1 : p;
  doel = ( d == '' || d == null ) ? 'newWindow' : d;
  if (x < 100 || y < 20)
  {
    getScreen();
    var h = parseInt(screenH * 0.8);
    var w = parseInt(screenW * 0.8);
  }
  if (x >= 100 ) w=x;
  if (y >= 20 ) h=y;

  opties = 'width='+w+
    ',height='+h+
    ',left=30,'+
    'top=10';

  opties += (opts &  1) ? ',scrollbars=yes'   : ',scrollbars=no';
  opties += (opts &  2) ? ',resizable=yes'    : ',resizable=no';
  opties += (opts &  4) ? ',menubar=yes'      : ',menubar=no';
  opties += (opts &  8) ? ',personalbar=yes'  : ',personalbar=no';
  opties += (opts & 16) ? ',toolbar=yes'      : ',toolbar=no';
  opties += (opts & 32) ? ',titlebar=yes'     : ',titlebar=no';

  var newWindow = window.open(url,doel,opties);
  newWindow.focus();
  return
}
function bookmarksite ( MetName, url )
{
  if ( url == '' || ! url )
  {
    url = "http://"+window.location.hostname;
  }

	if(document.all)
  {
		window.external.AddFavorite(url, MetName);
	}
  else if (window.sidebar)
  {
		window.sidebar.addPanel(MetName, url, "");
	}
}

// ---== function to handle event of clicking either a pdf-score (: 1) or a sound-byte (: 2) ==--->
function listn2This( url )
{
  var Opts = 'left=50,top=100,resizable=yes';
  var newWindow = window.open('','newWindow', 'height=50px,width=200px,' + Opts);
  newWindow.location.href=url;
  newWindow.focus();
  return;
}

// ]]>