var Browser={IE:!!(window.attachEvent&&!window.opera), Opera:!!window.opera, WebKit:navigator.userAgent.indexOf('AppleWebKit/')>-1, Gecko:navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('KHTML')==-1}

function $(e) {if(typeof e=='string')return document.getElementById(e);else return e;}

function offsetLeft(e) {for (var x=e.offsetLeft, t=e.offsetParent; t!=null; t=t.offsetParent) {x+=t.offsetLeft} return x;}
function offsetTop(e) {for (var y=e.offsetTop, t=e.offsetParent; t!=null; t=t.offsetParent) {y+=t.offsetTop} return y;}

function BlindForm(n,a,m,t) {
	this.name=n||'frm_'+(new Date().getTime());
	this.action=a||'';
	this.method=m||'POST';
	this.target=t||'';
	var inputs=[];
	this.add=function(n,v) {inputs[inputs.length]={name:n,value:v};return this}
	this.addAll=function() {
		for(var a=0;a<arguments.length;a++) {
			var params=arguments[a];
			if(typeof params=='string') {
				if(params.charAt(0)=='?')params=params.substring(1);
				params=params.split('&');
				for(var i=0,l=params.length;i<l;i++) {
					var p=params[i].split('=');
					inputs[inputs.length]={name:p[0],value:p[1]};
				}
			} else {
				for(var i=0,l=params.length;i<l;i++) {
					inputs[inputs.length]={name:params[i].name,value:params[i].value};
				}
			}
		}
		return this;
	}
	this.submit=function() {
		var form=$('hiddenForm');
		if(!form) {
			form=document.createElement('form');
			form.id='hiddenForm';
			form.style.display='none';
			document.body.appendChild(form);
		}
		form.name=this.name;
		form.method=this.method;
		form.action=this.action;
		form.target=this.target;
		var s='';
		for(var i=0,l=inputs.length;i<l;i++) {s+='<input name="'+inputs[i].name+'" value="'+inputs[i].value+'" type="hidden" />'}
		form.innerHTML=s;
		form.submit();
	}
}

function BlindIFrame(id,n,s,a) {
	var that = this;
	this.id=id;
	this.name=n || this.id;
	var ifr=$(this.id) || create(s,a);
	function create(s,a) {
		ifr=document.createElement('iframe');
		ifr.id=that.id;
		ifr.name=that.name;
		ifr.style.position='absolute';
		ifr.style.width=ifr.style.height=ifr.style.left=0;
		ifr.style.top='-999px';
		ifr.src=s || (self.ur_system?ur_system.emptyhoverurl:'javascript:void(0)');
		a ? document.body.appendChild(ifr) : document.body.insertBefore(ifr,document.body.firstChild);
		return ifr;
	}
	this.setCoords=function(w,h,x,y,z) {
		ifr.style.width=(w||0)+'px';
		ifr.style.height=(h||0)+'px';
		ifr.style.left=(x||0)+'px';
		ifr.style.top=(y||0)+'px';
		ifr.style.zIndex=z||'';
	}
	this.hide=function() {ifr.style.display='none'}
	this.show=function() {ifr.style.display='block'}
	this.setStyle=function(a,v) {ifr.style[a]=v}
	this.setStyles=function(s) {if(s) for(a in s) ifr.style[a]=s[a]}
	this.setSrc=function(src) {ifr.src=src}
}

function fixIELayer(w,h,x,y,z,s) {
	if(!document.all)return;
	var iefix=new BlindIFrame('iefix','Internet Explorer Fix');
	iefix.hide();
	if(arguments.length>0) {
		iefix.setCoords(w,h,x,y,z);
		iefix.setStyle('filter','Alpha(opacity:0)');
		iefix.setStyles(s);
		iefix.show();
	}
}

function fixIEHover() {
	if(!document.all)return;
	var tln=$('nav');
	if (!tln) return;
	var li=tln.getElementsByTagName('LI');
	for (var i=0,l=li.length; i<l; i++) {
		if (li[i].getElementsByTagName('DIV').length==0) continue;
		if (li[i].lastChild.tagName=='DIV') {
			li[i].onmouseover=function() {
				hover(this);
				var div=this.lastChild;
				fixIELayer(div.offsetWidth,div.offsetHeight,offsetLeft(this),offsetTop(this)+this.offsetHeight);
			};
			li[i].onmouseout=function() {
				unhover(this);
				fixIELayer();
			};
		}
	}
	for(var i=0,l=arguments.length;i<l;i++) {
		try {
			var e=$(arguments[i]);
			e.onmouseover=function() {hover(this)};
			e.onmouseout=function() {unhover(this)};
		} catch(e) {}
	}
}

