var oPrev;
var Prevonmouseover;
var Prevonmouseout;

function onmouseover_A(name) {
}

function onmouseout_A(name) {
}

function onclick_A(name) {
	var O = document.getElementsByTagName('A')
	for (var i = 0;i < O.length;i++) {
			O[i].parentNode.className = 'contactmenu'
	}
	document.getElementById('A'+ name).parentNode.className = 'contactmenu_black'
}


function doToggleStichtingen(O) {
	idDivToShow = "STDIV" + O.id.substring(1,O.id.length)
	//alert(idDivToShow)
	oDivColl = document.getElementsByTagName("DIV")
	for (i=0;i<=oDivColl.length-1;i++) {
		if (oDivColl[i].id) {
			if (oDivColl[i].id.substr(0,5)=="STDIV") oDivColl[i].style.display="none"
		}
	}
	document.getElementById(idDivToShow).style.display=""
	parent.resizeIframe('dynFrame')
}

function doover(O) {
	O.style.backgroundColor='#cccdd1' 
	O.style.cursor='hand'
}
function doout(O) {
	O.style.backgroundColor='#eeeff3' 
	O.style.cursor='arrow'
}

function doclick(O,asp) {
	// de klik moet soms op de cel gezet worden
	if (O.tagName == 'TD') O = O.parentNode 
	window.location=asp + '&pid=' + O.id
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return '';
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}



function addtoShoppingCart(pid, nb,bSilent) {
	var checknb;
	if (nb.length > 0 && !isNaN(nb)) {
		if (nb == 0) {
			eraseCookie(pid);
			return;
		} else {
			createCookie(pid,nb);
		}
		checknb = readCookie(pid);
		if (bSilent==0) {
			if (nb != checknb) {
				alert('U heeft sessie cookies uit staan, helaas werkt dan de winkelwagen niet')
			} else {
				alert('U heeft nu ' + nb + ' exemplaren van dit product in uw winkelwagen');
			}
		}
	} else {
		alert('Vul a.u.b. een getal in');
	}
}



function calcTotal() {
	var oColl = document.getElementsByName('product_aantal')
	var oPrijs
	var prijsveldname
	var totaalbedrag = 0
	var prijs = 0
	var bedrag = 0
	for(var i=0;i < oColl.length;i++) {
		if (oColl[i].value) {
			//if (oColl[i].value > 0) {
				prijsveldname = 'P' + oColl[i].id.substring(2,oColl[i].id.length);
				bedragveldname = 'BEDR'+oColl[i].id.substring(2,oColl[i].id.length);
				oPrijs = document.getElementById(prijsveldname)
				prijs = oPrijs.value.replace(",",".")
				bedrag = oColl[i].value * prijs
				totaalbedrag = totaalbedrag + bedrag
				bedrag = bedrag * 100;
				bedrag = bedrag.toString();
				bedrag = bedrag.substring(0,bedrag.length-2) + "," + bedrag.substring(bedrag.length-2,bedrag.length) + "&nbsp;&euro;"
				document.getElementById(bedragveldname).innerHTML = bedrag;
				if (oColl[i].value == 0) {
					eraseCookie(oColl[i].id.substring(2,oColl[i].id.length))
				} else {
					createCookie(oColl[i].id.substring(2,oColl[i].id.length),oColl[i].value)
				}
			//}
		}
	}
	if (totaalbedrag > 0) {
		totaalbedrag = totaalbedrag * 100;
		totaalbedrag = totaalbedrag.toString();
		totaalbedrag = totaalbedrag.substring(0,totaalbedrag.length-2) + "," + totaalbedrag.substring(totaalbedrag.length-2,totaalbedrag.length) + "&nbsp;&euro;"
	} else {
		totaalbedrag = "0&nbsp;&euro;"
	}
	//alert(document.getElementById('totaalbedrag').innerHTML);
	document.getElementById('totaalbedrag').innerHTML = totaalbedrag;
	return totaalbedrag;
}
function getnbinww() {	var tot = 0;
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i].split('=');
		if (c.length == 2) {
			if  (!isNaN(c[0]) && !isNaN(c[1])) {
				//tot = tot + parseInt(c[1]);
				tot = tot + 1;
			}
		}
		
	}	
	return(tot)
}

function updateww() {
	//var ww = window.parent.document.getElementById('nbinww')
	//if (!ww) ww=window.document.getElementById('nbinww')	//var nb = getnbinww()	//ww.innerHTML = nb
}


function emptyshoppingcart() {
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i].split('=');
		if (c.length == 2) {
			if  (!isNaN(c[0]) && !isNaN(c[1])) {
				eraseCookie(c[0]);
			}
		}
		
	}
	//updateww();	
}


var bo_ns_id = 0;
function startIeFix() {
  if (isIE()) {
    document.write('<div id="bo_ns_id_' + bo_ns_id + '">x<!-- y');
  }
}
function endIeFix() {
  if (isIE()) {
    document.write('</div>');
    var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
    var theCode = theObject.innerHTML;
    //alert(theCode)
    theCode = theCode.toLowerCase()
    theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"));    //alert(theCode)
    document.write(theCode);
  }
}
function isIE() {
  // only for Win IE 6+
  // But not in Windows 98, Me, NT 4.0, 2000
  var strBrwsr= navigator.userAgent.toLowerCase();
  if (strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0) {
    if (parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6) {
      return false;
    }
    if (strBrwsr.indexOf("win98") > -1 ||
       strBrwsr.indexOf("win 9x 4.90") > -1 ||
       strBrwsr.indexOf("winnt4.0") > -1 ||
       strBrwsr.indexOf("windows nt 5.0") > -1)
    {
      return false;
    }
    return true;
  } else {
    return false;
  }
}


/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="no"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids)
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids] : document.getElementById(iframeids)
//tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller
