function printWindow() {
bV = parseInt(navigator.appVersion);
if (bV >= 4) window.print();
}

function openw(url, naam){
     w = width = 600;
     h = height = 150;
     x = Math.round((screen.availWidth-w)/2); //center the top edge
     y = Math.round((screen.availHeight-h)/2); //center the left edge
     popupWin = window.open(url, 'fonds', "width="+w+",height="+h+",scrollbars=1,history=no,toolbar=no,resizable=0,statusbar=no,top="+y+",left="+x+",screeenY="+y+",screenX="+x);
     popupWin.focus();
}

function repairsize() {
  var myWidth = 0, myHeight = 0;
  var myextraHeight=0; var myTextHeigt=0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
    myextraHeight=2;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

	if(document.getElementById('content')){
		textheight=document.getElementById('content').style.height=myHeight-205+"px";
	}
	if(document.getElementById('contents')){
		textheight=document.getElementById('contents').style.height=myHeight-205+"px";
	}

}
window.onresize = function() {
	repairsize();
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

var transparency=100
var transparencystep=5
var pausefade=40
var ns4=document.layers?1:0
var ns6=document.getElementById&&!document.all?1:0 
var ie=document.all?1:0
// enter the pause between each lid retrieve action (1000 = 1 second)
var pausebetweenlidretrieval=12000 


function fadein(id) {

	if (transparency>0){
		transparency-=transparencystep
		if (ie) {
			thisId=document.getElementById('fade');
			if(thisId){
				thisId.filters.alpha.opacity=transparency
			}
		}
		if (ns6) {
			thisId=document.getElementById('fade');
			if(thisId){
				thisId.style.MozOpacity=transparency/100
			}
		}
		var fadetimer=setTimeout("fadein('fade')",pausefade)
	}
	else {
		clearTimeout(fadetimer);
		var retrievaltimer=setTimeout("fadeout('fade')",pausebetweenlidretrieval);
	}
}
function fadeout(id) {
	if (transparency<100){
		transparency+=transparencystep
		if (ie) {
			thisId=document.getElementById('fade');
			if(thisId){
				thisId.filters.alpha.opacity=transparency
			}
		}
		if (ns6) {
			thisId=document.getElementById('fade');
			if(thisId){
				thisId.style.MozOpacity=transparency/100
			}
		}
		var fadetimers=setTimeout("fadeout('fade')",pausefade)
	}
	else {
		clearTimeout(fadetimers);
		getnewlidnow('fade');
	}
}


  function getnewlidnow(id) {
      /* Set up the request */
      var xmlhttp =  new XMLHttpRequest();
      xmlhttp.open('POST', 'http://www.hartmansstudiekring.nl/getlid.php', true);

      /* The callback function */
      xmlhttp.onreadystatechange = function() {
          if (xmlhttp.readyState == 4) {
              if (xmlhttp.status == 200)
                  addData(xmlhttp.responseXML,'fade');
              else
                  alert('Er is helaas iets fout gegaan bij het ophalen van de gegevens');
          }
      }
      
      /* Send the POST request */
      xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      xmlhttp.send('id=sadflkj3rlskjdhfl3w4rjesdflkj43wrelsdkjl3w24rjefsdlk4jrwesdlcx');
      
      /* Add temporary feedback that the request has been sent */   
				if (ie) {
					thisId=document.getElementById('fade');
					if(thisId){
						thisId.filters.alpha.opacity=100
					}
				}
				if (ns6) {
					thisId=document.getElementById('fade');
					if(thisId){
						thisId.style.MozOpacity=1
					}
				}
  }
  
  function addData(responseXML, id) {

			var response = responseXML.getElementsByTagName('result')[0].firstChild.data;
			thisId=document.getElementById('fadecontainer');
			document.getElementById('fadecontainer').innerHTML=stripSlashes(response);
			var startover = 1;
			setTimeout("fadein('fade')",2);
      
  }
	
	function stripSlashes(str){
		return str.replace(/\\/g, '');
	}