function hover(e) {e.className+=' hover'}
function unhover(e) {e.className=e.className.replace(/ hover\b/, '')}

function showDialog() {
	document.body.className+=' modal';
	var lyr=$('layer');
	lyr.style.height=document.body.scrollHeight+'px';
	var box=$('dialog').firstChild;
	box.style.top=(-box.offsetHeight/2) + 'px';
	fixIELayer(lyr.offsetWidth,lyr.offsetHeight,offsetLeft(lyr),offsetTop(lyr));
	try {box.getElementsByTagName('input')[0].focus();} catch(e) {try {box.getElementsByTagName('button')[0].focus();} catch(e) {}}
	return false;
}
function closeDialog() {
	document.body.className=document.body.className.replace(/ modal\b/,'');
	fixIELayer();
	return false;
}

function boxMax(id,e) {
	e=$('max-'+id);if(e)e.style.display='none';
	e=$('min-'+id);if(e){e.style.display='inline';e.focus();}
	e=$('ftr-'+id);if(e)e.style.display='';
	e=$('bdy-'+id);if(e)expand(e);
	return false;
}
function boxMin(id,e) {
	e=$('min-'+id);if(e)e.style.display='none';
	e=$('max-'+id);if(e){e.style.display='inline';e.focus();}
	e=$('ftr-'+id);if(e)e.style.display='none';
	e=$('bdy-'+id);if(e)reduce(e);
	return false;
}

function expand(e,h) {
	e=$(e);
	h=h||e.offsetHeight;
	var oh=e.oldHeight||500;
	h=Math.ceil(Math.min(h+((oh-h)/2),oh));
	e.style.display='';
	e.style.height=h+'px';
	if(h<e.oldHeight) setTimeout('expand("'+e.id+'",'+h+')',25);
	else e.style.overflow='';
}
function reduce(e,h) {
	e=$(e);
	h=h||e.offsetHeight;
	if(!e.oldHeight)e.oldHeight=h;
	h=Math.floor(Math.max(h/2,1));
	e.style.overflow='hidden';
	e.style.height=h+'px';
	if(h>1) setTimeout('reduce("'+e.id+'",'+h+')',25);
	else e.style.display='none';
}

function toggleOpen(pageIvuID) {
	var iview = $('iview_' + pageIvuID);
	if (iview) iview.className = iview.className.replace(/ trayclosed\b/, '');
}
function toggleClose(pageIvuID) {
	var iview = $('iview_' + pageIvuID);
	if (iview) iview.className += ' trayclosed';
}
function checkToggleState(pageIvuID) {
	var iviewContent = $('iview_content_' + pageIvuID);
	var iview = $('iview_' + pageIvuID);
	if (!iviewContent || !iview) return;
	var firstSpan = iviewContent.getElementsByTagName('SPAN')[0];
	if (firstSpan.currentStyle.display == 'none') toggleClose(pageIvuID);
}

function checkMenuState(pageIvuID) {
	var iviewMenu = $('iview_menu_' + pageIvuID);
	if (!self.iviewMenuIcons) self.iviewMenuIcons = new Array();
	var iviewMenuIcon = !self.iviewMenuIcons[pageIvuID] ? elem('iview_menu_icon_' + pageIvuID) : self.iviewMenuIcons[pageIvuID];
	self.iviewMenuIcons[pageIvuID] = iviewMenuIcon;
	if (iviewMenu.getElementsByTagName('A').length == 0) {
		iviewMenuIcon.style.display = 'none';
	} else {
		iviewMenuIcon.style.display = '';
	}
}

function getCookie(n) {
	var ck=document.cookie;
	var start=ck.indexOf(n+'=');
	var len=start+n.length+1;
	if((!start && n!=ck.substring(0,n.length)) || start<0) return null;
	var end = ck.indexOf(';',len);
	if(end<0) end=ck.length;
	return unescape(ck.substring(len,end));
}
function setCookie(n,v,e,p,d,s) {
	var t=new Date();t.setTime(t.getTime());
	if(e) e=e*1000*60*60*24;
	var ed=new Date(t.getTime()+e);
	document.cookie=n+'='+escape(v)+(e?';expires='+ed.toGMTString():'')+(p?';path='+p:'')+(d?';domain='+d:'')+(s?';secure':'');
}

