	
	var logonWindow = null;
	var logonWindowHandler = null;
	var contentFrameName = null;
	var protocol = document.location.protocol;	
	var tStamp = 'TS';
		
	var isPopUpBlockerOn = false;
	
	Today = new Date();
	timeStamp = Today.getTime();
	
	if ( protocol=='undefined' || protocol=='' ) { protocol='http:'; }
	
	if (typeof(channelUrl)=='undefined') {
		channelUrl='';
	}
	
	// Wenn Menüpunkt geschützt, dann auf Logon URL des Mandanten umleiten
	userCookie=getCookie( COOKIE_NAME);	
	if ((userCookie==null) && (isSecure) && (!hasStartPage) && ( !isStaging ) ) {
			self.location.href=getLoginURL();
	}
	
    // for all JS-Links in C2C
	function openLink(oid,openType,linkType,windowOpenProps,statisticTag,anchorObject) {
		sendStatisticLink(oid,linkType,statisticTag,anchorObject);
		
		url = location.pathname;		
		first4=url.substr(0,4);
		posLastSlash = url.lastIndexOf('../../../default.htm');
		
		if (posLastSlash>1) {
			if (first4=='../../../nc/default.htm' && posLastSlash>3 ) {						 
				url = channelUrl!=''?'/nc'+channelUrl:url.substr(0,posLastSlash);
			} else if (first4!='../../../nc/default.htm') {
				url = channelUrl!=''?channelUrl:url.substr(0,posLastSlash); 
			}		
		} else {
			url = channelUrl; // location.pathname => "../../../default.htm", Aufruf von HostnamechannelUrl
		}
		var noCache = getNoCacheFlagOfOid(oid);
		
		if ( userCookie==null && noCache==0 && url.substr(0,4)=='../../../nc/default.htm') 	{
			url = url.substr(3,url.length);
		} else if (url.substr(0,4)!='../../../nc/default.htm' && noCache!=0) {
			url = '/nc' + url;
		} else if (url.substr(0,4)!='../../../nc/default.htm' && userCookie!=null) {
			url = '/nc' + url;
		}
		
		if (typeof(linkType)=='undefined' || linkType=='co' || linkType=='me' ) {
			oid=replaceMODEInOID(oid, isPortalChannel);
			oid=replaceChannelInOID(oid);
			oid=replaceNOCACHEInOID(oid);
			url = url +   "../../../default.htm" + oid + ".html" + location.search
		} else if (linkType=='ex') {
				
			url = getURLbyContChannelId(oid);
				
			if ( url!=oid ) {
				if (openType=="2") {
					openType = "3";
				}
				windowOpenProps = getPropsbyContChannelId(oid);
			}
		} else {
			url = oid;
		}

        // Wenn angemeldet , und NoCache Seite wird aufgerufen,  dann timestamp an URL hängen , wegen Proxy-Cache
	   url = oid;					
		switch (openType) {
			case "1": {
				location.href = url;
				break;
				}
			case "2": {
				newWindow = window.open(url);
				try {
					newWindow.focus();
				} catch (error) {}
				break;
				}
			case "3": {
				title = getTitle(oid);
				newWindow = window.open(url,title,windowOpenProps);
				if (!newWindow && url.indexOf('@')<0) isPopUpBlockerOn=true;
				try {
					newWindow.focus();
				} catch (error) {}
				break;
				}
			case "4": {
				frmContent = window.frames[contentFrameName];
				if (typeof(frmContent)=='undefined') {
					window.location.href = url;				
				} else {
					frmContent.location.href = url;
				}
				break;
				}
			default : {
				location.href = url;
				}
		}
	}
	
// for new window
	function getTitle(oid) {
		try {
			arrOid = oid.split('-');
			// oid can also be one single id (contChannelId)
			var uniqueIdPos = arrOid.length>4 ? 4 : arrOid.length-1;
			var uniqueId = arrOid[uniqueIdPos];
			if (isNaN(uniqueId)) { // oid can also be a file-path
				return 'newWindow' + Number(new Date());
			} else {
				return 'newWindow' + uniqueId;
			}
		} catch ( error ) {
			return 'newWindow' + Number(new Date());
		}
	}

