var filesadded="" //list of files already added
var timertje = null;
var pagina  = "";

function initSlagzinreload(keyPage) {
//	alert ( $('kiesuwbranche').style.backgroundImage );
//	 test = document.getElementById('kiesuwbranche');
//	 testdf;

	

 	pagina = keyPage;
	setTimeout ( reloadSlagzin, 5000); 
 
	
}

function reloadSlagzin() {
//	Effect.Fade($("slagzinholder"), {duration: 0.3, from: 1.0, to: 0.1} );
	setTimeout ( ajaxpage_laden, 300); 
}

function ajaxpage_laden() {
 	if(timertje)
	{
		window.clearTimeout(timertje);
		timertje = null;
	}
	keyPage = pagina;
	
    // Use AJAX to load other pages
    var pageContent;
    teller=Math.floor(Math.random()*1000000);

	keyPage = keyPage + '&teller=' + teller;
	

    // Check if the browser knows the standard request
    if(window.XMLHttpRequest) {
        
        // Mozilla etc
        pageContent = new XMLHttpRequest();
    
    // If it does not know the standard object, check if
    // it knows the activeX object.
    } else if(window.ActiveXObject) {
    
        // Internet Explorer 6
        pageContent = new ActiveXObject("Microsoft.XMLHTTP");            
    
    // It doesn't know any, so give an error    
    } else {
        
        alert('Browser doesn\'t support AJAX'); 
    
    }

    // Open the file
    pageContent.onreadystatechange = StateChange;
	
	pageContent.open('GET', keyPage, true);
	pageContent.send(null);

    // Listen for a change state
    function StateChange() {
    
//0: Request has not been initialized yet.
//1: The request is made.
//2: The request is sent.
//3: The request is handled by the server.
//4: The request is done.
		if(pageContent.readyState == 1) {
				
				
				//document.getElementById("loader").style.display = "block";
		}
        // The state is changed, but is it 4?
        if(pageContent.readyState == 4) {
		 
			document.getElementById("slagzinholder").innerHTML = pageContent.responseText;
			
		
			if(typeof sIFR == "function"){
			
				// This is the preferred "named argument" syntax
			//	sIFR.replaceElement(named({sSelector:"body h7",sWmode: 'transparent', sFlashSrc:"myriadlight.swf", sColor:"#d9d9d9", sLinkColor:"#000000", sBgColor:"#020202", nPaddingTop:10, nPaddingBottom:10, sHoverColor:"#CCCCCC"}));
				//sIFR.replaceElement(named({sSelector:"body h5", sFlashSrc:"myriadlight.swf", sColor:"#000000", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:20, nPaddingBottom:20, sFlashVars:"textalign=center&offsetTop=6"}));


			//sIFR.replaceElement(named({sSelector:"body h6",sWmode: 'transparent', sFlashSrc:"myriadlight.swf", sColor:"#da672e", sLinkColor:"#da672e", sBgColor:"#020202", sHoverColor:"#da672e"}));
			};
			//Effect.Fade($("slagzinholder"), {duration: 0.3, from: 0.5, to: 1} );
			setTimeout ( reloadSlagzin, 5000); 
        }
        
    }

}





 