function setFontSize(dir) {
	var size=100;
	switch(dir) {
	case -1: size='80.0'; break;
	case 0: size='100.1'; break;
	case 1: size='130.0'; break;
	}
	setCookie('fontSize',dir);
	document.body.style.fontSize=size+'%';
}

function initFramework(fpha) {
	// fixIEHover('search','locale');
	// var fontSize = getCookie('fontSize');
	// setFontSize(fontSize != null ? parseInt(fontSize) : 0);
	self.fullPageHeightAdjustment = fpha;
}

function addBrowserEventHandler(h,f) {
	if (self.EPCM) {
		EPCM.subscribeEvent('urn:com.sapportals.portal:browser',h,f);
	} else {
		window['_on'+h]=window['on'+h] || function() {};
		window['on'+h]=function(e){window['_on'+h](e);f(e)};
	}
}

////////////
			
/**
 * can be overwritten from outside by customer javascript
 */
/* self.fullPageHeightAdjustment = 0;
self.defaultFullPageHeight = 80;
	*/			
/**
 * Calculates the height of the frame by subtracting the top offset 
 * and footer height from the height of the (visible) body.
 */
function getFullPageHeight(frame) {
	return Math.max((Browser.IE ? document.body.clientHeight : window.innerHeight) - offsetTop(frame) + self.fullPageHeightAdjustment, self.defaultFullPageHeight);
}

/**
 * Calculates the height of the frame's content.
 */
function getAutomaticHeight(frame) {
	try {
		var body=frames[frame.name].document.body;
		for (var i=0,iframes=body.getElementsByTagName('iframe'),l=iframes.length;i<l;i++) {
			if (iframes[i].getAttribute('fullPage')=='true') return 0; // don't apply automatic height if iFrame contains another fullpage-iFrame (e.g. see Support Desk)
		}
		return Browser.IE ? body.scrollHeight+body.offsetHeight-body.clientHeight : body.scrollHeight;
	} catch (e) { // no access to window object of the frame because of Javascript Origin Policy, maybe the domain hasn't been relaxed in the frame's content
		return 0;
	}
}

/**
 * This function does the job of adjusting the frame height for isolated iViews in the work area.
 */
function adjustIsolatedWorkAreaFrameHeight() {
	var ifr = $('isolatedWorkArea');
	if (ifr && ifr.getAttribute('height')=='100%') {
		setTimeout(adjustIsolatedWorkAreaFrameHeight, 200);
		try {
			ifr.style.height=Math.max(getAutomaticHeight(ifr), getFullPageHeight(ifr))+'px';
			return true;
		} catch(e) { // resizing of the container iframe failed
			return false;
		}
	}
}

function adjustFullPageIViews() {
	var iframes = document.getElementsByTagName('IFRAME');
	for (var f=iframes.length-1; f>=0; f--) {
		var ifr = iframes[f];
		if (ifr.getAttribute('fullPage')=='true') { // only for fullpage iViews
			try {
				ifr.style.height=getFullPageHeight(ifr)+'px';
			} catch(e) { // resizing of the container iframe failed
			}
		}
	}
}

function applyHeight(ifr, height) {
	if (Browser.IE) {
		var oldHeight = ifr.style.pixelHeight;
		if (oldHeight == height) {
	  		return false;
		}
		ifr.style.pixelHeight = height;
		return true;
	} else {
		ifr.height = height;
		ifr.style.height = height;
		return false;
	}
}

