opacitySet = false;

function onLoad() {
	if (userAgent[0] == 'Opera') contentHeight = window.innerHeight;
		else contentHeight = document.documentElement.clientHeight;
	divs = document.getElementsByTagName('div');
	// Das Content-DIV ist dasjenige, dessen ID mit "-content" aufhört, also "main-content", "ht-content" usw.
	contentDiv = ''; for (i = 0; i< divs.length; i++) if (divs[i].id.match(/^[a-z0-9]+\-content$/)) contentDiv = divs[i];
	if (contentDiv != '') {
		if (contentDiv.id == 'main-content') contentHeight = contentHeight - 106; else contentHeight = contentHeight- 34;
		contentDiv.style.minHeight = contentHeight + 'px';
		if (userAgent[0] == 'MSIE') contentDiv.style.height = contentHeight + 'px';
	}
}

window.onresize = resizeFunction;

function resizeFunction() {
	location.href = location.href;
}

function setOpacity(elementObj, opacityPercent) {
	opacityPercent = Math.abs(opacityPercent);
	opacityAbsolute = opacityPercent / 100;
	elementObj.style.filter = 'alpha(opacity='+opacityPercent+')';
	elementObj.style.MozOpacity = opacityAbsolute;
	elementObj.style.opacity = opacityAbsolute;
	elementObj.style.KhtmlOpacity = opacityAbsolute;
	if (userAgent[0] == 'MSIE') elementObj.style.backgroundColor = '#FFF';
}

function setTransparency(elementObj, transparencyPercent) {
	setOpacity(elementObj, 100 - Math.abs(transparencyPercent));
}

// cell rollover functions
function _mover(cell) {
	if (!cell.contains(event.fromElement)){cell.style.cursor = 'hand';}
}

function _mout(cell) {
	if (!cell.contains(event.toElement)){cell.style.cursor = 'default';}
}

