function openPopUp(sUrl, iWidth, iHeight, sTarget)
{
if (typeof(sTarget)=="undefined") sTarget = "content";
windowOpen(sUrl, sTarget, "top=50,left=50,toolbar=0,height="+ iHeight +",width="+iWidth+",resizable=1,scrollbars=1",false);
}
function windowOpenPrintPreview(sUrl)
{
return(windowOpen(sUrl, 'PrintPreview','left=100,top=100,height=550,width=700,resizable=1,scrollbars=1'));
}
function windowOpenExportPreview(sUrl)
{
return(windowOpen(sUrl, 'ExportPreview','top=20,left=20,height=200,width=300,resizable=1,menubar=1'));
}
function windowClose()
{
parentFocus();
window.close();
}
function windowRefresh(_bDontCloseChildren)
{
bDontCloseChildren = _bDontCloseChildren;
try { window.document.location.reload(true); } catch(e) { window.document.location.replace(window.document.location.href); }
}
function windowReplace(sUrl)
{
window.document.location.replace(sUrl);
}
function parentFocus()
{
try { window.opener.focus(); } catch(e) {}
}
function parentRefresh()
{
try {
window.opener.windowRefresh();
} catch(e) {
try {
window.opener.location.reload(true);
} catch(e) {}
}
}
function parentCall(sCmd)
{
try {
eval('window.opener.' + sCmd +';');
} catch(e) {}
}
var _aSpRowStyle = new Array();
function SetClassName(item, name, classname)
{
_aSpRowStyle[name] = item.className;
item.className = classname;
}
function ResetClassName(item, name)
{
item.className = _aSpRowStyle[name];
}
function Round(fVal, iDecimals)
{
iShift = Math.pow(10, iDecimals);
return (Math.round(fVal*iShift) / iShift);
}
function search_nextPage(pname, sURL, iLastIndex)
{
eval('var iPageNr=parseInt('+pname+'_iPageNr);');
eval('var sIndices='+pname+'_sIndices;');
sPageIndex = (iPageNr+1) + '@' + iLastIndex;
sRegEx = '/' + iPageNr + '@/';
iPos = sIndices.search(sRegEx);
if (iPos != -1)
sIndices = sIndices.substr(0, iPos) + ':';
else
sIndices += ':';
sIndices += sPageIndex;
sURL += ((sURL.search(/\?/) == -1) ? "?" : "&");
var sPagePar = pname+'_PageNr='+(iPageNr+1);
var sIndPar = '&'+pname+'_Indices='+sIndices;
var sSearchPar = '&'+pname+'_Search=2';
document.location = sURL+sPagePar+sIndPar+sSearchPar;
}
function search_prevPage(pname, sURL)
{
eval('var iPageNr=parseInt('+pname+'_iPageNr);');
eval('var sIndices='+pname+'_sIndices;');
sURL += ((sURL.search(/\?/) == -1) ? "?" : "&");
var sPagePar = pname+'_PageNr='+(iPageNr-1);
var sIndPar = '&'+pname+'_Indices='+sIndices;
var sSearchPar = '&'+pname+'_Search=2';
document.location = sURL+sPagePar+sIndPar+sSearchPar;
}
function trim(s) {
return ltrim(rtrim(s));
}
function ltrim(s) {
while (s.length > 0 && s.charAt(0) == ' ')
s = s.substr(1, s.length);
return s;
}
function rtrim(s) {
while (s.length > 0 && s.charAt(s.length - 1) == ' ')
s = s.substr(0, s.length - 1);
return s;
}
function nl2br(s)
{
re = /\n/g;
return s.replace(re, '
');
}
function noPopUp(e)
{
var message="Copyright '2009 - Schildersverf.nl'";
if(e.button == 2) {
alert(message);
return false;
}
}
function OpenWizard(pname, sParams, sWndName, bUpdateParent)
{
var iUpdate = ((typeof(bUpdateParent)=="undefined" || !bUpdateParent) ? 0 : 1);
var base = (pname.substr(0, 3)=="wiz") ? "/wizards/" + pname.substr(3).toLowerCase() +".html" : "documentviewer.html?sDocName=" + pname;
var sep = base.indexOf("?")==-1 ? "?" : "&";
if (sParams!="" && sParams.substr(0, 1) != "&") { sParams = "&" + sParams; }
windowOpen(base + sep + "bUpdateParent="+iUpdate+"&variant=1&new=1" + sParams
, sWndName,"left=300,top=300,height=530,width=660,resizable=1,scrollbars=0"
);
}
function confirmDelete(title)
{
if (typeof(title)=="string" && title!="")
title = " ("+ title +") ";
return confirm("Weet u zeker dat u dit item"+title+" wilt wissen?");
}
function showPropInfo(prop, val, showval)
{
var param = (prop==0) ? "val="+val : "prop="+prop;
if (typeof(showval) != "undefined" && showval)
param += "&showval=1";
openPopUp("/pages/propinfo.html?variant=popup&"+param, 400, 400, "info");
}
var _aReq = new Array();
function getReqObj()
{
var req = false;
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
try {
req.overrideMimeType('text/xml');
} catch (e) {}
} else if (window.ActiveXObject) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e1) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
}
}
}
return req;
}
function fillListItemsXml(id, val, clear) {
if (_aReq[id].readyState!=4) return;
if (_aReq[id].status != 200) return;
var oList = document.getElementById(id);
if (clear) {
while (oList.options.length > 0) {
oList.remove(0);
}
}
var oNodeList = _aReq[id].responseXML.getElementsByTagName("items").item(0);
if (oNodeList == null) return;
oNodeList = oNodeList.childNodes;
var checkVal = (typeof(val) != 'undefined' && val!=null);
for (var i=0; i < oNodeList.length; i++) {
var node = oNodeList.item(i);
var oOpt = document.createElement("OPTION");
oOpt.value = node.getAttribute("id");
oOpt.text = unescape(node.getAttribute("caption"));
if (checkVal && val==oOpt.value) {
oOpt.selected = true;
}
oList.options.add(oOpt, i+1);
}
_aReq[id] = "ok";
}
function asyncGetXmlItems(id, cbf, type, val, page)
{
if (typeof(_aReq[id])=="string" && _aReq[id]=="ok") return;
if (!val) val = "1";
if (!page) page = "/pages/getxml.html";
_aReq[id] = getReqObj();
_aReq[id].onreadystatechange = cbf;
_aReq[id].open("GET", page+"?"+type+"="+val, true);
_aReq[id].send(null);
}
function FloatUS2NL(sString, iDecimals)
{
return FormatFloat(sString, iDecimals, ',');
}
function FormatFloat(fValue, iDecimals, sSep)
{
var fValue = parseFloat(fValue);
if ( isNaN(fValue) )
return "";
if (typeof(sSep) == "undefined")
sSep = ".";
fValue += 0.0001;
var sValue = fValue.toFixed(iDecimals).toString();
return sValue.replace(/\./, sSep);
}
String.prototype.htmlEntities = function()
{
var chars = new Array ("&","à","á","â","ã","ä","å","æ","ç","è","é",
"ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô",
"õ","ö","ø","ù","ú","û","ü","ý","þ","ÿ","À",
"Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë",
"Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö",
"Ø","Ù","Ú","Û","Ü","Ý","Þ","€","\"","ß","<",
">","¢","£","¤","¥","¦","§","¨","©","ª","«",
"¬","","®","¯","°","±","²","³","´","µ","¶",
"·","¸","¹","º","»","¼","½","¾");
var entities = new Array ("amp","agrave","aacute","acirc","atilde","auml","aring",
"aelig","ccedil","egrave","eacute","ecirc","euml","igrave",
"iacute","icirc","iuml","eth","ntilde","ograve","oacute",
"ocirc","otilde","ouml","oslash","ugrave","uacute","ucirc",
"uuml","yacute","thorn","yuml","Agrave","Aacute","Acirc",
"Atilde","Auml","Aring","AElig","Ccedil","Egrave","Eacute",
"Ecirc","Euml","Igrave","Iacute","Icirc","Iuml","ETH","Ntilde",
"Ograve","Oacute","Ocirc","Otilde","Ouml","Oslash","Ugrave",
"Uacute","Ucirc","Uuml","Yacute","THORN","euro","quot","szlig",
"lt","gt","cent","pound","curren","yen","brvbar","sect","uml",
"copy","ordf","laquo","not","shy","reg","macr","deg","plusmn",
"sup2","sup3","acute","micro","para","middot","cedil","sup1",
"ordm","raquo","frac14","frac12","frac34");
newString = this;
for (var i = 0; i < chars.length; i++)
{
myRegExp = new RegExp();
myRegExp.compile(chars[i],"g")
newString = newString.replace (myRegExp, "&" + entities[i] + ";");
}
return newString;
}
function getDateFieldHTML(id, name, value)
{
if (!value) value = "";
return "
";
}
function allowDigits(e) {
if (allowKeys(e, /\d/)) {
return true;
}
if (!e) e = window.event;
var code=e.keyCode? e.keyCode : e.charCode;
return (code>=96 && code<=105);
}
function allowKeys(e, regex) {
if (!e) e = window.event;
var code=e.keyCode? e.keyCode : e.charCode;
if (code==8 || code==9 || code==13 || code==27 || code==46 || code==67 || code==88) {
return true;
}
return String.fromCharCode(code).match(regex) != null;
}
function ajaxPostForm(form, callback) {
var postStr = "";
for (var i=0; i