function overwriteStd() {
	if (self.workArea) {
		workArea.resizeIframe = function() {};
		adjustIsolatedWorkAreaFrameHeight();
	//	addBrowserEventHandler('resize',adjustIsolatedWorkAreaFrameHeight);
	//	addBrowserEventHandler('load',adjustIsolatedWorkAreaFrameHeight);
	}
	
	if (self.pageSupport) pageSupport.adjustHeight = function(ifr, theHeight, checkMode, phase) {
		try {
			if (!ifr) return;
			if (!phase) phase = 0;
			if (phase > 1) return;
			var height = theHeight || getAutomaticHeight(ifr);
			if (height > 0) {
				var min = ifr.getAttribute("minAutoHeight");
				var max = ifr.getAttribute("maxAutoHeight");
				if (parseInt(min)>=0) height=Math.max(height,min);
				if (parseInt(max)>=0) height=Math.min(height,max);
				if (!applyHeight(ifr, height)) {
					//setTimeout("pageSupport.adjustHeight($('"+ifr.id+"'),"+theHeight+","+(phase+1)+","+checkMode+")", 50);
				}
			} else {
				if (phase == 0) {
					//setTimeout("pageSupport.adjustHeight($('"+ifr.id+"'),"+theHeight+",1,"+checkMode+")", 500);
				}
			}
		} catch(e) {
			return false;
		}
	}
}


/**************
 * LOGOFF BEGIN
 * functionality mainly copied from standard masthead (com.sap.portal.navigation.masthead.default) 
 * and slightly modified in logoffThirdParty()
 */
var isLogoffFinalAllowed = true;
var logoffStartTime = (new Date).getTime();
var logoffData = null;

function logoff(url,silent,redirect) {
	if(self.EPCM) EPCM.raiseEvent("urn:com.sapportals.portal:user", "logoff", "");
	logoffData = {url:url, silent:silent, redirect:redirect};
	logoffStartTime = (new Date).getTime(); 
	window.setTimeout("logoffDelay()", 50);
	return false;
}

function logoffDelay() {
	var isLogoffDelayElapsed = ((new Date).getTime() - logoffStartTime) > 60000;
	if (isLogoffFinalAllowed || isLogoffDelayElapsed) { 
		logoffFinalCall();
	} else {
		window.setTimeout("logoffDelay()", 50); 
	}
}

function logoffFinalCall() {
	logoffThirdParty();
	location = logoffData.url;
}

/**
 * slightly modified
 */
function logoffThirdParty() {
	if (!logoffData || !logoffData.redirect) return;
	if (logoffData.silent) {
		(new BlindIFrame('externalLogOffIframe','Logoff Frame',logoffData.redirect));
	}
}

function login() {
	showDialog();
	return false;
}

/*
 * LOGOFF END
 **************/

function setLocale(url,guest) {
	var dummy = new Image();
	dummy.src = url;
	if(!guest) {
		setTimeout('location.reload()',500);
	} else {
		var qs = location.search;
		var p = [];
		if (qs.length > 0) p = qs.substring(1).split('&');
		var addGuest = true;
		for (var i=0; i<p.length; i++) {
			if (p[i].indexOf('guest_user=')==0) {
				p[i] = 'guest_user=' + guest;
				addGuest = false;
				break;
			}
		}
		if (addGuest) p[p.length] = 'guest_user=' + guest;
		setTimeout('location.href="' + location.pathname + '?' + p.join('&') + '"',500);
	}
	return false;
}


/**
 * Adds current page to list of portal favorites by calling a KM service.
 */
function addToPortalFavorites(navigationTarget, pageTitle) { 
	url = "/irj/servlet/prt/portal/prtroot/com.sap.km.cm.remote?ServiceType=PortalFavorites&NavigationTarget=" + navigationTarget + 
	      "&Title=" + pageTitle + 
	      "&now=" + (new Date()).getTime();  // this is to bypass the browser's cache
	var dummy = new Image();
	dummy.src = url;
	setTimeout("location.reload()",500);
	return false;
}

function openHelp(helpUrl) {
	window.open(helpUrl, "_blank");
	return false;
}

function openNewPortalWindow() {
	try {
		var navTarget = EPCM.getSAPTop().gHistoryFrameworkObj.GetActiveTrackingEntryValue().URL;
		EPCM.doNavigate(navTarget, 2);
	} catch(e) {
		window.open(location.href, "_blank");
	}
}
 
/**
 * Opens the "Personalize Portal" page in a new window.
 * Called by one of the support links in the header.
 */
function runPersonalizePortal(href) {
	window.open(href, "PersonalizePortalWindow", "toolbar=no,menubar=no,resizable=yes").focus();
	return false;
}

/**
 * Opens the "Collaboration Launchpad" in a new window.
 * Called by one of the support links in the header.
 */