// for Conttype PopUp
	function openPopUp(contChannelId,callType) {
		try {
			//for Menu and ContenItem PopUps
			if (callType=='puOpen') {
				popUpArray = POPUPIDS.split(',');
				for (i=0;i<popUpArray.length;i++) {
					singlePopUp="POPUP" + popUpArray[i];
					singlePopUpValue=eval(singlePopUp);
					popUpProps = singlePopUpValue.split('|');
					
					openLink(popUpProps[0],"3",'co',popUpProps[1]);
					if (isPopUpBlockerOn && isRedirectPUBlockerOn) {
						openLink(channelUrl + '/popup?o=' + getOidFromUrl(location.pathname) + '&p=' + singlePopUpValue,'1','ex');
					}
				}
			} else if (callType=='puClose') {
				//only open popup if no opener exists
				if (!window.opener && (event.clientY < 0)) {
					singlePopUp="CLOSE_POPUP_PROPS" + CLOSE_POPUP_ID;
					singlePopUpValue=eval(singlePopUp);
					popUpProps = singlePopUpValue.split('|');
					
					openLink(popUpProps[0],"3",'co',popUpProps[1]);
				}
			} else if (callType=='pu') {
				popUpArray = DE_POPUP_IDS.split(',');
				for (i=0;i<popUpArray.length;i++) {
					if (popUpArray[i]==contChannelId) {
						singlePopUp="DE_POPUP_PROPS" + popUpArray[i];
						singlePopUpValue=eval(singlePopUp);
						popUpProps = singlePopUpValue.split('|');
						
						openLink(popUpProps[0],"3",'co',popUpProps[1]);
					}
				}
			}
		} catch ( error ) {  }
	}
	
	function openPopAndBack() {
		htmlString = location.search;
		oriIdEnd=htmlString.indexOf('&')-1;
		if (oriIdEnd < 0)
			oriIdEnd = htmlString.length;
		oriId = setOid(htmlString.substr(3,oriIdEnd-2),18,1);
		
		singlePopUpValue = htmlString.substr(oriIdEnd+4);
		popUpProps = singlePopUpValue.split('|');
		var neww = openLink(popUpProps[0],"3",'co',popUpProps[1]);
		backNoPop();
		if (window.focus ) { 
			neww.focus();
		}
		openLink(oriId,1,'co');
	}
	
	function backNoPop() {
		pIdEnd=location.search.indexOf('&')-1;
		if (pIdEnd < 0) 
			pIdEnd = location.search.length;
		pId = setOid(location.search.substr(3,pIdEnd-2),18,1);
		openLink(pId,1,'co');
	}
	
	
// for openLink used by external links	
	function getURLbyContChannelId(oid) {
		try {
			props = "DE_EX_PROPS" + oid;
			propvalues = eval(props);			
			if ( typeof(propvalues)=='undefined' ) {
			 return oid;
			} else {
			 propArray = propvalues.split('|');
			 return propArray[0];
			}
		} catch ( error ) { return oid; }
	}
	
	function getPropsbyContChannelId(oid) {
		try {
			props = "DE_EX_PROPS" + oid;
			propvalues = eval(props);
			propArray = propvalues.split('|');
			return propArray[2];
		} catch ( error ) {  }
	}
	
// for Instadia Statistics
	function sendStatisticLink(oid,linkType,statisticTag,anchorObject) {
		if (typeof(instadiaId)!='undefined') {
			if (typeof(statisticTag)=='undefined') { statisticTag=''; }
			if (linkType=='ex' || linkType=='fi' || (linkType=='co' && statisticTag!='')) {
				filename='';
				instadiaLinkDesc=instadiaDesc;
				if (linkType=='ex') {
					instadiaLinkDesc += 'user_linked_to_';
					filename = getFilenameForInstadia(oid, anchorObject);
				} else if (linkType=='fi') {
					instadiaLinkDesc += 'user_download_';
					startpos = oid.indexOf('../../../Projects/c2c/channel/default.htm');
					if (startpos!=-1) {
						filename = oid.substr(oid.lastIndexOf('../../../default.htm')+1,oid.length) + "../../../default.htm";
					}
				} else {
					instadiaLinkDesc += 'user_linked_to_';
					filename = getFilenameForInstadia(oid, anchorObject);
				}

				// call the Instadia JavaScript in c2c_start , is the parent c2c_start or is no parent ?				
				instadiaLinkDesc += filename + statisticTag;				
				
				try {
					Instadia_sendInfo(instadiaId,instadiaLinkDesc,instadiaLinkDesc);
				} catch ( instadiaError ) {}		
			}
		}		
	}
	
	function getFilenameForInstadia(oid, anchorObject) {
		if (typeof(anchorObject) == 'undefined') {
			try {
				props = "DE_EX_PROPS" + oid;
				propvalues = eval(props);			
				if ( typeof(propvalues) == 'undefined' ) {
					return oid;
				} else {
					propArray = propvalues.split('|');
					return propArray[3] + "../../../default.htm";
				}
			} catch ( error ) { return oid; }
		} else {
			try {
				return anchorObject.innerText + "../../../default.htm";
			} catch ( error ) { return ""; }
		}
	}

