﻿var dotNet=new Object();
var lastdNId="";

var dNNodes=new Object();

function dNId(skip,name) {
	// finds the element with the given name and returns it
	lastdNId=lastdNId.substr(0,skip)+name;
	return document.getElementById(lastdNId);
}

function dNInit() {
	dNInitNode(dotNet);
}

function dNNode() {
	this.dNNode=true;
}

function dNRepeater(length) {
	this.dNNode=true;
	this.items=new Array(length);
	this.items.dNNode=true;
	this.items.dNArray=true;
}

function dNInitNode(node) {
	for (var childName in node) {
		if (childName!="parent" && childName!="dNNode") {
			var child=node[childName];
			if (child) {
				if (child.dNNode) {
					child.parent=node;
					dNInitNode(child);
				} else {
					dNNodes[child.id]=node;
				}
			}
		}
	}
}
function radioValue(radiobuttonlist) {
	for (var i=0; i<radiobuttonlist.length; i++) {
		var radio=radiobuttonlist[i].radio;
		if (radio.checked) {
			return radio.value;
		}
	}
}