
		var keepChecking = true; // Whether to keep checking for new proactive chat requests
		var alreadyrunflag = 1; // flag to indicate whether target function has already been run
		var refreshInterval = 10000; // In miliseconds, default 10000
		var recheckRunFlag = false;
		var recheckUri = 'http://www.mhohl.de/index.php?option=com_livechat&view=popup&do_not_log=true&format=raw&task=check_proactive&refresh_only=1&t=1283709296';
		
		function injectProactiveChat()
		{
		    recheckProactiveChats();

		    if(alreadyrunflag == 1) {
			return false;
		    }
		    
		    alreadyrunflag = 1;
		    
		    requestLiveChat('http://www.mhohl.de/index.php?option=com_livechat&view=popup&tmpl=component&iframe=1', 'iframe');
		}

		function recheckAction()
		{
		    var body = document.getElementsByTagName('body').item(0);
		    var existingScript = document.getElementById('livechat_recheck_script');

		    if(existingScript) {
			existingScript.parentNode.removeChild(existingScript);
		    }

		    var script = document.createElement('script');
		    script.src = recheckUri;
		    script.id = 'livechat_recheck_script';
		    script.type = 'text/javascript';
		    body.appendChild(script);
		}

		function recheckProactiveChats()
		{
		    if(recheckRunFlag) {
			return false;
		    }

		    var livechatLayer = document.getElementById('livechat_iframe');

		    recheckRunFlag = true;

		    try {
			if(closedPermanently) {
			    var isClosedPermanently = true;
			} else {
			    var isClosedPermanently = false;
			}
		    } catch(err) {
			// Default
			var isClosedPermanently = false;
		    }
		    
		    if(keepChecking && !isClosedPermanently && !livechatLayer) {
			// Keep refreshing
			setTimeout('recheckAction(); recheckRunFlag=false; recheckProactiveChats();', refreshInterval);
		    }
		}

		if (document.addEventListener) {
		  document.addEventListener("DOMContentLoaded", function(){ injectProactiveChat() }, false)
		} else if (document.all && !window.opera) {
		    document.write('<script type="text/javascript" id="contentloadtag" defer="defer" src="javascript:void(0)"><\/script>')
		    
		    var contentloadtag=document.getElementById("contentloadtag");

		    if(contentloadtag) {
			contentloadtag.onreadystatechange=function() {
			    if (this.readyState=="complete") {
			      injectProactiveChat()
			    }
			}
		    }
		}

		window.onload=function(){
		  setTimeout("injectProactiveChat();", 5)
		}
		