var preview = null;
var inforows = 0;

// Variables for mouseover-highlights
var hlobj = null;
var hlclass = null;
var addobj = null;
var addclass = null;
var linkobj = null;
var linkclass = null;


function getBrowser() {
	return navigator.appName;
}


function makePreviewKonq(id, img, brdr) {
	var out = '';
	var pre = '';
	var post = '';

	if (brdr) {
		pre = '<table class="konqBorder" cellpadding="3"><tr><td>';
		post = '</td></tr></table>';
	}
	out = '<span id="' + id +'" '
		+ 'class="previewNoBorder" '
		+ 'style="left: 0px; top: 0px;">'
		+ pre
		+ '<img src="' + img + '" border="0" alt="preview">'
		+ post
		+ '</span>';

	return out;
}


function makePreview(id, img, brdr) {
	var out = '';
	var browser = getBrowser();

	if (browser == "Konqueror") {
		out = makePreviewKonq(id, img, brdr);
	} else {
		var c = 'previewNoBorder';
	
		if (brdr) {
			c = 'previewBorder';
		}
		out = '<div id="' + id +'" '
			+ 'class="' + c + '" style="left: 0px; top: 0px;">'
			+ '<img src="' + img + '" border="0" alt="preview">'
			+ '</div>';
	}
	document.writeln(out);
}



function infoStart(id) {
	inforows = 0;

	document.writeln('<div id="' + id +'" '
		+ 'class="previewNoBorder" style="left: 0px; top: 0px;">'
		+ '<table border="0" cellpadding="1" cellspacing="0" align="left">');
}


function infoAdd(key, value) {
	if (inforows != 0) {
		document.writeln('<tr>'
			+ '<td colspan="2" height="1" class="contentBGSep"></td>'
			+ '</tr>');
	}
	inforows = 1;
	document.writeln('<tr class="contentBG"><td class="descrTitle">'
		+ key
		+ '</td><td class="contentBG">'
		+ value
		+ '</td></tr>');
}


function infoEnd() {
	document.writeln('</table></div>');
}



function showPreview(name, pos) {
	if (getBrowser() == "Opera") {
		return
	} else if (document.getElementById) {
		preview = document.getElementById(name);
		if (preview) {
			switch (pos) {
			case 'nw':
				preview.style.bottom = null;
				preview.style.right = null;
				preview.style.top = '0px';
				preview.style.left = '0px';
				break;
			case 'ne':
				preview.style.bottom = null;
				preview.style.left = null;
				preview.style.top = '0px';
				preview.style.right = '0px';
				break;
			case 'sw':
				preview.style.top = null;
				preview.style.right = null;
				preview.style.bottom = '0px';
				preview.style.left = '0px';
				break;
			case 'se':
				preview.style.top = null;
				preview.style.left = null;
				preview.style.bottom = '0px';
				preview.style.right = '0px';
				break;
			case 'nc':
				preview.style.bottom = null;
				preview.style.right = null;
				preview.style.top = '0px';
				preview.style.left = '50%';
				break;
			case 'sc':
				preview.style.top = null;
				preview.style.right = null;
				preview.style.bottom = '0px';
				preview.style.left = '50%';
				break;
			default:
				break;
			}
			preview.style.visibility = 'visible';
		}
	}
}


function hidePreview() {
	if (preview) {
		preview.style.visibility = 'hidden';
	}
}


function showTree(name, pos) {
	if (document.getElementById) {
		preview = document.getElementById(name);
		if (preview) {
			preview.style.visibility = 'visible';
		}
	}
}


function hideTree() {
	if (preview) {
		preview.style.visibility = 'hidden';
	}
}

function PreloadNextImage(image) {
	nextimg = new Image();
	nextimg.src = image;
}


function hlon(pObj, pAddid, pLinkid) {
	hlobj = pObj;
	hlclass = pObj.className;
	pObj.className = 'hover';
	if (pAddid != null) {
		if (document.getElementById) {
			addobj = document.getElementById(pAddid);
			addclass = addobj.className;
			addobj.className = 'hover';
		}
	}
	if (pLinkid != null) {
		if (document.getElementById) {
			linkobj = document.getElementById(pLinkid);
			linkclass = linkobj.className;
			linkobj.className = 'hover';
		}
	}
}

function hloff() {
	if (hlobj != null) {
		hlobj.className = hlclass;
		hlobj = null;
		hlclass = null;
	}
	if (addobj != null) {
		addobj.className = addclass;
		addobj = null;
		addclass = null;
	}
	if (linkobj != null) {
		linkobj.className = linkclass;
		linkobj = null;
		linkclass = null;
	}
}


function binsback() {
	alert('referrer: ' + document.referrer + '\nURL: ' + document.URL);
	// untersuche ob der referrer gesetzt ist
		// wenn ja:
			// vergleiche mit der URL
				// Quelle ist im bins-tree:
					// javascript.back();
				// Quelle ist wo ganz anders:
					// gehe zu URL.IMG.MED
		// wenn nein:
			// gehe zu URL.IMG.MED

}
