// JavaScript Document

function MM_reloadPage(init) {
  if (init == true)
	with (navigator) {
 	  if ((appName == 'Netscape') && (parseInt(appVersion) == 4)) {
		document.MM_pgW = innerWidth;
		document.MM_pgH = innerHeight;
		onresize = MM_reloadPage;
	  }
	}
	else if ((innerWidth != document.MM_pgW) || (innerHeight != document.MM_pgH)) location.reload();
}
MM_reloadPage(true);


function saveScreenDimensions() {
  cookieStr = screen.width+"x"+screen.height;
  var expdate = new Date();
  fixCookieDate(expdate);
  expdate.setTime(expdate.getTime() + (365*24*60*60*1000));
  setCookie("screendimensions", cookieStr, expdate);
}
saveScreenDimensions();

function setLanguage(lang) {
  var expdate = new Date();
  fixCookieDate(expdate);
  expdate.setTime(expdate.getTime() + (365*24*60*60*1000));
  setCookie("languagecookie", lang, expdate);
  document.location = "home.php";
}

function replaceText(e,v) {
  var o = e.childNodes[0]
  while (o.childNodes.length > 0) {
    o = o.childNodes[0]
  }
  o.nodeValue=v;
}


var openTR = false;
function swapTableRow(TR) {	
    var cRow = getCookie("cataloguerow");
	if (cRow) openTR = cRow;
	elemTR = document.getElementById(TR);
	if (openTR) {
		elemOpenTR = document.getElementById(openTR);
		elemOpenTR.style.display = "none";
	}
	elemTR.style.display = ""; 
	openTR = TR;
    var expdate = new Date();
    fixCookieDate(expdate);
    expdate.setTime(expdate.getTime() + (365*24*60*60*1000));
    setCookie("cataloguerow", TR, expdate);  	
}

function showImage(id, source, width, height) {
  var Properties = "toolbar=no,location=no,directories=no,status=no,hotkeys=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width="+width+",height="+height;
  URL="showimage.php?source="+source+"&id="+id;
  window.open(URL,"imageWindow",Properties);
}

function showInspiration(product, images) {
  if (images > 1) {
     width  = 800;
     height = 600;
	 scrollbars = "yes";
	 resizable = "yes";	 
  }
  else {
     width  = 600;
     height = 600;	 	 
	 scrollbars = "no";
	 resizable = "no";	 	 
  }
  var Properties = "toolbar=no,location=no,directories=no,status=no,hotkeys=no,menubar=no,scrollbars="+scrollbars+",resizable="+resizable+",copyhistory=no,width="+width+",height="+height;
  URL="voorbeelden.php?product="+product;
  window.open(URL,"exampleWindow",Properties);
}

function showRoute() {
  var Properties = "toolbar=no,location=no,directories=no,status=no,hotkeys=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=800,height=681";
  URL="route.php";
  window.open(URL,"imageWindow",Properties);
}
