﻿if (document.location.href == top.location.href && 1==2) {
    if (document.location.href.indexOf('http://localhost') == -1 && document.location.href.indexOf('default.aspx') == -1 && document.location.href.indexOf('default3.aspx') == -1 && document.location.href.indexOf('defaultweb.aspx') == -1 && document.location.href.indexOf('.htm') == -1 && document.location.search.indexOf('guid=') == -1) { top.location.href = '/default.aspx' }
}

function doTooltip(evt,txt) {
    if (txt=='') return false;
    var tip = '<table class=\"tip\"><tr><td>' + txt  + '<\/td><\/tr><\/table>'

    // for Netscape 4+
    if (document.layers) {
	    document.tooltip.document.write(tip)
	    document.tooltip.document.close()
	    document.tooltip.left = evt.pageX + 8
	    document.tooltip.top = evt.pageY + 8
	    document.tooltip.visibility = "show"
    }
    // for IE 4+	
    if (document.all) {
 	    document.all.tooltip.innerHTML = tip
 	    document.all.tooltip.style.pixelLeft = event.clientX+document.body.scrollLeft+15
 	    document.all.tooltip.style.pixelTop = event.clientY+document.body.scrollTop -7
 	    document.all.tooltip.style.visibility = "visible"
 	    document.all.tooltip.style.display="block"
     }
    //try{new Rico.Effect.Round('table','tip')}catch(e){}
}

function hideTip() {
if (document.layers) {document.tooltip.visibility = "hide"}
if (document.all) {document.all.tooltip.style.visibility = "hidden"}
}

function showtext(element,text) {
	if (document.layers) {
		document(element).document.write(text);
		document(element).document.close();
	}
	if (document.all) {
	 	document.all(element).innerHTML = text;
	}
}

function go(link, target) {
  if (target == '') {
	  self.location=link;
	} else {
	  top.open(link, target);
	}
}
//----------------------------------------------------------------------
function redirect(url, target, time) {
 if (time > 0) {
    document.write("U wordt over " +time+ " seconden doorverwezen");	  
 }
 link = go(url,target);
 self.setTimeout(link, (time*1000));
}


// browser test:
bName = navigator.appName;             
bVer = parseInt(navigator.appVersion);
browserVer = 2;
if      (bName == "Netscape" && bVer >= 3) browserVer = 1;

function Popup(info,width,height,scrollbar){
//if scrollbar=='' {
//scrollbar='no'
//}
//+scrollbar+
popup=window.open(info,'toelichting','resizable,width='+width+',height='+height+',scrollbars='+scrollbar);
//
if (browserVer == 1) popup.focus();
}

//------------------------------------------------------------------------------
function handleerror(routine,action,params,message) {
    var url = '/webos_net/ajax/handleerror.ashx?routine=' + routine + '&action=' + action + '&params=' + params + '&message=' + encodeURIComponent(message) + '&ts=' + new Date;
    $.get({url:url});
}

function BookmarkPage (sLink, sDescription) {
window.external.addFavorite(sLink, sDescription)
}  

//maakt kleuren in tabelrijen
function filltr(){
    var c = 1;
    var t = document.getElementsByTagName("TABLE").length
    if (t==0) return;
    var tbl = document.getElementsByTagName("TABLE").item(t-1)
    var rows = tbl.getElementsByTagName("TR");
    var row;
	for ( r = 1 ; r < rows.length ; r ++) {
		row = rows.item(r);
		if (c == 1) { c = 2; }
		else {c = 1;}
		if (row.className == '') row.className = "rij_" + c;
        }
} 

function help(keyword){
window.open('/webos_net/popup.aspx?action=display_help&trefwoord=' + keyword,'help','width=230,height=300,resizable=1,toolbar=0'); 
}

// opent correcte link vanaf permissiebalk
function go_edit(url,target){
	if (target=='popup') {
		window.open(url,'popup','width=400,height=350,resizable=yes,scrollbars=1,top=20,left=20');
	}
	if(target=="hidden"){
	    if (!top.hidden) return false
	    window.open(url, 'hidden');
	    return false;
	}

	try {
		if (parent.location.pathname=='/webos_net/viewtab.aspx') {
			document.location.href = url
		}
	}
	catch(e) {alert(e.message)}

	if (top.main) {
		document.location.href = url
	}
    //window.open(url,'main');
	document.location.href = url
}

// routines voor het handlen van lijsten
//sorteren en filteren
function sort(sort,dir){
	document.forms[0].sortfield.value = sort
	document.forms[0].sortdirection.value = dir
	document.forms[0].submit()
}

function filter(field,v){
alert(field + v);
document.location.href='view.aspx?name=' + template + '&filterfield=' + field + '&filter=' + v
}

//hoveren over lijst
var cl=''
function hover(that){cl = that.className;that.className='hover'}
function hout(that){that.className=cl}
var ihtml;
var cur_searchfield = "";
var cur_ihtml = "";
var display = false;

// strip HTML
function striphtml(id){
	if (!document.getElementById(id)){alert('id not found: ' + id);return}
	var inp = document.getElementById(id).innerHTML
	try {
	var outp = inp.replace(/(<([^>]+)>)/ig,"")
	}
	catch(e)
	{
	alert('error stripping HTML: ' + e.description)
	}
	document.getElementById(id).innerHTML = outp
} 

function doBlink() {
  if (!document) { return false;}
  if (!document.all) {return false;}
  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() {
  // Make sure it is IE4
    if (!document.all){return false}
    if (document.all.tags("BLINK").length==0) {return false}
    setInterval("doBlink()",1000)
}

if (window.attachEvent){window.attachEvent('onload', startBlink);}

function stripHTML(inp) {
    inp = inp.replace(/&(lt|gt);/g, function (strMatch, p1) {
        return (p1 == "lt") ? "<" : ">";
    });
    return inp.replace(/<\/?[^>]+(>|$)/g, "");
}