// returns Oid from url
	function getOidFromUrl( url ) {
		posBeginHtml= url.lastIndexOf('.html');
		posBeginOid = url.lastIndexOf('../../../default.htm') + 1;
		
		if (posBeginHtml>1) {
			url = url.substr(0,posBeginHtml);
			url = url.substr(posBeginOid);
		} else {
			url = '';
		}
		return url;
	}

// for search	
	function isValidDate(datestring) {
		var day;
		var month;
		var year;
		var hour;
		var minute;
		var fieldOk = true;
		cal = new Array(31,29,31,30,31,30,31,31,30,31,30,31);
		if (datestring != "") {
			day = datestring.substring(0,2);
			month = datestring.substring(3,5);
			year = datestring.substring(6,datestring.length);
			point1 = datestring.substring(2,3);
			point2 = datestring.substring(5,6);
			if (point1 != '.' || point2 != '.') {
				fieldOk=false;
			}
			if (datestring.length != 10) {
				fieldOk=false;
			} else {
				if (year > 1899 && year < 2101 && month < 13 && month > 0 && day < 32 && day > 0) {
					if (cal[eval(month)-1] < day && eval(month)!=2) {
						fieldOk=false;
					} else {
						if (year%4 && day > 28 && eval(month)==2) {
							fieldOk=false;
						} else {
							if (day > 29 && eval(month)==2) {
								fieldOk=false;
							}
						}
					}
				} else {
					fieldOk=false;
				}
			}
		} else {
			fieldOk=true;
		}
		return fieldOk;
	}

// for replacing values in OID	
	function setOid(OID, location, newValue) {
		arrayOID = OID.split('-');
		arrayOID[location] = newValue;
		return arrayOID.join('-');
	}

// for header
	function replaceMODEInOID(OID, isPortalChannel) {																		
		if( isPortalChannel ) {
			strOID=setOid(OID, 10, 1);
		} else {
			strOID=setOid(OID, 10, 1);
		}
		return strOID;
	}
	
// for contentreference to mainchannel
	function replaceChannelInOID(OID) {
		if (parentChannelId > 0 && parentChannelId!=channelId) {
			return (setOid(OID, 1, channelId));
		}
		return OID;
	}
	
