function invisible(id){
	var field = document.getElementById(id);

	if(field == null)
		return;

	field.style.display = 'none';
	return;
}

function shownetnoi(id)
{
	var header = document.getElementById("netnoi" + id);
	var groups = document.getElementById("specific" + id);

	if(groups.style.display == "inline")
	{
		header.src = "/alebion/images/icons/right.png";
		groups.style.display = "none";
	} else {
		header.src = "/alebion/images/icons/down.png";
		groups.style.display = "inline";
	}

}

function showpass(id)
{
	var username = document.getElementById("username" + id);
	var password = document.getElementById("password" + id);

	username.style.visibility = "visible";
	password.style.visibility = "visible";

}

function hidepass(id)
{
	var username = document.getElementById("username" + id);
	var password = document.getElementById("password" + id);

	username.style.visibility = "hidden";
	password.style.visibility = "hidden";

}

function open_file(node,ext,mode)
{
	var file = document.getElementById(node).value;
	if(mode == 0) file = '';
	window.open('/system/tools/texteditor.php?file='+file+'&ext='+ext+'&node='+node,"tXTe","left=100,width=680,height=750,scrollbars=yes");
}

function inputselect(fieldname)
{
	var field = document.getElementById(fieldname);
	field.focus();
	field.select();
	return true;
}

var charArray = new Array(
	' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-',
	'.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
	'<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
	'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
	'X', 'Y', 'Z');

function charToByte(c)
{
	var i;
	for(i=0; i < charArray.length; i++) {
		if(c == charArray[i]) return i+32;
	}
	return 0;
}

function setclientid()
{
	var name = document.getElementById('dtname').value;
	var field = document.getElementById('dtcode');
	var letter = name.charAt(0);
	var abyte   = charToByte(letter);

	var count = alphabet[abyte];

	count = count + '';
	while(count.length < 3)
	{
		count = '0' + count;
	}
	field.value = letter + count;

}

/* note that dojo.js must be loaded before functions.js! */
function setctab(id){
	// change all other tabs to inactive
	var old = document.getElementsByTagName('a');
	for(var i=0; i<old.length; i++)
		if(old[i].className=='active') old[i].className='inactive';
	// set the one to active
	var tab = dojo.byId('tab'+id);
	tab.className='active';
}

// debugFrame Moveable
dojo.require('dojo.dnd.Moveable');
dojo.addOnLoad(function(){ var debug = new dojo.dnd.Moveable('debugFrame',{handle:'dndHandle'}) });

