var VIEW_HTTP = 'http://www.citotransport.nl/site/app/cito/view/v1'; var HTTP_URL = 'http://www.citotransport.nl/nl/content/base/speciaaltransport'; var LIFE_MODE = '1'; /** ** return true ** $param1 = filename ** $param2 = type (default javascript); ** $param3 = languae (default javascript) ** @desc appends a javascript to de header **/ if (navigator.appName == 'Netscape'){ var browser = "FF"; }else{ var browser = "IE" } /* function include(file, type, language) { if (!file) return false; var type = (type) ? type : 'text/javascript'; var language = (language) ? language : 'javascript'; var tag = document.createElement('script'); tag.setAttribute('src',file); tag.setAttribute('type',type); tag.setAttribute('language',language); document.getElementsByTagName('head')[0].appendChild(tag); return true; }*/ /** ** Return true als een string voorkomt in een array ** ** $param1 = string ** $param2 = array om te doorzoeken **/ function in_array(stringToSearch, arrayToSearch) { for (var s = 0; s < arrayToSearch.length; s++) { var thisEntry = arrayToSearch[s].toString(); if (thisEntry == stringToSearch) { return true; } } return false; } /** ** Set the title van een scherm ** ** $param1 = string **/ function setTitle(x) { document.title = x } /** ** Geef als parameter een string mee en geeft eerste hoofdletter een hoofdletter ** @para 1 = string ** @return = string **/ function ucFirst(x) { var firstLetter = x.substr(0,1).toUpperCase() return firstLetter + x.substr(1,x.length); } function header(x) { window.location = x; } function refresh(){ loc = document.URL.split('#'); window.location = loc[0] ; } function getEl(x) { if(document.getElementById(x) != undefined) return document.getElementById(x); else return false; } /** ** buildOverDiv() ** ** $this = object waar hij aan geappend wordt ** $sMessage = je inhoud (innerHTML) ** $sClass = classname qua css, false is leeg ** $iSeconds = aantal seconden dat hij moet blijven staan false **/ var buildOverTime = 0; function buildOverDiv(object, sMessage, sClass, iSeconds) { clearTimeout(buildOverTime); if(getEl('mouseDiv')) { removeDiv('mouseDiv'); } var oDiv = document.createElement('div'); if(!iMouseX) { iMouseX=0; iMouseY=0; } oDiv.className = sClass; oDiv.style.position = 'absolute'; oDiv.style.left = iMouseX + 10 +'px'; oDiv.style.top = iMouseY + 10 +'px'; oDiv.innerHTML = sMessage; object.onmouseout = function() { removeDiv('mouseDiv'); }; oDiv.setAttribute('id', 'mouseDiv'); oDiv.style.zIndex='99'; document.body.appendChild(oDiv); if(!isNaN(iSeconds)) { buildOverTime = setTimeout("removeDiv('mouseDiv')", iSeconds); } else { buildOverTime = setTimeout("removeDiv('mouseDiv')", 10000); } } function removeDiv(sDiv) { var oTemp = document.getElementById(sDiv); if(oTemp != null) oTemp.parentNode.removeChild(oTemp); } function scrollWindow(y) { window.scrollTo(0,y); //setTimeout('scrollWindow()', 1000); } function cb_alert(x){ alert(x); } function getDateTime() { timeObject = new Date(); var terugString = 'Tijd: '+ timeObject.getHours() +':'+ timeObject.getMinutes() +':'+ timeObject.getSeconds() +'
'; return terugString; } /** ** AJAX ** **/ var cbbDiv ='zoekResultaatDiv'; var tempDiv=''; var sType = false; var iPageId= false; var errorCount = 0 function reportError(msg,url,l){ if(errorCount < 5){ alert('Msg: ' + msg + '\nUrl: ' + url + '\nLine: ' + l); x_debug('Msg: ' + msg + '
Url: ' + url + '
Line: ' + l, function (){}); } errorCount++; } function getCheckedValue(radioObj) { if(!radioObj) return ""; var radioLength = radioObj.length; if(radioLength == undefined) if(radioObj.checked) return radioObj.value; else return ""; for(var i = 0; i < radioLength; i++) { if(radioObj[i].checked) { return radioObj[i].value; } } return ""; } var sInhoud; function maxLength(oTxt, iMax, sOverDiv, event) { iLength = oTxt.value.length; iOver = iMax - iLength; getEl(sOverDiv).innerHTML = iOver; if(iOver <= 10) { getEl(sOverDiv).style.backgroundColor = 'red'; } else { getEl(sOverDiv).style.backgroundColor = ''; } if(iLength > iMax) { getEl(sOverDiv).innerHTML = '0'; oTxt.value = oTxt.value.substring(0, iMax); return false; } else { return true; } } function maxLenggth(oTxt, iMax, sOverDiv, event) { iLength = oTxt.value.length; sInhoud = oTxt.value; iOver = iMax - iLength; getEl(sOverDiv).innerHTML = iOver; if(iOver <= 10) { getEl(sOverDiv).style.backgroundColor = 'red'; } else { getEl(sOverDiv).style.backgroundColor = ''; } if(iLength >= iMax) { oTxt.value.substring(0, iMax); return false; } else { return true; } } function checkEmail(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false } if (str.indexOf(at,(lat+1))!=-1){ return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false } if (str.indexOf(dot,(lat+2))==-1){ return false } if (str.indexOf(" ")!=-1){ return false } return true } var iCountDown=0; var iCountMax = 10; var sCountUrl=false; function initCountDown(iAantal, sUrl) { iCountMax = iAantal; sCountUrl = sUrl; setTimeout("countDown()", 1000); } function countDown() { if(iCountDown == iCountMax) { location.href=sCountUrl; } iCountDown++; setTimeout("countDown()", 1000); } function validateNum(e, oField) { /** ** Lengte van de input **/ var eInput = e || window.event; var iInputLengt = oField.value.length; var aAllowed = new Array(48,49,50,51,52,53,54,55,56,57,95,96,97,98,99,100,101,102,103,104,105,106,110,188,190); // delete, tab, pijltjes enz var aControl = new Array('null',0,8,9,13,16,17,18,27,35,36,37,38,39,40,46,116); /** ** Zet de input van je event in een var genaamd keyVar **/ var key=eInput.keyCode || eInput.which; //alert(key); /** ** Keys als control, backspace en delete toelaten ** **/ if (in_array(key, aControl)) { return true; } else if (in_array(key, aAllowed)) { return true; } return false; } function validateAlpha(e, oField) { /** ** Lengte van de input **/ var eInput = e || window.event; iInputLengt = oField.value.length; aAllowed = new Array(9,16,32,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,90,188,190,192,222); // delete, tab, pijltjes enz aControl = new Array('null',0,8,9,13,16,17,18,27,35,36,37,38,39,40,46,116); /** ** Zet de input van je event in een var genaamd keyVar **/ var key=eInput.keyCode || eInput.which; /** ** Keys als control, backspace en delete toelaten ** **/ if (in_array(key, aControl)) { return true; } else if (in_array(key, aAllowed)) { return true; } return false; } function var_dump(obj) { if(typeof obj == "object") { return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj; } else { return "Type: "+typeof(obj)+"\nValue: "+obj; } }//end function var_dump function trim(value) { value = value.replace(/^\s+/,''); value = value.replace(/\s+$/,''); return value; } function rand(n){ return ( Math.floor ( Math.random ( ) * n + 1 ) ); } function debug(x){ x_debug(x, function(){}); } function validateAlphaInput(x) { var re = new RegExp("[^A-Za-z0-9]", "g"); x.value = x.value.replace(re, ""); return; } function setFlashVar(sMovie, sFlashVar, vValue){ if(window.document[sMovie]) window.document[sMovie].SetVariable(sFlashVar, vValue); if(document.sMovie) document.sMovie.SetVariable(sFlashVar, vValue); } function copy_clip(meintext){ if (browser == "IE") { return window.clipboardData.setData("Text", meintext); } else if (browser == "FF") { // This is importent but it's not noted anywhere try{ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); }catch(e){ return false; } // create interface to the clipboard var clip = Components.classes['@mozilla.org/widget/clipboard;[[[[1]]]]'].createInstance(Components.interfaces.nsIClipboard); if (!clip) return false; // create a transferable var trans = Components.classes['@mozilla.org/widget/transferable;[[[[1]]]]'].createInstance(Components.interfaces.nsITransferable); if (!trans) return false; // specify the data we wish to handle. Plaintext in this case. trans.addDataFlavor('text/unicode'); // To get the data from the transferable we need two new objects var str = new Object(); var len = new Object(); var str = Components.classes["@mozilla.org/supports-string;[[[[1]]]]"].createInstance(Components.interfaces.nsISupportsString); var copytext=meintext; str.data=copytext; trans.setTransferData("text/unicode",str,copytext.length*[[[[2]]]]); var clipid=Components.interfaces.nsIClipboard; if (!clip) return false; clip.setData(trans,null,clipid.kGlobalClipboard); } return true; } function changeSelect(oIn) { if(oIn.checked) { oIn.checked=false; return false; } oIn.checked=true; return false; } function is_numeric(iIn){ if ((isNaN(iIn)) || (iIn.length == 0)) return false; return true; } function openCenter(sDivId){ getEl(sDivId).style.display = "block"; getEl(sDivId).style.visibility = "visible"; getEl(sDivId).style.zIndex = 20; if(browser == "FF"){ iWidth = (window.innerWidth - getEl(sDivId).offsetWidth); iHeight = (window.innerHeight - getEl(sDivId).offsetHeight); }else{ iWidth = (document.documentElement.clientWidth - getEl(sDivId).offsetWidth); iHeight = (document.documentElement.clientHeight - getEl(sDivId).offsetHeight); } if(iWidth < 0) iWidth = 0; if(iHeight < 0) iHeight = 0; getEl(sDivId).style.left = iWidth / 2 + 'px'; getEl(sDivId).style.top = iHeight / 2 + 'px'; } function hide(sId){ getEl(sId).style.visibility = 'hidden'; getEl(sId).style.display = 'none'; } function show(sId){ getEl(sId).style.visibility = 'visible'; getEl(sId).style.display = ''; } function search_table(sTable, sCellExtra, sValue){ var t = getEl(sTable); sValue = sValue.toLowerCase(); var i = 0; var even = true; for(row in t.rows){ if(i > 1){ if(t.rows[row].id != undefined){ if(t.rows[row].id.indexOf(sTable + '_') >= 0){ if(getEl(sTable + '_' + sCellExtra + '_' + t.rows[row].id.substring(sTable.length + 1)).innerHTML.toLowerCase().indexOf(sValue) < 0){ hide(t.rows[row].id); }else{ show(t.rows[row].id); if(even == true){ t.rows[row].className = 'std_row_even'; even = false; }else{ t.rows[row].className = 'std_row_oneven'; even = true; } } } } } i++; } } var sSort = 'up'; function sort_table(sTable, sCellExtra, iRow){ if(browser != 'FF') return; var t = getEl(sTable); var i = 0; var oldRows = new Array(); var toSort = new Array(); for(row in t.rows){ if(i > 1){ if(t.rows[row].id != undefined){ if(t.rows[row].id.indexOf(sTable + '_') >= 0){ oldRows[row] = new Array(); oldRows[row]['row'] = t.rows[row]; oldRows[row]['ih'] = getEl(sTable + '_' + sCellExtra + '_' + t.rows[row].id.substring(sTable.length + 1)).innerHTML; toSort[row] = getEl(sTable + '_' + sCellExtra + '_' + t.rows[row].id.substring(sTable.length + 1)).innerHTML; t.cellSpacing = '0px'; t.cellPadding = '0px'; } } } i++; } toSort.sort(); if(sSort == 'up'){ toSort.reverse(); sSort = 'dw' }else{ sSort = 'up' } var even = true; for(row in toSort){ for(row2 in oldRows){ if(oldRows[row2]['ih'] == toSort[row]) { t.appendChild(oldRows[row2]['row']); if(even == true){ oldRows[row2]['row'].className = 'std_row_even'; even = false; }else{ oldRows[row2]['row'].className = 'std_row_oneven'; even = true; } t.appendChild(oldRows[row2]['row']); } } } } function collorRows(sTable, iSkipRows){ var i= 0; var even = true; var oTable = getEl(sTable); for(row in oTable.rows){ if(i >= iSkipRows){ if(oTable.rows[row].style != undefined){ if(oTable.rows[row].style.visibility != 'hidden'){ if(even == true){ oTable.rows[row].className = 'std_row_even'; even = false; }else{ oTable.rows[row].className = 'std_row_oneven'; even = true; } } } } if(!is_numeric(oTable.rows[row])) i++; } }