function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}

function toggle() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.display = ($(arguments[i]).style.display != 'none' ? 'none' : '' );
	}
}

var togglers = {
	init : function() {
		addEvent($('controller'),'click',this.run);
	},
	run : function() {
		toggle('permanent_address');
	}
}

function returnObjById( id )
{
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}

function twoCols(src, type) {
	var origList = src;
	
	var leftList = document.createElement(type);
	var rightList = document.createElement(type);
	var container = document.createElement('div');
	
	var items = origList.getElementsByName('li');
	
	var itemsLength = items.length;
	var maxLength = 5;
	
	for (i = 0; i < maxLength; i++) {
		leftList.appendChild(items[i]);
	}
	
	for (i = maxLength; i < itemsLength; i++) {
		rightList.appendChild(items[0]);
	}
	container.appendChild(leftList);
	container.appendChild(rightList);
	
	leftList.setAttribute('class', 'left');
	rightList.setAttribute('class', 'right');
	container.setAttribute('class','twocol');
	
	if (document.all) {
		leftList.setAttribute('className', 'leftCol');
		rightList.setAttribute('className', 'rightCol');
		container.setAttribute('className','twocol');
	}
	
	if (type == 'ol') {
		rightList.setAttribute('start', leftList.getElementsByTagName('LI').length + 1 );
	}
	
	origList.parentNode.replaceChild(container, origList);
}