function openCollaborationLaunchPad(clpComponentURI) {
	clpParameter = 'height=510,width=322,location=No,menubar=No,resizable=Yes,scrollbars=Yes,status=No,titlebar=No,toolbar=No,left=' + (screen.width / 3) + ',top=180';
	window.open(clpComponentURI, 'STATIC_CLP_WINDOW_TITLE', clpParameter).focus();
	return false;
}

/**
 * Workaround for JS error in UWL: UWL tries to access a method of an object from the javascript library
 * /irj/portalapps/com.sap.portal.navigation.helperservice/scripts/HistoryFramework.js
 * This file is usually included in the framework page by setting the property "Element in Framework Page" to "Framework Page". 
 * In this framework though the property stays at "None" because of performance/bandwidth reasons.
 */
//if(!self.gHistoryFrameworkObj)gHistoryFrameworkObj={GetActiveTrackingEntryValue:function(){return ''}};

/**
 * Workaround for WebDynpro frame height adjustment (because height="100%" only won't work).
 * This function does the job of adjusting the frame height for WebDynpro iViews. It is called from 
 * This might cause a flicker, but usually is okay.
 */
function adjustWDFrameHeight() {
	setTimeout(adjustWDFrameHeight, 200);
	var iframes = document.getElementsByTagName('IFRAME');
	for (var f=iframes.length-1; f>=0; f--) {
		var ifr = iframes[f];
		if (ifr.getAttribute('height')=='100%' && ifr.id!='isolatedWorkArea') { // only for WebDynpro iViews
			try {
				ifr.style.height=Math.max(getAutomaticHeight(ifr), getFullPageHeight(ifr))+'px';
				return true;
			} catch(e) { // resizing of the container iframe failed
				return false;
			}
		}
	}
}

////////////

if (self.EPCM) {
PORTAL_CONTENT_URL='/irj/servlet/prt/portal/prtroot/com.sap.portal.navigation.contentarea.light';

function onNavigate(eventObj) {

	var d=eventObj.dataObject;
	var qs='?NavigationTarget='+d.target.replace('?','&');
	if(d.context) qs+='&NavigationContext='+encodeURIComponent(d.context);
	var url=EPCM._private.uipPortalPath;
	if(d.mode) {
		var wn=d.winname;
		if(!wn||wn=='DefaultExternal'||wn=='')wn='WID'+new Date().getTime();
		if(d.postBody) {
			var form=new BlindForm('navform',url);
			form.add('UsePost','true').addAll(qs,d.postBody);
			self.navigateForm=form;
			self.open('/irj/portalapps/com.sap.portal.itelo.framework/mimes/nav2win.htm',wn,d.winfeatures);
		} else {
			self.open(url+qs,wn,d.winfeatures);
		}
	} else {
		var t=d.target.substring(0,(q=d.target.indexOf('?'))>-1?q:d.target.length);
		EPCM.raiseEvent('urn:com.sapportals:navigation','UpdateTLN',t);
		if(d.postBody) {
			var form=new BlindForm('navform',url);
			form.add('UsePost','true').addAll(qs,d.postBody);
			form.submit();
		} else {
			location.href=url+qs;
		}
	}
}
//EPCM.subscribeEvent('urn:com.sapportals:navigation','Navigate',onNavigate);

function onRelativeNavigate(eventObj) {

	var d=eventObj.dataObject;
	var t=d.basenodename;
	if(!t) return false;
	var qs='?NavigationTarget='+t+'&RelativeNavBase='+t;
	if(d.levelsup) qs+='&RelativeLevelsup='+escape(d.levelsup);
	if(d.pathnameslist) qs+='&RelativePathlist='+escape(d.pathnameslist);
	if(d.history && d.history != '') qs+='&HistoryMode='+escape(d.history);
	if(d.context && d.context != '') qs+='&NavigationContext='+escape(d.context);
	if(d.targetTitle && d.targetTitle != '') qs+='&TarTitle='+escape(d.targetTitle);
	qs+="&CurrentWindowId="+window.name;
	if(d.windowId) qs+='&windowId='+escape(d.windowId);
	if(d.addParams) qs+='&'+d.addParams;
    if(d.mode && d.mode >= 0) qs+='&NavMode='+d.mode;
	var url=EPCM._private.uipPortalPath;
	if(d.mode == 0) {
		if(d.postBody) {
			var form=new BlindForm('navform',url);
			form.add('UsePost','true').addAll(qs,d.postBody);
			form.submit();
		} else {
			location.href=url+qs;
		}
	} else {
		var wn=d.winname;
		if(!wn||wn=='DefaultExternal'||wn=='')wn='WID'+new Date().getTime();
		if(d.postBody) {
			var form=new BlindForm('navform',url);
			form.add('UsePost','true').addAll(qs,d.postBody);
			self.navigateForm=form;
			self.open('/irj/portalapps/com.sap.portal.itelo.framework/mimes/nav2win.htm',wn,d.winfeatures);
		} else {
			self.open(url+qs,wn,d.winfeatures);
		}
	}
}
//EPCM.subscribeEvent('urn:com.sapportals:navigation','RelativeNavigate',onRelativeNavigate);

function onObjBasedNavigate(eventObj) {
	(new BlindIFrame('navframe'));
	var d=eventObj.dataObject;
	var form=new BlindForm('navform','/irj/servlet/prt/portal/prtroot/com.sap.portal.navigation.objbased.ObjBasedNavigation','POST','navframe');
	form.add('systemAlias',d.systemAlias).add('businessObjName',d.businessObjName).add('objValue',d.objValue);
	form.add('operation',d.operation||'').add('source',self.navigationTarget);
	var rm=d.resolvingMode||'Default';
	switch(typeof d.postBody) {
		case 'object': form.addAll(d.postBody); form.add('usePost','true'); break;
		case 'string': rm=d.postBody;
		default: form.add('usePost','false');
	}
	form.add('resolvingMode',rm);
	form.submit();
}
//EPCM.subscribeEvent('urn:com.sapportals:navigation','ObjBasedNavigate',onObjBasedNavigate);
}//if(self.EPCM)