function _mclick(cell,linkID) {
	if (document.all[linkID].target || document.all[linkID].target != '') {
		window.open(document.all[linkID].href,document.all[linkID].target);
	} else {
		document.location.href=document.all[linkID].href;
	}
	if (navigator.userAgent.search(/Safari\//) == -1 && navigator.userAgent.search(/Konqueror\//) == -1) {
		event.cancelBubble=true;
	}
}

function _mbubble() {
	if (navigator.userAgent.search(/Safari\//) == -1 && navigator.userAgent.search(/Konqueror\//) == -1) {
		event.cancelBubble=true;
	}
}

// rollover
if (document.images) Rollover = true
else Rollover = false;

if (Rollover) {
	navmarkerOver = new Image();
	navmarkerOver.src = pubimgroot+"/lrn/navmarker_over.gif";
	navmarkerOff = new Image();
	navmarkerOff.src = pubimgroot+"/lrn/navmarker_off.gif";
	navmarkerOn = new Image();
	navmarkerOn.src = pubimgroot+"/lrn/navmarker_on.gif";
	laynavmarker = new Image();
	laynavmarker.src = pubimgroot+"/lrn/laynavmarker.gif";
	shim = new Image(); 
	shim.src = pubimgroot+"/lrn/shim.gif";
}

function navOn(imgID) {
	ChangeImg('n'+imgID,navmarkerOver.src)
}

function navOff(imgID) {
	ChangeImg('n'+imgID,navmarkerOff.src) 
}

function navXOn(imgID) {
	ChangeImg('nx'+imgID,navmarkerOver.src)
}

function navXOff(imgID) {
	ChangeImg('nx'+imgID,navmarkerOff.src)
}

function layNavOn(imgID) {
	ChangeImg('ln'+imgID,laynavmarker.src)
}

function layNavOff(imgID) {
	ChangeImg('ln'+imgID,shim.src)
}

function ChangeImg(id, newSrc) {
   	var vImage = FindImage(document, id, 0);
 	if (vImage) {vImage.src = newSrc;}
}

function FindImage(doc, name, j) {
   	var vImage = false;
   	if (doc.images) {vImage = doc.images[name];}
  		if (vImage) {return vImage;}
   	if (doc.layers) {
       	for (j = 0; j < doc.layers.length; j++) {
           	vImage = FindImage(doc.layers[j].document, name, 0);
           	if (vImage) {return (vImage);}
       	}
   	}
   	return (false);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,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.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function openWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

// laurin

function veranstaltungZeigen(verNum) {
	veranstaltungenWin=window.open(webroot+'/index.php/fuseaction/veranstaltungen/veranstaltungs_id/'+verNum,'veranstaltungen',openWindowParam);
}

function elwin(elwinID,elwinW,elwinH,elwinBG,elwinOffset,elwinAlt) {
	elWindow=window.open(webroot+'/index.php'+previewControlString+'/fuseaction/elwin/elwinID/'+elwinID+'/elwinBG/'+elwinBG+'/elwinOffset/'+elwinOffset+'/elwinAlt/'+elwinAlt,'elwindow'+elwinID,'width='+elwinW+',height='+elwinH+',resizable=yes,scrollbars=yes');
	elWindow.focus();
}

function slideInElwin(elwinID,elwinW,elwinH,elwinBG,elwinOffset,elwinAlt,slideID) {
	elWindow=window.open(webroot+'/index.php'+previewControlString+'/fuseaction/elwin/elwinID/'+elwinID+'/elwinBG/'+elwinBG+'/elwinOffset/'+elwinOffset+'/elwinAlt/'+elwinAlt+'/slide/'+slideID,'elwindow'+elwinID,'width='+elwinW+',height='+elwinH+',resizable=yes,scrollbars=no');
	elWindow.focus();
}

function printPage(printUrl) {
	//if (!lrnPath) printUrl=document.location.href; else printUrl=lrnPath;
	//printUrl=printUrl.replace(/index\.php/,"index.php/fuseaction/print");
	//if (document.location.search) printUrl=printUrl+document.location.search;
	printWin=window.open(printUrl,'printWindow','width=720, height=520,menubar=yes,status=yes,resizable=yes,scrollbars=yes');
}

function tellafriend(id) {
	mailWin=window.open(webroot+'/index.php/fuseaction/tellafriend/id/'+id,'mailWindow','width=550, height=600,resizable=yes,scrollbars=yes');
}

function glossary(showHide,gURL) {
	gwin=window.open(gURL,'gwin','width=480, height=360,resizable=yes,scrollbars=yes');
	gwin.focus();
	/*	if (gURL != '') gtarget.document.location.href=gURL;
		if (!nav){
			var gd = document.getElementById('glossarylayer');
			if (gd) {
				gd.style.left = tempX-200;
				gd.style.top  = tempY-100;
			}
		} else {
			document.glossarylayer.left = tempX-200;
	 		document.glossarylayer.top  = tempY-100;
		}
		MM_showHideLayers('glossarylayer','',showHide);
	}*/
}


// Browser Check
function browserCheck() {
	UA = new Array();
	browserPlatform = navigator.platform;
	ua = navigator.userAgent;
	an = navigator.appName;
	ua = ua.toLowerCase();
	ua_msie = ua.indexOf('msie');
	ua_firefox = ua.indexOf('firefox');
	ua_netscape = ua.indexOf('netscape');
	ua_mozilla = ua.indexOf('mozilla');
	ua_opera = ua.indexOf('opera');
	userAgent = 'other';
	if (ua_msie != -1 && ua_opera == -1) userAgent = 'MSIE';
	if (ua_opera != -1) userAgent = 'Opera';
	if (ua_firefox != -1) userAgent = 'Firefox';
	if (ua_msie == -1 && ua_opera == -1 && ua_firefox == -1) {
		userAgent = 'Netscape';
		browserVersion = parseFloat(ua.substr(8, 4));
		if (browserVersion >= 5) { // Netscape 6 or higher
			pos = ua.indexOf('netscape');
			if (pos != -1) browserVersion = parseFloat(ua.substr(pos+9, 4));
		}
	}
	if (userAgent == 'MSIE') browserVersion = parseFloat(ua.substr(ua_msie + 5, 5));
	if (userAgent == 'Firefox') browserVersion = parseFloat(ua.substr(ua_firefox + 8, 5));
	if (userAgent == 'Opera') browserVersion = parseFloat(ua.substr(ua_opera + 6, 4));
	UA[0] = userAgent;
	UA[1] = browserVersion;
	UA[2] = browserPlatform;
	return UA;
}
userAgent = browserCheck();

// ROSENTHAL NEWS
function shownews(D_CAT,NEWSPAGE){
//	newswindow = window.open(webroot+'/'+NEWSPAGE+'n/'+D_CAT+'.htm','newswindow','width=646,height=480,scrollbars=1,resizable=1');
//	newswindow.focus();
	window.location.href = webroot+'/'+NEWSPAGE+'n/'+D_CAT+'.htm';
}

// ROSENTHAL NEWS
function _shownewsitem(D_CAT,NEWSPAGE,ID){
//	newswindow = window.open(webroot+'/index.php'+previewControlString+'/page/'+NEWSPAGE+'/newspage/'+D_CAT+'.htm#'+ID,'newswindow','width=646,height=480,scrollbars=1,resizable=1');
//	newswindow.focus();
	window.location.href = webroot+'/index.php'+previewControlString+'/page/'+NEWSPAGE+'/newspage/'+D_CAT+'.htm#'+ID;
}

// ROSENTHAL NEWS
function shownewsitem(D_CAT,NEWSPAGE,ID){
//	newswindow = window.open(webroot+'/index.php'+previewControlString+'/page/'+NEWSPAGE+'/newspage/'+D_CAT+'_'+ID+'.htm','newswindow','width=646,height=480,scrollbars=1,resizable=1');
//	newswindow.focus();
	window.location.href = webroot+'/index.php'+previewControlString+'/page/'+NEWSPAGE+'/newspage/'+D_CAT+'_'+ID+'.htm';
}

// ROSENTHAL NEWS
function showallnews(D_CAT,NEWSPAGE){
	if(previewControlString != '') {
		window.location.href=webroot+'/index.php'+previewControlString+'/page/'+NEWSPAGE+'/newspage/'+D_CAT+'.htm';
	} else {
		window.location.href=webroot+'/'+NEWSPAGE+'n/'+D_CAT+'.htm';
	}	
}

// ROSENTHAL DESIGNER
function showdesigner(D_PAGE,D_ID,D_NAVNAME){
	if(previewControlString != '') {
//		designerwindow = window.open(webroot+'/index.php'+previewControlString+'/page/'+D_PAGE+'/showdatalist/'+D_ID+'/'+D_NAVNAME+'.htm','designerwindow','width=594,height=480,scrollbars=1,resizable=1');
		// Debug: Designerportrait im Hauptfenster öffnen - fs 061207
		opener.location.href = webroot+'/index.php'+previewControlString+'/page/'+D_PAGE+'/showdatalist/'+D_ID+'/'+D_NAVNAME+'.htm';
	} else {
//		designerwindow = window.open(webroot+'/'+D_PAGE+'d'+D_ID+'/'+D_NAVNAME+'.htm','designerwindow','width=594,height=480,scrollbars=1,resizable=1');
		// Debug: Designerportrait im Hauptfenster öffnen - fs 061207
		opener.location.href = webroot+'/'+D_PAGE+'d'+D_ID+'/'+D_NAVNAME+'.htm';
	}
	// Debug: Designerportrait im Hauptfenster öffnen - fs 061207
//	designerwindow.focus();
}

// ROSENTHAL LIMITED ART
function showlimitedart(D_PAGE,D_ID,D_NAVNAME){
	if(previewControlString != '') {
		limitedartwindow = window.open(webroot+'/index.php'+previewControlString+'/page/'+D_PAGE+'/showdatalist/'+D_ID+'/'+D_NAVNAME+'.htm','limitedartwindow','width=594,height=480,scrollbars=1,resizable=1');
	} else {
		limitedartwindow = window.open(webroot+'/'+D_PAGE+'d'+D_ID+'/'+D_NAVNAME+'.htm','limitedartwindow','width=594,height=480,scrollbars=1,resizable=1');
	}
	limitedartwindow.focus();
}

// ROSENTHAL SEARCH
function opensearchpage(ID){
	searchwindow=window.open(webroot+'/'+ID,'searchwindow','width=569,height=570,scrollbars=yes,resizable=yes');
	searchwindow.focus();
}

function opensitemapsearchpage(ID){
	location.href=webroot+'/'+ID;
}

// ROSENTHAL KATALOG
function openkatalogpage(ID){
	catalogwindow=window.open(ID,'catalogwindow','width=860,height=720,scrollbars=yes,resizable=yes');
	catalogwindow.focus();
}

// ROSENTHAL KATALOG NAVIGATION
function rNAV(rLEVEL) {
	setOpacity(document.getElementById('catalogcontent'), '18');
	setOpacity(document.getElementById('catalogmargin'), '18');
	opacitySet = true;
	lc = '';
	for (r=1;r<=katnav[rLEVEL].length-1;r++) {
		path=katnav[rLEVEL][r]['id'];
		if (katnav[rLEVEL][r]['name'] != '') {
//			if (katnav[rLEVEL][r]['id'] == katpath.substr(0,path.length)) lc += '<strong>';
			lc += '<a href="'+webroot+'/'+katpage+'R'+path+'/'+katnav[rLEVEL][r]['link']+'.htm"';
			if (katnav[rLEVEL][r]['id'] == katpath.substr(0,path.length)) lc += ' class="active"';
			lc += '>';
			lc += katnav[rLEVEL][r]['name'];
			lc += '</a>';
//			if (katnav[rLEVEL][r]['id'] == katpath.substr(0,path.length)) lc += '</strong>';
			//lc += '<br>';
		}
	}
	lc = '<table cellpadding="0" cellspacing="0" bgcolor="#F5F5F5" border="0"><tr><td><span class="text">'+lc+'</span></td></tr></table>';
	
	xx_position(-20,12);
	MM_setTextOfLayer('menuLayer','',escape(lc));
	MM_showHideLayers('menuLayer','','show');
}

// ROSENTHAL HOMEPAGE
function rthome() {
	rtmainwin = window.open(webroot,'rtmainwin');
	rtmainwin.focus();
}

// ROSENTHAL WINDOW
function rtwindow(LINK,TARGET) {
	rtWindow = window.open(LINK,TARGET);
	rtWindow.focus();
}

// ROSENTHAL POPUP
function rtpopup(LINK,PARAM) {
	rtpopup = window.open(LINK,'rtpopup',PARAM);
	rtpopup.focus();
}

// ROSENTHAL COUNTRYSELECTION
function showCountrySelection() {
	MM_showHideLayers('countrySelectionLeft','','visible');
	MM_showHideLayers('countrySelectionRight','','visible');
}