// for secure sites
	function replaceNOCACHEInOID(OID) {																		
		userCookie=getCookie(COOKIE_NAME);
		if ( userCookie!= null  ) {
			strOID=setOid(OID, 16, 31);
		} else {
			strOID=OID;
		}
		return strOID;
	}

	function replaceNoCacheInTemplateAndOid(source) {
		 userCookie=getCookie( COOKIE_NAME);
		 if (( userCookie!= null ) && (source.indexOf('/nc')==-1) && (source.indexOf(channelUrl)>=0)) {
			source = '/nc' + source;
		}
		return source;
	}
	
	function getNoCacheFlagOfOid(pOid) {
		arrayOID=pOid.split('-');
		if (arrayOID.length>5) {
			return arrayOID[16];
		} else {
			return -1;
		}
	}
	
	function addTimeStamp( aURL ) {		
		try {	
			hasTimeStamp = (aURL.indexOf(tStamp+'=')>-1);	 
			if ( hasTimeStamp ) {
				return aURL;
			}	  
			bNocacheUrl = (aURL.indexOf('../../../nc/default.htm')>-1);	 
			if ( userCookie!=null && bNocacheUrl) {	 
				qmInUrl = (aURL.indexOf('?')>-1);
				if ( qmInUrl  ) { 
					url=aURL+'&' + tStamp + '='+timeStamp;
				} else {
					url=aURL+'?' + tStamp + '='+timeStamp;
				}	  
			} else {
				url=aURL;
			}
		} catch ( error ) { url=aURL; }
		return url;
	}
	
	function getCookie(sName) {
	  // cookies are separated by semicolons
	  var aCookie = document.cookie.split("; ");
	  for (var i=0; i < aCookie.length; i++) {
	    // a name/value pair (a crumb) is separated by an equal sign
	    var aCrumb = aCookie[i].split("=");
	    if (sName == aCrumb[0])
	      return unescape(aCrumb[1]);
	  }
	
	  // a cookie with the requested name does not exist
	  return null;
	}

	function showLogon(objLogonPanel, strLogonText, strLogoffText) {				
		
		if ( objLogonPanel!=null ) {
			var strUser =  getCookie(COOKIE_NAME);
			if ( strUser!=null ) {				
				objLogonPanel.innerText=strLogoffText;
				objLogonPanel.title=strLogoffText;
			} else  {				
				objLogonPanel.innerText=strLogonText;
				objLogonPanel.title=strLogonText;
			}		
		}
	}
	
	
	/** Benutzer An/Abmeldung 
	*	Wenn  Benutzer angemeldet, erfolgt Abmeldung und vice versa.
	* Bei Anmeldung wird geprüft, ob internal/confidential
	* und daraufhin auf die richtigen URLS umgeleitet
	**/
	function logOnOff() { 		
		// get needed info first

		userCookie=getCookie(COOKIE_NAME);			  // user logged on ?
		currentURL = window.location.href;					 // current URL	
		currentHost = window.location.host;					// hostname
		currentPath=  window.location.pathname;		// path
		currentProtocol = protocol;
							
		var redirectURL = "";
		
		if ( userCookie == null  ) {
		// Not logged on yet, so do a logon by reloading the page with ../../../nc/default.htm and the according Security token in host.				
		redirectURL =getLoginURL();
		} else {
		  // User is Logged On; So Logoff: Delete the cookie by setting its expiry date to be sometime in the past
		  // and call the appropriate Siteminder Logoff URI
		  deleteCookie(COOKIE_NAME);		  
		  redirectURL =getLogoutURL();	  		  
		}
		
	window.location.href=redirectURL;	
  }

 function getLoginURL() {
 currentPath=  window.location.pathname;		// Channel path
 isNoCache  = (currentPath.indexOf('../../../nc/default.htm')>-1);  // nocache Token in Path ?
 if (!isNoCache) {
				   // Add ../../../nc/default.htm to the path
				   currentPath= '/nc' + currentPath;
				   }
 if (isConfidential) {
				// Confidential Security
				 CDA_LOGON_URL = CDA_LOGON_URL_CONFIDENTIAL;
				} else {
				// Internal Security  
				 CDA_LOGON_URL = CDA_LOGON_URL_INTERNAL;							
				}
 return (CDA_LOGON_URL + currentPath);				
 }
 
 function getLogoutURL() {
    if (isConfidential) {
		  LOGOFF_URL = SM_LOGOUT_LINK_CONFIDENTIAL;
		  } else {
		  LOGOFF_URL = SM_LOGOUT_LINK_INTERNAL;
		  }
	return 	 LOGOFF_URL;
 }

 function deleteCookie(cookie_name) {
   var now = new Date();
   var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);
   document.cookie = escape(cookie_name) + '=' + '; EXPIRES=' + yesterday.toGMTString() + '; PATH=../../../default.htm';
 }	
	
