/* Start HB_height script 

Author: A.H. Borger
Email: borger@glovi-network.com
It's not allowed to copy or use this script without permission from the author.
Copyright protected.
*/
var iii = new Array;
var y = true;
var s = 2;
var s_s = new Array;
var oldHeight = new Array;
var ready = true;
var tlo = new Array;
var info = new Array;

function HB_height (setId, hSetMin, setSpeed) {
	if (ready === true){
		HB_set_height(setId, hSetMin, setSpeed)}
}

function HB_set_height (setId, hSetMin, setSpeed) {
	ready = false;
	d = document; p = parseInt; t = setTimeout; u = undefined; 
	
	if(u!==setId){id = setId;}
	if(u!==hSetMin){hMin = p(hSetMin);}
	if(u!==setSpeed){s = p(setSpeed);}
	if(u==s_s[id]){s_s[id]= p(setSpeed);}
	if(u === oldHeight[id]){
		oldHeight[id] = d.getElementById(id).clientHeight;
		if (hMin > oldHeight[id]){
			tlo[id] = oldHeight[id];
			oldHeight[id] = hMin;
			hMin = tlo[id];

		}
	}
	var cor = 0;
	var padding = d.getElementById(id).style.padding.split("px");
	paddingTop = d.getElementById(id).style.paddingTop.split("px");
	paddingBottom = d.getElementById(id).style.paddingBottom.split("px");
	if ('' !== paddingTop[0] || '' !== paddingBottom[0]) {cor = p(paddingTop[0]) + p(paddingBottom[0]);}
	if ('' !== padding[0]){cor = padding[0] * 2;}
	if (u !== tlo[id]){hMin = tlo[id] - cor;}
	hMax = oldHeight[id] - cor;
	
	if (u !== tlo[id] && u === iii[id]){d.getElementById(id).style.height = (hMin) + "px";}	
	else if (u === iii[id]){d.getElementById(id).style.height = (hMax) + "px";}
	tl = d.getElementById(id).style.height.split("px");
	iii[id] = p(tl[0]);
	if (iii[id] >= hMax){y = true;}
	if (iii[id] <= hMin){y = false;}	
	
	if (y==false){
		if (hMax - iii[id] < s*s){s -= 1;}
		if (oldHeight[id] - iii[id] < s){s = oldHeight[id] - iii[id];}
		iii[id] +=s;
		d.getElementById(id).style.height = (iii[id]) + "px";
		if (iii[id] < hMax){
			t('HB_set_height()',10) ;		
		} else {
			ready = true;
			d.getElementById(id).innerHTML = info[id];
			d.getElementById(id).style.height = "auto";
			info[id] = undefined;	
			iii[id] = undefined;
			s_s[id] = undefined;
			oldHeight[id] = undefined;
			tlo[id] = undefined;
			d.getElementById(id + '_but').style.background='url(tmpl/verklein.png)';}
	}

	if ( y==true){
		if (iii[id] - hMin < s*s){s -= 1;}
		if (iii[id] - hMin < s){s = iii[id] - hMin;}
		iii[id] -=s;
		d.getElementById(id).style.height = (iii[id]) + "px";
		if (iii[id] > hMin){
			t('HB_set_height()',10) ;
		}else {
			ready = true;
			info[id] = d.getElementById(id).innerHTML;

			d.getElementById(id).innerHTML = '<span onclick=HB_height(\''+(id)+'\',\''+(hMin)+'\',\''+(s_s[id])+'\') class=ond_weer>Weergeven</span>';
			d.getElementById(id + '_but').style.background='url(tmpl/vergroot.png)';}
	}	
}
/* End HB_height script */
function HB_hover(e, x) {
	if (x == undefined){
		if ((e.style.backgroundImage == '') || (e.style.backgroundImage == 'url(tmpl/verklein.png)'))
			{e.style.backgroundImage='url(tmpl/verklein_hover.png)'}
		if (e.style.backgroundImage == 'url(tmpl/vergroot.png)')
			{e.style.backgroundImage ='url(tmpl/vergroot_hover.png)'}
	}
	if (x == 1){
		if ((e.style.backgroundImage  == '') || (e.style.backgroundImage  == 'url(tmpl/verklein_hover.png)'))
			{e.style.backgroundImage ='url(tmpl/verklein.png)'}
		if (e.style.backgroundImage  == 'url(tmpl/vergroot_hover.png)')
			{e.style.backgroundImage ='url(tmpl/vergroot.png)'}	
	}
}
function uitklap (div,e) {
	if (document.getElementById(div).style.height == 'auto'){
		document.getElementById(div).style.height='0px'
		document.getElementById(e).innerHTML = "<img alt=\"\" src=\"tmpl/pro_vergroot.gif\" />";
	} else {
		document.getElementById(div).style.height='auto'
		document.getElementById(e).innerHTML = "<img alt=\"\" src=\"tmpl/pro_verklein.gif\" />";
	}
}
/* Start ajaxLoad script 

Author: A.H. Borger
Email: borger@glovi-network.com
It's not allowed to copy or use this script without permission from the author.
Copyright protected.
*/
function  toAjaxLoad(){
	getTagA = document.getElementsByTagName("A");
	for(var i=0;i<getTagA.length;i++) { 
		TagA = getTagA[i];
		if (null!==TagA.href.match("#ajax")){
			TagA.href = TagA.href.replace(/#ajax/,"");
			var urlDel =  window.location.href.split("/").reverse();
			if(null!==urlDel[0].match(".")){
				url = window.location.href.replace(urlDel[0],"");
			}else{url = window.location.href;}
			url = TagA.href.replace(url,"");
			TagA.onclick = new Function("ajaxLoad('"+(url)+"','"+(TagA.target)+"')");  
			TagA.href = "#";
			TagA.target = "";
		}
	}
}

function  PHPtoAjaxLoad(){
	getTagA = document.getElementsByTagName("A");
	for(var i=0;i<getTagA.length;i++) { 
		TagA = getTagA[i];
		if (null!==TagA.href.match("ajax=")){
			url =  TagA.href.split("ajax=").reverse();
			url[0] = url[0].replace(/&/,"?");
			TagA.onclick = new Function("ajaxLoad('"+(url[0])+"','"+(TagA.target)+"')");  
			TagA.href = "#";
			TagA.target = "";
		}
	}
}

var pU2;
var dF2;
var fI2;
var ajaxState = false;

function multiLoad(pageUrl,divField,formId,pageUrl2,divField2,formId2){
	ajaxState = true;
	pU2 = pageUrl2;
	dF2 = divField2;
	fI2 = formId2;
	ajaxLoad(pageUrl,divField,formId);	
}

function  ajaxLoad(pageUrl,divField,formId,bck){
	if(undefined!==formId) {
		if(''!==formId){
			var postData = true;
			getValues();
		}
	}
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	} 

	xmlHttp.onreadystatechange=stateChanged;
	document.getElementById(divField).innerHTML = 'Laden...';
	if (undefined !== postData){
		xmlHttp.open("POST", pageUrl, true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		xmlHttp.send(postData);
	} else {
		xmlHttp.open("GET", pageUrl, true);	
		xmlHttp.send(null);
	}
	
	
	function GetXmlHttpObject(handler){ 
		var objXMLHttp=null
		if (window.XMLHttpRequest){
			objXMLHttp=new XMLHttpRequest()
		}
		else if (window.ActiveXObject){
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
		return objXMLHttp
	}
	
	function stateChanged(){ 
	   if (xmlHttp.readyState==4) {
		  if(xmlHttp.status == 200){ 
			document.getElementById(divField).innerHTML=xmlHttp.responseText ;
			toAjaxLoad();
			PHPtoAjaxLoad();
			if (bck !== true){
					dsHistory.addFunction(function() {ajaxLoad(pageUrl,divField,formId,true)});
			}
			if(ajaxState==true){
				ajaxState = false;
				ajaxLoad(pU2,dF2,fI2);
				pU2 = false;
				dF2 = false;
				fI2 = false;
			}
		  } 
		  else {
			alert("Deze pagina bestaat mogelijk (nog) niet." + xmlHttp.status);
		  }
	   }
	} 
	
	function getValues(){
		var getInputs	=	document.getElementById(formId).getElementsByTagName("input");
		var getTextAreas=	document.getElementById(formId).getElementsByTagName("textarea");
		var getSelects	=	document.getElementById(formId).getElementsByTagName("select");
		var k = 0
		for(var k=0;k<getInputs.length;k++) { 
			var input = getInputs[k];
			if(input.type=='text'){
				inputValue = escape(input.value);
			}
			else if(input.type=='file'){
				alert("ajaxLoad 2.0 doesn't support: file fields.");
			}
			else if(input.type=='radio'){
				if(input.checked==true){
					inputValue = escape(input.value);
				}
			}
			else if(input.type=='checkbox'){
				if(input.checked==true){
					inputValue = escape(input.value);
				} else {
					inputValue = '';
				}
			}else if(input.type =='submit'){
				inputValue = true;
			}else if(input.type =='textarea'){
				inputValue = escape(input.innerHTML);alert(input.innerHTML);
			}else{
				inputValue = escape(input.value);
			}
			
			if (k == 0){
				postData = input.name +"=" + inputValue;
			} else {
				postData += "&" + input.name +"=" + inputValue;
			}

		}
		for(var i=0;i<getTextAreas.length;i++) { 
			var textArea = getTextAreas[i];
			textAreaValue = escape(textArea.value);
			
			if (k == 0){
				postData = textArea.name +"=" + textAreaValue;
			} else {
				postData += "&" + textArea.name +"=" + textAreaValue;
			}
		}
		for(var i=0;i<getSelects.length;i++) { 
			var Selects = getSelects[i];
			selectsValue = escape(Selects.value);
			
			if (k == 0){
				postData = Selects.name +"=" + selectsValue;
			} else {
				postData += "&" + Selects.name +"=" + selectsValue;
			}
		}
	}	
}
/* End ajaxLoad script*/

function openBigImg (e){
	document.getElementById('photo_show_real').src=e; 
	document.getElementById('extra').style.visibility='visible';
	document.getElementById('extra2').style.visibility='visible';
}

function openNormalImg (photo){
	document.getElementById('div_foto').innerHTML = "<img style=\"cursor:pointer;\" onclick=\"openBigImg('../pro_img/big/" + (photo) + "');\"  src=\"../pro_img/medium/" + (photo) + "\" alt=\"\" border=\"0\" />";
}
