
function setupLoginForm() {
	$each($$('form.newuser'), function(el) {
		$each(el.getElementsByTagName('input'), function(myInput) {
			if (myInput.type == "radio" && myInput.name == "scKey") {
				myInput.onclick = function() {
					updateLoginText(myInput.value);
				}
			}
		});
	});
}

function updateLoginText(id) {
	addrCopy = $('address-copy');
	$each(addrCopy.getElementsByTagName('span'), function(mySpan) {
		mySpan.style.display = 'none';
	});
	copyId = 'addr-copy-' + id;
	$(copyId).style.display = "inline";
}


// nav tabs
function setupTabs() {

	tabs = getElementsByClass("tab");
	for (i=0;i<tabs.length;i++) {	
		tabs[i].onmouseover = function() {
			this.className='tab over';
		}
		tabs[i].onmouseout = function() {
			this.className='tab';
		}
	}
	tabsActive = getElementsByClass("tab active");
	for (i=0;i<tabsActive.length;i++) {
		tabsActive[i].onmouseover = function() {
			this.className='tab over';
		}
		tabsActive[i].onmouseout = function() {
			this.className='tab active';
		}
	}	
}

function setupToolTips() {
	if (window.ie6 || window.ie7) {	
		// give each table a lower z-index than the previous one.  this will prevent tool
		// tips from showing up underneath the table below
		//tables = document.getElementsByTagName('table');
		//$each(tables, function(el, index) {
		//	el.style.zIndex = 20 - index;
		//});

		setToolTips('a.tt');
		setToolTips('a.info');
	}
}

function setToolTips(tagClass) {
	$each($$(tagClass), function(el, index) {
		el.onmouseover = function() {
			mySpan = this.getElementsByTagName('span');
			mySpan[0].style.display = "block";
			this.style.zIndex = 90;
		}
		el.onmouseout = function() {
			mySpan = this.getElementsByTagName('span');
			mySpan[0].style.display = "none";
			this.style.zIndex = 80;
		}
			
	});
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp('(^|\\\\s)'+searchClass+'(\\\\s|$)');
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	if (classElements.length > 0) {
		return classElements;
	} else {
		return false;
	}
}
	