// image swapping
	function swapImgRestore() { //v3.0
		var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function preloadImages() { //v3.0
		var d=document; if(d.images){ if(!d.p) d.p=new Array();
		var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
	}
	
	function findObj(n, d) { //v4.0
		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=findObj(n,d.layers[i].document);
		if(!x && document.getElementById) x=document.getElementById(n); return x;
	}
	
	function swapImage() { //v3.0
		var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
		if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
// for magnifiying glass
	function imgPreview(DUMMY_DEPRECATED,id) {	
		if ( id==null || id=='undefined' ) { id=DUMMY_DEPRECATED; }
		var prevURL =window.location.protocol+"//"+window.location.host + PREVIEW_FILE_JSP + '?FILETYPE=IMAGE&FILE_ID=' + id + '&LANG=' + langId + '&CHANNEL='+ channelId;
	 	pv=0;	 	
	 	window.open (prevURL,'prev',"width=450,height=380,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes");
		return false;
	}
	
// check if Flash is Available
	b = navigator.userAgent.toLowerCase();
	if ( (b.indexOf('msie') != -1) && (b.indexOf('win') != -1) && (b.indexOf('opera') == -1) ) {
		document.writeln('<script language="VBscript">');
		document.writeln('Function detectActiveXControl(activeXControlName)');
		document.writeln('  on error resume next');
		document.writeln('  detectActiveXControl = False');
		document.writeln('  detectActiveXControl = IsObject(CreateObject(activeXControlName))');
		document.writeln('End Function');
		document.writeln('</scr' + 'ipt>');
	}
	function getFlashVersion(){
		var installedVersion = 0;
		if ( (b.indexOf('msie') != -1) && (b.indexOf('win') != -1) && (b.indexOf('opera') == -1) ) {
			for (var i=3; i<10; i++){
				if(detectActiveXControl("ShockwaveFlash.ShockwaveFlash."+i) == true) installedVersion = i;
			}
		} else {
			if (navigator.plugins["Shockwave Flash"]) {
				var pluginDesc = navigator.plugins["Shockwave Flash"].description;
				installedVersion = parseInt( pluginDesc.charAt( pluginDesc.indexOf(".")-1 ) );
			}
			if(b.indexOf("webtv") != -1) installedVersion = 3;  
		}
		return installedVersion;
	}

	function checkFlashPlayer() {
	
		 flashInst = getFlashVersion();
		 if(!flashInst){

			var elemEmbed;
			var altImg;
			coll = document.getElementsByTagName("EMBED");
			for (i=0;i<coll.length;i++) {
				elemEmbed = coll[i];
				altImg = elemEmbed.getAttribute("altImage");
				if(altImg!=null && altImg.length>0) {
					elemEmbed.parentNode.innerHTML="<img src='"+altImg+"'>";
				}
			}
		} 
	}
	
// DivSwap IndexLists
	function popUpSwapDivTagByCaller(strShow,strHide) {
	
		var objShow = document.getElementById(strShow);
		var objHide = document.getElementById(strHide);
		
	    if (objShow!=null) {
		    if (objShow.style.display == "none" || objShow.style.display=="") {
		        objShow.style.display = "block" ;
		    } else {
		        objShow.style.display = "none" ;
		    }
	    }
	    if (objHide != null) {
	       objHide.style.display = "none" ;
	    }
	}

// Overview Steps
	function showMore(obj, divId) {
	   var divObj = document.getElementById(divId);
	   var divElements = divObj.getElementsByTagName('DIV');
	   for (i=0;i < divElements.length;i++) {
	       divElements(i).style.display = 'block';
	   }
	   obj.style.display = "none" ;
	}
	
// for Selector
	function verifyDayOptions(obj) {
		var prefix = obj.name.substring(0, 3);
		
		var diff = 0;
		var anzTage = 0;
	
		eval("var dayBox ="+ obj.form.name+"."+prefix+"day");
		eval("var monthBox ="+ obj.form.name+"."+prefix+"month");
		eval("var yearValue ="+ obj.form.name+"."+prefix+"year.value;");
		
		var monat = monthBox.value;
		var boxLength = dayBox.length;
		
		switch(monat) {
			case "02":
				anzTage = 28;
				var leapYear = (yearValue - 2000);
				if (leapYear>0 && (leapYear%4)==0) {
					anzTage = 29;
				}		
				break;
	
			case "01":
			case "03":
			case "05":
			case "07":
			case "08":	
			case "10":
			case "12":
					anzTage = 31;
				break;
			default:
				anzTage = 30;
				break;
		}
		diff = anzTage - boxLength;	
		if (diff > 0) {
			for (i = 1; i <= diff; i++) {
				var val = boxLength + i; 
				var oOption = document.createElement("OPTION");
				dayBox.options.add(oOption);
				oOption.innerText = ""+val;
				oOption.value = ""+val;
			}	
		} else {
			diff *= -1;
			for (i = 0; i < diff; i++) { 
				dayBox.options.remove(dayBox.length-1);
			}
		}		
	}
	
// body default jscalls
	function doOnUnLoadDefault() {
		try {
			openPopUp(0,'puClose');
			doBeforeUnLoad();
		} catch ( error ) {  }
	}
	
	function doOnLoadDefault() {
		try {
			openPopUp(0,'puOpen');
			checkFlashPlayer();
			doBeforeLoad();
		} catch ( error ) {  }
	}
	function doOnUnLoadSplashDefault() {
		try {
			doBeforeUnLoadSplash();
		} catch ( error ) {  }
	}
	function doOnLoadSplashDefault() {
		try {
			checkFlashPlayer();
			doBeforeLoadSplash();
		} catch ( error ) {  }
	}

