
String.prototype.ltrim=function(){return this.replace(/^ */,"");}
String.prototype.rtrim=function(){return this.replace(/ *$/,"");}
String.prototype.trim=function(){return this.ltrim().rtrim();}
function clearTitel(strHelp){
self.status='';
return true;
}
function setTitel(strHelp,myObj){
myObj.title=strHelp;
self.status=strHelp;
return true;
}
function fullTrim(strIn){
var rw=new String();
rw=strIn.replace(/[^a-zA-Z0-9]/gi,"");
return rw;
}
function leadingZero(intIn){
return(intIn.toString().length==1)?("0"+intIn.toString()):intIn;
}
function toIntDef(intIn,intDef){
var rw=new Number();
rw=parseInt(intIn);
if((rw=="")||(isNaN(rw))||(rw=="undefined")){rw=intDef;}
return parseInt(rw);
}
function toStrDef(strIn,strDef){
var rw=new String();
rw=strIn;
if((rw==undefined)||(rw=="undefined")||(rw=="")){rw=strDef;}
return rw.toString();
}
function toInt(intIn){
var rw=new Number();
rw=parseInt(intIn);
if((rw=="")||(isNaN(rw))||(rw=="undefined")){rw=0;}
return parseInt(rw);
}
function toStr(strIn){
var rw=new String();
rw=strIn;
if((rw==undefined)||(rw=="undefined")||(rw=="")){rw="";}
return rw.toString();
}
function toggle(name,img){
if(document.getElementById(name)){
var el=document.getElementById(name);
el.style.display=el.style.visibility=='visible'||el.style.visibility==''?'none':'inline';
el.style.visibility=el.style.visibility=='visible'||el.style.visibility==''?'hidden':'visible';
document.getElementById(img).src=el.style.visibility=='visible'||el.style.visibility==''?'./images/imgImplode.gif':'./images/imgExplode.gif';
}
}
function toggleExplode(sName,img,sScriptname){
if(document.getElementById(sName)){
var el=document.getElementById(sName);
el.style.display=el.style.visibility=='visible'||el.style.visibility==''?'none':'inline';
el.style.visibility=el.style.visibility=='visible'||el.style.visibility==''?'hidden':'visible';
sName=jsCleanUpString(sName,"0123456789");
if(el.style.visibility=='hidden'){
parent.frmMenu.arrToggle[sScriptname][sName]="0";
}else{
	if(undefined !== parent)
		if(undefined !== parent.frmMenu)
			parent.frmMenu.arrToggle[sScriptname][sName]="1";
}
document.getElementById(img).src=el.style.visibility=='visible'||el.style.visibility==''?'./images/imgImplode.gif':'./images/imgExplode.gif';
}
}
function jsToggleAllNiveaus(sScriptname){
if(parent.frmMenu.arrToggle[sScriptname]['toggleAll']){
var toggleAll=parent.frmMenu.arrToggle[sScriptname]['toggleAll'];
}else{
parent.frmMenu.arrToggle[sScriptname]['toggleAll']=false;
var toggleAll=false;
}
var divs=document.getElementsByTagName('div');
for(var i=0;i<divs.length;i++){
if(divs[i].id.indexOf('toggle')==0){
divs[i].style.display=(toggleAll)?'none':'inline';
divs[i].style.visibility=(toggleAll)?'hidden':'visible';
sName=jsCleanUpString(divs[i].id,"0123456789");
parent.frmMenu.arrToggle[sScriptname][sName]=(toggleAll)?0:1;
}
}
var imgs=document.getElementsByTagName('img');
for(var i=0;i<imgs.length;i++){
if(imgs[i].id.indexOf('imgToggle_')==0){
imgs[i].src=toggleAll?'./images/imgExplode.gif':'./images/imgImplode.gif';
}
}
toggleAll=!toggleAll;
parent.frmMenu.arrToggle[sScriptname]['toggleAll']=toggleAll;
}
function jsValidateField(el,type){
var strValue=document.getElementById(el).value.trim();
var rw=false;
if(type=="postcode"){
rw=(strValue.replace(/[0-9]{4}\s{0,1}[A-Z]{2}/i,"x")=="x")?true:false;
}else if((type=="radio")||(type=="checkbox")){
arrTemp=document.getElementsByName(el);
for(i=0;i<arrTemp.length;i++){
if(arrTemp[i].checked){
return true;
}
}
}else if(type=="email"){
rw=(strValue.replace(/^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/,"x")=="x")?true:false;
}else if(type=="telefoon"){
strValue=jsCleanUpString(strValue,"0123456789");
rw=(strValue.length==10)?true:false;
}else if(type=="telefoon_international"){
strValue=jsCleanUpString(strValue,"0123456789");
rw=(strValue.length==11)?true:false;
}else if(type=="alpha_num"){
rw=(strValue.replace(/^[a-zA-Z]+$/,"x")=="x")?true:false;
}else if(type.substr(0,3)=="num"){
var strLen=type.substr(3,type.length-3);
strValue=jsCleanUpString(strValue,"0123456789");
if(strLen!=""){
rw=(strValue.length==parseInt(strLen))?true:false;
}else{
document.getElementById(el).value=strValue;
rw=(strValue.length>0)?true:false;
}
}else if(type.substr(0,4)=="text"){
var intLen=toInt(type.substr(4,type.length-4));
if(intLen>0){
rw=(strValue.length>=intLen)?true:false;
}else{
rw=(strValue.length>0)?true:false;
}
}else if(type=="select"){
rw=(strValue>0)?true:false;
}else if(type=="picture"){
if((strValue.length)>0){
var ArrPicture=new Array('jpg','png','gif');
for(i=0;i<ArrPicture.length;i++){
if(strValue.toLowerCase().indexOf(ArrPicture[i])!=-1){
rw=true;
}
}
}else{
return true;
}
}else if(type=="tmce"){
var editor_id=tinyMCE.getEditorId(el);
var inst=tinyMCE.getInstanceById(editor_id);
var content=tinyMCE.getContent(editor_id);
content=content.replace("&nbsp;"," ");
content=content.replace(/^\s+|\s+$/,"");
if(content.length>0){
return true;
}else{
inst.contentWindow.focus();
return false;
}
}
if(!rw){
if(type!="select"){
document.getElementById(el).select();
}
document.getElementById(el).focus();
}else{
}
return rw;
}
function jsCleanUpString(strInput,validChars){
var rw=strInput;
var error=0;
for(i=0;i<rw.length;i++){
c=rw.charAt(i);
if(validChars.indexOf(c)==-1){
rw=replace(rw,c,"");
i--;
}
}
return rw;
}
function replace(string,text,by){
var strLength=string.length,txtLength=text.length;
if((strLength==0)||(txtLength==0))return string;
var i=string.indexOf(text);
if((!i)&&(text!=string.substring(0,txtLength)))return string;
if(i==-1)return string;
var newstr=string.substring(0,i)+by;
if(i+txtLength<strLength)
newstr+=replace(string.substring(i+txtLength,strLength),text,by);
return newstr;
}
function changeURL(url,sTarget){
var firefox=document.getElementById&&!document.all;
if(sTarget=='top'){
top.location.href=url;
}else if(sTarget!=''){
if(firefox){
this.document.location.href=url;
}else{
myFrame=findFrame(top,sTarget);
window.myFrame.location.href=url;
}
}else{
this.document.location.href=url;
}
}
function doRedirect(link){
changeURL(link,'');
}
function jsOpenURL(sURL,sWindowName,sParameters){
var iWidth=700;
var iHeight=700;
var intXwin=(toIntDef(parent.screenLeft,5)-5+((toIntDef(document.body.offsetWidth,1024)-iWidth)/2));
var intYwin=((toIntDef(parent.screenTop,22)-22)+((toIntDef(parent.document.body.offsetHeight,728)-iHeight)/2));
var sParameters=(sParameters==null)?('width='+iWidth+', height='+iHeight+', left='+(screen.width-iWidth)/2+', top='+(screen.height-iHeight)/2):sParameters;
REFWindow=window.open(sURL,sWindowName,sParameters);
REFWindow.focus();
}
function findFrame(f,name){
if(f.name==name)return f;
for(var i=0;i<f.frames.length;i++){
var result=findFrame(f.frames(i),name);
if(result)return result;
}
}
function jsChangeImage(_obj,_img){
var _index=_obj.selectedIndex;
var _item=_obj[_index].value;
var tempImage=new Image();
tempImage.src="../include/thumb.php?img="+_item;
document.images[_img].src=tempImage.src;
}
function jsPrint(strIn){
myFrame=findFrame(top,strIn);
myFrame.focus();
myFrame.print();
}
function jsToggleDiv(strGroupName){
var collection=document.getElementsByTagName('div');
var status=document.getElementById('togglevar').className;
document.getElementById('togglevar').src=(status=="explode")?'./images/imgImplodeAll':'./images/imgExplodeAll';
document.getElementById('togglevar').className=(status=="explode")?'implode':'explode';
for(i=0;i<collection.length;i++){
id=collection[i].getAttribute("id");
if(id.indexOf(strGroupName)!=-1){
document.getElementById(id).style.display=(status=="implode")?'none':'inline';
document.getElementById(id).style.visibility=(status=="implode")?'hidden':'visible';
}
}
for(i=0;i<collection.length;i++){
name=collection[i].getAttribute("name");
if((name!=undefined)&&(name.indexOf('spanItemTitel_')!=-1)){
var arrImage=name.split("_")
imageid=toStrDef("img"+arrImage[1],"");
document.getElementById(imageid).src=(status=="explode")?'./images/imgImplode.gif':'./images/imgExplode.gif';
}
}
}
function showDatePickerFuture(strFormField,myDate,e){
myDp=window.open('../include/datepicker.php?future=1&leegKnop=1&field='+strFormField+'&datum='+myDate+'','windp','toolbar=no,fullscreen=no,location=no,scrollbars=no,resizable=no,menubar=no,status=no,width=315,height=262,top='+(e.screenY-121)+',left='+(e.screenX-137)+';');
myDp.focus();
}
document.getElementsByClassName=function(searchFull){
var elsAll=document.getElementsByTagName("*");
var searchSplit=searchFull.split(" ");
var elsMatch=new Array();
for(var i=0;i<elsAll.length;i++){
var teller=0;
for(var j=0;j<searchSplit.length;j++){
var pattern=new RegExp("(^|\\s)"+searchSplit[j]+"(\\s|$)");
if(pattern.test(elsAll[i].className)){
teller++;
}
}
if(teller==searchSplit.length){
elsMatch[elsMatch.length]=elsAll[i];
}
}
return elsMatch;
}
function in_array(needle,haystack){
for(var i=0;i<haystack.length;i++){
if(haystack[i]==needle){
return true;
}
}
return false;
}
function insertFlash(id,movie,width,height,bgcolor){
if(!bgcolor)bgcolor="#ffffff";
document.write('<object type="application/x-shockwave-flash" id="'+id+'" data="'+movie+'" width="'+width+'" height="'+height+'">');
document.write('<param name="movie" value="'+movie+'" />');
if(bgcolor=="transparent"){
document.write('<param name="wmode" value="transparent" />');
}else{
document.write('<param name="bgcolor" value="'+bgcolor+'" />');
}
document.write('</object>');
}
function functie(s_value,s_id){
var s_field=document.getElementById(s_id);
if(s_field)s_field.value=s_value;
}
function insertAfter(newElement,targetElement){
var parent=targetElement.parentNode;
if(parent.lastchild==targetElement){
parent.appendChild(newElement);
}else{
parent.insertBefore(newElement,targetElement.nextSibling);
}
}