function writeFlash(){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0"	width="598" height="147">');
	document.write('<param name="movie" value="/irj/portalapps/be.infrax.website.layout/mimes/flash/infrax_website.swf">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<embed src="/irj/portalapps/be.infrax.website.layout/mimes/flash/infrax_website.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="598" height="147" wmode="transparent">');
	document.write('</embed>');
	document.write('</object>');
}

//IE suckerfish above select boxes
function selectHide(){
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}
function selectShow(){
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}

function ulSelectBug(name){
	if(document.getElementById(name)){
		var ieULs = document.getElementById(name).getElementsByTagName('ul');
		for (j=0; j<ieULs.length; j++) {
			var ieMat=document.createElement('iframe');
			if(document.location.protocol == "https:")
				ieMat.src="//0";
			else if(window.opera != "undefined")
				ieMat.src="";
			else
				ieMat.src="javascript:false";
				
			ieMat.scrolling="no";
			ieMat.frameBorder="0";
			ieMat.style.width=ieULs[j].offsetWidth+"px";
			ieMat.style.height=ieULs[j].offsetHeight+"px";
			ieMat.style.zIndex="-1";
			if(ieULs[j].childNodes[0]){
				ieULs[j].insertBefore(ieMat, ieULs[j].childNodes[0]);
				ieULs[j].style.zIndex="101";
			}
		}
	}
}

//fix hover
	function hoverUl(name){
		var sfEls = document.getElementById(name).getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++){
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
				//selectHide();
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				//selectShow();
			}
			
		}
	}

	sfHover = function(){
//		hoverUl("lijst");
		hoverUl("sful");
		ulSelectBug("sful");
	}



function XMLHttpFactory() {
}

XMLHttpFactory.createXMLHttp = function () {
	if (typeof XMLHttpRequest != "undefined") {
		return new XMLHttpRequest();
	}else if (typeof window.ActiveXObject != "undefined") {
			return new ActiveXObject("MSXML2.XMLHttp");
	}else{
		return null;
	}
}

function updateDetailedNavigation(req){
	if(req.readyState==4){
		var resp= req.responseText;
		
		if(resp != ""){
			document.getElementById('leftMenu').innerHTML = resp;
		}
		
	}
}

