// -----------------------------------------------------------------------------
// Generic RollOver
//
// Copyright (C) 2000 Jacob Hage - [jacob@hage.dk]
// Distributed under the terms of the GNU Library General Public License
// -----------------------------------------------------------------------------
// --------------------------------------------------------

// generisches Fehlerabfangen
window.onerror=null;

// Called in the "init" function onLoad. n = name, s = status, d = layer (leave blank)
// --------------------------------------------------------
function createRollOver(n,s,d) {
// --- Find image object ---
	var p;
	var i;
	var x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for(i=0;!x&&i<d.images.length;i++){
		x=d.images[i][n];
	}
	for(i=0;!x&&d.layers&&i<d.layers.length;i++){
		x=createRollOver(n,s,d.layers[i].document); 
		return x;
	}
// --- Find file name and extension ---
	imgName = (x.src.slice(0,x.src.lastIndexOf("_")+1)); // Setting the filename without extension
	imgExt 	= (x.src.slice(x.src.lastIndexOf("."),x.src.length)); // setting extension

// --- Call the rollover object ---
	eval("R_"+n+" = new rollOver(x,imgName,imgExt,s)");
}
// --------------------------------------------------------
// Generate the rollover object
// --------------------------------------------------------
function rollOver(img,imgName,imgExt,status){
	this.file		= img;
	this.norm		= new Image();
	this.norm.src = imgName+'norm'+imgExt;
	this.over		= new Image();
	this.over.src 	= imgName+'over'+imgExt;
	this.click		= new Image();
	this.click.src	= imgName+'click'+imgExt;
	this.text		= status;
}
// --------------------------------------------------------
// Function called onMouseOver, onMouseOut, onClick 
// --------------------------------------------------------
function swap(obj,action){	
	if (document.images && clicked != eval("R_"+obj)) {
		if(clicked != eval("R_"+obj)){
			eval("R_"+obj+".file.src = R_"+obj+"."+action+".src");
		}
// --- Test for any button being clicked
			if(action=="click"){
// --- Setting the previous clicked's source to normal state
			if(clicked)clicked.file.src = clicked.norm.src;
// --- Setting the current clicked image
			clicked = eval("R_"+obj);
// --- Setting the status bar if any
		} else if(action=="over" && eval("R_"+obj+".text")){
			window.status = eval("R_"+obj+".text");
		} else {
			window.status = "";
		}
	}
}
// --- Holds the object of the currently clicked image. Empty by default.
var clicked = null;

// --------------------------------------------------------
// Function that opens an url in a new window 
// --------------------------------------------------------


function openWindow(url,var_width,var_height,scroll) {
     
              agent = navigator.userAgent;
              windowName = "Console";
     
              params = "";
              params += "toolbar=0,";
              params += "location=0,";
              params += "directories=0,";
              params += "status=0,";
              params += "menubar=0,";
              params += "scrollbars=";
		params += scroll;
              params += ",resizable=1,";
              params += "width=";
			  params += var_width;
              params += ",height=";
			  params += var_height;
           
              win = window.open(url, windowName , params);
                  if (agent.indexOf("Mozilla/2") != -1 && 
     agent.indexOf("Win") == -1) {
                          win = window.open(url, windowName , params);
                  }
     
              if (win.opener == null) {
                          win.opener = window;
              }
          }