function openvensters(url1, url2) {
	
	window.location=url1;
	window.open(url2,'uitdebrand','width=800,height=600,scrollbars=yes,toolbar=yes,location=yes'); 
	return false;
}


function showback(waarde) { 
	if(document.getElementById('inlogback')) {	
		document.getElementById('inlogback').style.background = "#000000"; 
		document.getElementById('inlogback').style.display = "block"; 
	}
	if(document.getElementById('movie')) { 
		myRand=parseInt(Math.random()*99999999);
		myRanda=parseInt(Math.random()*999999999);
		http.open("GET", "player.php?random="+myRand+myRanda+"&flvid="+waarde+"", true); 
		http.onreadystatechange = handleRefResponse; 
		http.send(null);
	}
	
}

function hideback() { 
	if(document.getElementById('inlogback')) {	
		document.getElementById('inlogback').style.display = "none"; 
	}

	if(document.getElementById('movie')) {	document.getElementById('movie').style.visibility = "hidden"; }
}




function handleRefResponse() { 
    if (http.readyState == 4) { 
		document.getElementById('movieflv').innerHTML = http.responseText; 
		document.getElementById('movie').style.visibility = "visible"; 
		document.getElementById('movie').style.display = "block";
	}	
}



function getHTTPObject() {
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
    try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
    try {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
    xmlhttp = false;
    }
    }
    @else
    xmlhttp = false;
    @end @*/
    
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try { xmlhttp = new XMLHttpRequest(); } 
        catch (e) { xmlhttp = false; }
    }
    return xmlhttp;
}


var http = getHTTPObject(); // We create the HTTP Object


function showinlog() { 

	
	if(document.getElementById('inlog')) {	
		document.getElementById('inlog').style.display = "block"; 
	}
	if(document.getElementById('inlogback')) {	
		document.getElementById('inlogback').style.background = "#FFFFFF"; 
		document.getElementById('inlogback').style.display = "block"; 
	}
}
function hideinlog() { 
	if(document.getElementById('inlog')) {	document.getElementById('inlog').style.display = "none"; }
	if(document.getElementById('inlogback')) {	document.getElementById('inlogback').style.display = "none"; }

}



function loguit() {
	
	var check = confirm("Weet u zeker dat u wilt uitloggen?");
		if(check == true) {	
		myRand=parseInt(Math.random()*99999999);
		myRanda=parseInt(Math.random()*999999999);
		http4.open("GET", "loguit.php?random="+myRand+myRanda+"", true); 
		http4.onreadystatechange = handleRefResponse4; 
		http4.send(null);
		}
}

function handleRefResponse4() { 
    if (http4.readyState == 4) { 
		window.location="http://www.stichtingsalvage.nl/";	
	}	
}

var http4 = getHTTPObject(); // We create the HTTP Object



function toongegevens(veld) {

	// alle velden uitzetten
	if(document.getElementById('introductie')) { document.getElementById('introductie').style.display = "none"; }
	if(document.getElementById('Downloads')) { document.getElementById('Downloads').style.display = "none"; }

	
	if(document.getElementById(veld)) { document.getElementById(veld).style.display = "block"; }
}


function checkEnter(e){ 

	var characterCode;
	
	if(e && e.which){ 
	e = e
	characterCode = e.which 
	}
	else{
	e = event
	characterCode = e.keyCode 
	}
	
	if(characterCode == 13){
		 
		if (document.loginform.gebruikersnaam.value == '' || document.loginform.wachtwoord.value == ''){
			alert('Vul a.u.b. uw gebruikersnaam en wachtwoord in');
		} else {
			
			checklogin(); 
		}

	}
}



function checklogin() {
	
	var gebruikersnaam = document.loginform.gebruikersnaam.value;
	var wachtwoord = document.loginform.wachtwoord.value;

	myRand=parseInt(Math.random()*99999999);
	myRanda=parseInt(Math.random()*999999999);
	

	http5.open("GET", "checklogin.php?random="+myRand+myRanda+"&gebruikersnaam="+gebruikersnaam+"&wachtwoord="+wachtwoord+"", true); 
	http5.onreadystatechange = handleRefResponse5; 
	http5.send(null);
}


function handleRefResponse5() { 
    if (http5.readyState == 4) { 

		if(http5.responseText == "wel") { window.location="http://www.stichtingsalvage.nl/extranet/"; } 
		if(http5.responseText == "niet") { alert('Onjuiste login!'); } 
	}
}

var http5 = getHTTPObject(); // We create the HTTP Object



function urlencode(str) {
	str = escape(str);
	str = str.replace('+', '%2B');
	str = str.replace('%20', '+');
	str = str.replace('*', '%2A');
	str = str.replace('/', '%2F');
	str = str.replace('@', '%40');
	return str;
}

function urldecode(str) {
	str = str.replace('+', ' ');
	str = unescape(str);
	return str;
}





function zoeken() {
	
	var zoekterm = document.getElementById('zoektermid').value;
	
	if(zoekterm.length >= 3) {
		myRand=parseInt(Math.random()*99999999);
		myRanda=parseInt(Math.random()*999999999);
		http7.open("GET", "slazoektermop.php?random="+myRand+myRanda+"&zoekterm="+urlencode(zoekterm)+"", true); 
		http7.onreadystatechange = handleRefResponse7; 
		http7.send(null);
	}
	else {
	alert('Uw zoekterm moet minimaal 3 karakters bevatten!');	
	}
}


function handleRefResponse7() { 
    
	if (http7.readyState == 4) { 
		if(http7.responseText == "wel") { window.location="http://www.stichtingsalvage.nl/zoekresultaten/"; }
	}
}

var http7 = getHTTPObject(); // We create the HTTP Object








function verleng() {
	var hoogte = document.getElementById('contentwrap').offsetHeight;
   		//alert(document.documentElement.clientHeight);
   
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
	} 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;
	}
  
   

	var hoogtev = myHeight - 225;
		
	if(hoogte < hoogtev) { 
//	if(hoogte < 400) { 
	//	document.getElementById('contentwrap').style.height = ""+hoogtev+"px";
	//	document.getElementById('contentwrap').style.height = "400px";
	}
}

function verleng2(aantal) {
	var hoogte = document.getElementById('contentwrap').offsetHeight;
   	
   
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
	} 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;
	}
  
	//alert(myHeight);

	var hoogtev = myHeight - 225;
		
//	if(hoogte < hoogtev) { 
	if(aantal == 1) {
		if(hoogte < 320) { 
			document.getElementById('contentwrap').style.height = "520px";
		}
	}
	if(aantal == 2) {
		if(hoogte < 585) { 
			document.getElementById('contentwrap').style.height = "920px";
		}
	}
}