function retarget()
{	var linkobj = document.links;
	var hnaam = document.location.hostname;
	for (i=0; i < linkobj.length;)
	{	if(linkobj[i].hostname.indexOf(hnaam))
		{	linkobj[i].target ="_blank";
		}
		i++;
	}
}
var loc = location.pathname
var DatabasePath = loc.substr(0, loc.indexOf('.nsf')+4)
function tbButtonOvr() {
var image;
  image = event.srcElement;
  if (image.className == "buttonNor") {
    image.className = "buttonOvr";
    }
}
function tbButtonOut() {
var image;
  image = event.srcElement;
  if (image.className == "buttonOvr") {
    image.className = "buttonNor";
    }
}
function tbButtonDown() {
var image;
  image = event.srcElement;
  if (image.className == "buttonOvr") {
    image.className = "buttonPress";
    }
} 
function tbButtonUp() {
var image;
  image = event.srcElement;
  if (image.className == "buttonPress") {
    image.className = "buttonOvr";
    }
}
//background text color
function setHilite() {
  var arr = showModalDialog( DatabasePath+"/jslibs/$file/selcolor.htm?openelement",
   "", "font-family:Verdana; font-size:12; dialogWidth:35em; dialogHeight:42em" );
  if (arr != null) {
  document.forms[0].DHTMLEdit1.ExecCommand(DECMD_SETBACKCOLOR,OLECMDEXECOPT_DODEFAULT, arr);
  }
}
//Table function
function InsertTable() {
  var pVar = document.forms[0].ObjTableInfo;
  var args = new Array();
  var arr = null;
//Default waarden geven  
pVar.NumRows = 1;
pVar.NumCols = 2
pVar.TableAttrs= "border=1 cellPadding=1 cellSpacing=1 width=100%"
pVar.CellAttrs= "valign=top"
   // Display table information dialog
  args["NumRows"] = pVar.NumRows;
  args["NumCols"] = pVar.NumCols;
  args["TableAttrs"] = pVar.TableAttrs;
  args["CellAttrs"] = pVar.CellAttrs;
  args["Caption"] = pVar.Caption;
  
  arr = null;
  
  arr = showModalDialog( DatabasePath+"/jslibs/$file/instable.htm?openelement",
  args, "font-family:Verdana; font-size:12; dialogWidth:36em; dialogHeight:25em");
  if (arr != null) {
   // Initialize table object
    for ( elem in arr ) {
      if ("NumRows" == elem && arr["NumRows"] != null) {
        pVar.NumRows = arr["NumRows"];
      } else if ("NumCols" == elem && arr["NumCols"] != null) {
        pVar.NumCols = arr["NumCols"];
      } else if ("TableAttrs" == elem) {
        pVar.TableAttrs = arr["TableAttrs"];
      } else if ("CellAttrs" == elem) {
        pVar.CellAttrs = arr["CellAttrs"];
      } else if ("Caption" == elem) {
        pVar.Caption = arr["Caption"];
      }
    }
    document.forms[0].DHTMLEdit1.ExecCommand(DECMD_INSERTTABLE,OLECMDEXECOPT_DODEFAULT, pVar);  
  }
}
//Functions to open image/attachment/html windows
function imageForm() {
window.open(DatabasePath+"/webimagefile?openform" , "UploadImage" , "height=400, width=400, status");
}
function showHTML() {
window.open(DatabasePath+"/DisplayHTML?openform" , "DisplayHTML" , "height=450, width=600, status");
}
function attachForm() {
window.open(DatabasePath+"/attachment?openform" , "UploadFile" , "height=300, width=400, status");
}
//functions to get and set data
function loadEditor() {
var content = document.forms[0].Body.value;
if (content.charAt(0) == '[')
content = content.substr(1,content.length-2);
//FIND OUT CURRENT SERVER NAME AND REPLACE "../" IN URL
var svrname = location.hostname;
newstring = "http://" + svrname+DatabasePath+"/"; 
contentArray=content.split("../"); 
content=contentArray.join( newstring ) ; 
/////////// 
document.forms[0].DHTMLEdit1.DOM.body.innerHTML =
content;
document.forms[0].DHTMLEdit1.focus();
}
function submitHTML() {
var theData =
document.forms[0].DHTMLEdit1.DOM.body.innerHTML;
if (theData.charAt(0) =='<') {
var data =theData;
//REPLACE CURRENT SERVER NAME WITH "../" IN URL 
var svrname = location.hostname;
newstring = "http://" + svrname + DatabasePath+"/"; 
contentArray=data.split( newstring ); 
data=contentArray.join( "../" ) ; 
//////////// 
}
else{
var data = "<p>"+theData+"</p>"
}
var content = document.getElementById("rtStore");
content.value = "["+data+"]";
}
function insertChar(charTyp) {
	var sel = document.forms[0].DHTMLEdit1.DOM.selection;
	i = document.forms[0].elements[charTyp].selectedIndex;
	text = document.forms[0].elements[charTyp].options[i].text;
	range = sel.createRange();
	range.pasteHTML(text)
	document.DHTMLEdit1.focus();
}
function strikeThru() {
	var sel = document.forms[0].DHTMLEdit1.DOM.selection;
	range = sel.createRange();
	range.pasteHTML("<strike>" + range.htmlText + "</strike>")
	document.DHTMLEdit1.focus();
}
function superText() {
	var sel = document.forms[0].DHTMLEdit1.DOM.selection;
	range = sel.createRange();
	range.pasteHTML("<sup>" + range.htmlText + "</sup>")
	document.DHTMLEdit1.focus();
}
function subText() {
	var sel = document.forms[0].DHTMLEdit1.DOM.selection;
	range = sel.createRange();
	range.pasteHTML("<sub>" + range.htmlText + "</sub>")
	document.DHTMLEdit1.focus();
}
function hr() {
var sel = document.forms[0].DHTMLEdit1.DOM.selection;
range = sel.createRange();
range.execCommand("InsertHorizontalRule")
document.all.DHTMLEdit1.focus();
}

