// increase/decrease comment lines
function tekstLines(number)
{
        rows = document.getElementById('tekst').rows;
        newrows = rows + number;
        if(newrows >= 5 && newrows <= 30)
        {
                document.getElementById('tekst').rows = newrows;
        }
}
function confirmverwijder(sendUrl){
     if (confirm('Wil je dit item echt verwijderen?')) {
          document.location = sendUrl;
     }
}
function doBlink() {
	var blink = document.all.tags("BLINK")
	for (var i=0; i<blink.length; i++)
		blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""
}
function startBlink() {
	if (document.all)
		setInterval("doBlink()",1000)
}
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
function newAjax(type, url) {
    var xmlhttp = false;
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest;
    } else if (window.ActiveXObject) {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    if (url.indexOf("?") == -1) {
        url += "?time=" + (new Date).getTime();
    } else {
        url += "&time=" + (new Date).getTime();
    }
    xmlhttp.open(type, url, true);
    return xmlhttp;
}

function initTreeview() {
    treeObj = new JSDragDropTree();
    treeObj.setTreeId('menu_treeview');
    if(document.location.href.indexOf('quicklink=flashadmin') != -1){
    	treeObj.setMaximumDepth(1);
    }else{
    	treeObj.setMaximumDepth(2);
    }
    treeObj.setMessageMaximumDepthReached('Sub links hier niet mogelijk'); // If you want to show a message when maximum depth is reached, i.e. on drop.
    treeObj.initTree();
    treeObj.expandAll();
}
function start() {
  externalLinks();
  startBlink();
  if(document.getElementById('menu_treeview') != undefined){
		initTreeview();
	}
}
function hideshow(obj)
{
	if(obj != null)
	{
		if(obj.style.display == "none")
		{
			//show
			obj.style.display = "block"
		}else{
			//hide
			obj.style.display = "none";
		}
	}else{
		alert('error');
	}
}
function expandcollapse (postid) {

   whichpost = document.getElementById(postid);

   if (whichpost.className=="postshown") {
      whichpost.className="posthidden";
   }
   else {
      whichpost.className="postshown";
   }
}
function hideshow_feedback(feedbackID)
{
	var tblIntro = document.getElementById(feedbackID+'_intro');
	var tblFull = document.getElementById(feedbackID+'_full');
	if(tblIntro != null && tblFull != null)
	{
		if(tblIntro.style.display == "none")
		{
			//show
			tblIntro.style.display = "block"
			tblFull.style.display = "none";
		}else{
			//hide
			tblIntro.style.display = "none";
			tblFull.style.display = "block";
		}
	}else{
		alert('error '+feedbackID);
	}
}
window.onload = start;