function posSpecification (x, y) {
	if (navigator.appName.indexOf("Microsoft")>=0) {
		return "left=" + x + ",top=" + y;
	}else{
		return "screenX=" + x + ",screenY=" + y;
	}
}

function WinVideo(url, width, height) {
	return WinMedia(url, width, height);
}

function WinAudio(url, width, height) {
	return WinMedia(url, width, height);
}

function WinBigImg(url, width, height) {
	return WinMedia(url, width, height);
}

function WinMedia(url, width, height) {
	style = 'location=no,status=no,menubar=no,toolbar=no,scrollbars=no,resizable=yes';
	return WinOpen(url, width, height, style);
}

function WinLittle(url) {
	width=588;
	height=350;
	return WinSimpleWindow(url, width, height);
}

function WinSingleSection(url, width) {
	height = Math.floor(screen.availHeight / 4) * 3;
	return WinSimpleWindow(url, width, height);
}

function WinSimpleWindow(url, width, height) {
	style = 'location=no,status=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes';
	return WinOpen(url, width, height, style);
}

function WinNewWindow(url, width, height) {
   	width += 0;
	height += 0;
	style = '';
	if (width == 0 && height == 0) 
	   return true;
	else
	   return WinOpen(url, width, height, style);
}

// this function should be called from this script only
function WinOpen(url, width, height, style) {
   	width += 0;
	height += 0;
	style += '';

	if (width == 0) {	                	
	   if (window.innerWidth > 0)
	   	  width = window.innerWidth;		 	// Netscape
	   else
	   	  width = document.body.offsetWidth; 	// IE
	}	   
	if (height == 0) {	                	
	   if (window.innerHeight > 0)
	   	  height = window.innerHeight;		 	// Netscape
	   else
	   	  height = document.body.offsetHeight; 	// IE
	}	   
	if (style == '') {
	   style='location=yes,status=yes,menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes';
	   x = 0;
	   y = 0;
 	}
 	else {
		 x = Math.floor((screen.availWidth - width - 10) / 2);
		 y = Math.floor((screen.availHeight - height - 30) / 2);
  	}
	
	style += ',width=' + width + ',height=' + height 
		  +  ',left=' + x + ',top=' + y 
		  +  ',screenX=' + x + ',screenY=' + y;
	
	win = window.open(url, '_blank', style);
	win.focus();	                                         	

	return false;
}


function tipOn(type, p2, p3, p4, p5, p6, p7, p8, p9) {
	if (type == 'Link')
	{
		if (p2 == 'Glossary')
		{
			overlib(toolTips['Glossary_Glossary_'+p3]);
		}
		if (p2 == 'Bibliography')
		{
			overlib(toolTips['Bibliography_Bibliography_'+p3]);
		}
	}
}

function tipOff () {
	nd();
}

// div operator simulation
function div(op1, op2) {
  return(op1 / op2 - op1 % op2 / op2);
}

// Change the references of links and images
function changeRefs(){
	var wlhref = window.location.href;
	var dlinks = document.links;
	for (var i=0; i<(dlinks.length); i++)
		if ((dlinks[i].href.indexOf(wlhref)==-1))
		dlinks[i].target = '_blank';
}


// Called in the head of every page
function addToHead() {
	// alert("addToHead");
}

function toggleExpand(expId){
   	if(!document.getElementById) return;
	var expCont = document.getElementById('expand-content-' + expId);
	if (expCont){
		if (expCont.style.display == 'none'){
			showExpand(expId);
		} else{
			hideExpand(expId);
		}
	}
}

function toggleExpand(expId, hideShort){
   	if(!document.getElementById) return;
	var expCont = document.getElementById('expand-content-' + expId);
	if (expCont){
		if (expCont.style.display == 'none'){
			showExpand(expId, hideShort);
		} else{
			hideExpand(expId, hideShort);
		}
	}
}

function showExpand(expId, hideShort){
   	if(!document.getElementById) return;
	var expCont = document.getElementById('expand-content-' + expId);
	var expShort = document.getElementById('expand-short-' + expId);
	var expMore = document.getElementById('expand-more-' + expId);
	if (expCont){
		expCont.style.display = 'block';
		var icon = document.getElementById('expand-icon-' + expId);
		if (icon){
			m = icon.src.match("(.*)/(.*)");
			icon.src = m[1] + '/expanded.gif';
			icon.alt = 'Mehr';
		}
	}
	if (expShort && hideShort){
		expShort.style.display = 'none';
	}
	if (expMore){
		expMore.style.display = 'none';
	}
}

function hideExpand(expId, hideShort){
   	if(!document.getElementById) return;
	var expCont = document.getElementById('expand-content-' + expId);
	var expShort = document.getElementById('expand-short-' + expId);
	var expMore = document.getElementById('expand-more-' + expId);
	if (expCont){
		expCont.style.display = 'none';
		var icon = document.getElementById('expand-icon-' + expId);
		if (icon){
			m = icon.src.match("(.*)/(.*)");
			icon.src = m[1] + '/unexpanded.gif';
			icon.alt = 'Weniger';
		}
	}
	if (expShort){
		expShort.style.display = 'block';
	}
	if (expMore){
		expMore.style.display = 'block';
	}
}

// Detection of a plugin inside Netscape Navigator
// Only for exact matches of the teststring
function detectObjectNS(teststring)
{
	result = false;
	if (is.nav)
	{
		result = (navigator.plugins[teststring]) ? true:false;
	}

	return result;
}

// Detects an activeX object under IE/Win
// Not etsted:
function detectObjectIE(ClassID)
{
	result = false;
	if ((xlml.client.ie) && (xlml.client.win))
	{
		document.write('<SCRIPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('result = IsObject(CreateObject("' + ClassID + '")) \n');
		document.write('</SCRIPT\> \n');
	}
	return result;
}
// Define the onLoad function
// window.onload = function() {
//    onLoad();
// }

// Put inside this function everething which has to be done
// after the page is loaded.
// function onLoad() {
//	alert("Onload");
// }

function initXlml() {

	// Init browser specific
	xlml.client = new Object();
	var agt = navigator.userAgent.toLowerCase();

	xlml.client.win = agt.indexOf("win") != -1;

	xlml.client.ie = false;
	xlml.client.nsCompat = false;
	xlml.client.canActiveX = false;

	if (agt.indexOf('msie') != -1) {
		xlml.client.ie = true;
		if (xlml.client.win) xlml.client.canActiveX = true;
	}
	else {
		xlml.client.nsCompat = true;
	}
}
// Create the XLML main object
var xlml = new Object();

initXlml();