function getDetailedNavigation(node){
		ajaxUrl = '/irj/servlet/prt/portal/prtroot/layout.ajaxservlets.WebsiteDetailedNavigation';
		ajaxUrl += '?node=' + node;
		ajaxUrl += '&user=' + user;
		ajaxUrl += '&'+ new Date().getTime();
		
		var oXMLHttp = XMLHttpFactory.createXMLHttp();
		if(oXMLHttp == null){
			alert('Your Browser Does not Support XMLHTTP');
		}else{
			oXMLHttp.onreadystatechange = function (){
				updateDetailedNavigation(oXMLHttp);
			}
		}	
		oXMLHttp.open("GET",ajaxUrl,true);
		oXMLHttp.send(null);
}


function updateRightImage(req){
	if(req.readyState==4){
		var resp= req.responseText;
		//alert(resp);
		if(resp != ""){
			document.getElementById('rightImage').style.background = 'url('+resp+') top right no-repeat';
		}else{
			document.getElementById('rightImage').style.background = 'transparent';
		}
		
	}
}

function getRightImage(title){
		ajaxUrl = '/irj/servlet/prt/portal/prtroot/layout.ajaxservlets.RightImageServlet';
		ajaxUrl += '?title=' + title;
		ajaxUrl += '&user=' + user;
		ajaxUrl += '&'+ new Date().getTime();
		 
		var oXMLHttp = XMLHttpFactory.createXMLHttp();
		if(oXMLHttp == null){
			alert('Your Browser Does not Support XMLHTTP');
		}else{
			oXMLHttp.onreadystatechange = function (){
				updateRightImage(oXMLHttp);
			}
		}	
		oXMLHttp.open("GET",ajaxUrl,true);
		oXMLHttp.send(null);
}

function updateSnelMenu(req,node,liId,lastLiIdClass,title){
	if(req.readyState==4){
		var resp= req.responseText;
		
		if(resp=='REFRESH'){
			window.open('/irj/portal/anonymous?NavigationTarget='+node,'_top');
		}else{
//			if(title == 'Home'){
//				document.getElementById('bodyText').className = 'full_bodyText';
//				document.getElementById('leftMenu').style.display = 'none';
//			}else{
////				getDetailedNavigation(node);
//				document.getElementById('bodyText').className = 'bodyText';
//				document.getElementById('leftMenu').style.display = 'block';
//			}
			
			document.getElementById('lijst').innerHTML = resp;
			infraxDoNavigate(node,liId,lastLiIdClass);
			hoverUl("lijst");
			getRightImage(title);
		}
	}
}

var lastLiId = '';
var pc = 0;
var user = '';
var kdb = true;

function callAjaxSnelMenu(node,liId,lastLiIdClass,title){
	if(kdb){
		ajaxUrl = '/irj/servlet/prt/portal/prtroot/com.infrax.intranet.topLevelNavigation.AjaxServlet';
		ajaxUrl += '?pc=' + pc;
		ajaxUrl += '&curNavNode=' + node;
		ajaxUrl += '&user=' + user;
		ajaxUrl += '&'+ new Date().getTime();
	
		var oXMLHttp = XMLHttpFactory.createXMLHttp();
		if(oXMLHttp==null){
			alert('Your Browser Does not Support XMLHTTP');
		}else{
			oXMLHttp.onreadystatechange = function (){
				updateSnelMenu(oXMLHttp,node,liId,lastLiIdClass,title);
			}
		}	
		oXMLHttp.open("GET",ajaxUrl,true);
		oXMLHttp.send(null);

	}else{
		infraxDoNavigate(node,liId,lastLiIdClass);
	}
}

function infraxNavigate(node,liId,lastLiIdClass,title){
	callAjaxSnelMenu(node,liId,lastLiIdClass,title);
}

function infraxNavigateHandler(eventObj){
	var node = eventObj.dataObject;//.target.replace('?','&');

	callAjaxSnelMenu(node,null,null);

}

EPCM.subscribeEvent('urn:com.com.infrax:navigation','detailNavigate',infraxNavigateHandler);

function infraxDoNavigate(node,liId,lastLiIdClass){
	EPCM.doNavigate(node);
	
	if(liId != null){
		var last = document.getElementById(lastLiId);
		if(last){
			last.className = lastLiIdClass;
		}
		document.getElementById(liId).className = "hover";
		lastLiId = liId;
		document.getElementById('focusAfterNavigation').focus();
	
	}
}

function initInfraxNavigate(liId,p,u,k){
	
	lastLiId = liId;
	pc = p;
	if(pc == 0){
		pc = -1;
	}
	user = u;
	kdb = k;
}







