﻿// JScript File
// Impede Seleção
document.onselectstart = function() { return false; }
    
// Menu Lateral
if (document.getElementById){
	document.write('<style type="text/css">\n')
	document.write('.options{display: none;}\n')
	document.write('</style>\n')
}

function clk(that,id,url) {
	//if (document.all) {
		//document.all.error.innerHTML='';
		//document.all.error.style.display='none';
	//}
	if (document.navform.itemid.value > 0){
		var elem= 'm' + document.navform.itemid.value
		if (document.all) document.all.className='option';
		//['m' + document.myform.itemid.value]
		if (document.getElementById) {
			var el = document.getElementById(elem)
			if(el) el.className='option';
		}
	}
	var ref = document.getElementsByTagName('A')
	var x = 0
	while (x  < ref.length){
		if (ref[x].className=='optionselected'){ref[x].className='option'}
		x += 1
	}
	that.className='optionselected';
	document.navform.itemid.value= id;
	return;
	if (target=='top') { 
		top.location.href=url;
		return;
	}
	
	if (target=='self') {
		self.location.href=url;
		return;
	}
		
	if (target=='left')	{
	if (!top.main.frames.left) {
		errm('left frame not found');
		return
		}
		else
			top.main.frames.left.location.href=url;
			return
	}
	
	if (target=='right'){
		if (!top.main.frames.right) {
			errm('right frame not found');
			return
		}
		else
			top.main.frames.right.location.href=url;
			return
	}
	
	if (target=='popup'){
		window.open(url,'popup','resizable,width=400,height=600,scrollbars=yes');	
		return
	}

	if (target=='' || target == null) {target='main'};
	if (!top[target]){
		errm(target + ' not there');
		return;
	}
	top[target].location.href=url; 
}

function errm(t) {
	if (document.all){
		document.all.error.innerHTML='message: '+ t;
		document.all.error.style.display='block';
		document.all.error.className='option';
	}
}

// var admin = <% if session("admin") then response.write "1" else response.write "0" %>
//var editmode =  <% if session("editmode") then response.write "1" else response.write "0" %>
var admin=0
var editmode=0
//   ##############  SIMPLE  BROWSER SNIFFER
if (document.layers) {navigator.family = "nn4"}
if (document.all) {navigator.family = "ie4"}
if (window.navigator.userAgent.toLowerCase().match(/gecko/)) {navigator.family = "gecko"}
if (window.navigator.userAgent.toLowerCase().indexOf('opera') != -1) {navigator.family	= 'opera';}

function expandall() {
if(document.getElementById){
	var ar = document.getElementsByTagName('ul')
	for (var i = 0; i < ar.length; i++) {
		ar[i].style.display = "block";
    }
    }
}

var item = 0;

function swap(obj,depth){
    var el = document.getElementById(obj);
    if (!el) { return };
    var ar = document.getElementById("masterdiv").getElementsByTagName("ul");
    if (el.style.display != "block") {
		for (var i=0; i < ar.length; i++){
		    if (ar[i].className == "optionsdiv")
		    jQuery('#' + ar[i].id).hide('slow');
			//ar[i].style.display = "none";
		}
		//el.style.display = "block";
		el.style.clear = "both";
		el.style.float = "none";
		jQuery('#' + obj).show('slow')
} else {
    jQuery('#' + obj).hide('slow');
	//el.style.display = "none";
	}
}

function link(url1,url2){
	if (!document.getElementById('m' + document.navform.itemid.value)) return false
	document.getElementById('m' + document.navform.itemid.value).className = 'option';
	ar = document.getElementsByTagName('div')
	for (var i=0; i < ar.length; i++){
		if (ar[i].link){
			//als url identiek is aan link parameter
			if (ar[i].lnk.toLowerCase()== url1 || ar[i].lnk.toLowerCase() == url2){
				//klapt menu uit indien dat al niet het geval was
				//if (document.getElementById(ar[i].parent)) {
					if (document.getElementById(ar[i].parent).style.display =="none") {SwitchMenu(ar[i].parent)};
				//}
				//kleurt de te selecteren optie
				ar[i].className='optionselected';
				document.navform.itemid.value = ar[i].id.replace('m','');
			}
		}
	}
}

var clsName = ''

function out(that,i) {
//	if (document.getElementById("itemid").value!=i && clsName!=''){that.className = clsName}
	hideTip();
//	clsName = '';
}

function mover(that,tt) {
//	clsName = that.className
//	if (clsName!='optionselected') {that.className='optionhover'};
	if (tt!='') {doTooltip(that,tt)};
}


