var CURRENT_TAB = null;
var CURRENT_DIV = null;

function nothingAtEnter(e)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
     {
		return false;
	}
}

function highlight(node) {
	var form = document.getElementById("form")
	if (form) {
		for (var i = 0; i < form.childNodes.length; i++) {
			var child = form.childNodes[i]
			if (child.nodeType == 1 && child.nodeName == "DIV") {
				child.className = ""
			}
		}
	}
	node.className = "selected"
}

function toggle(name, link) {
	ua = navigator.appName
	var e = document.getElementById(name)
	if (e) {
		if (e.style.display == 'none') {
			e.style.display = (ua == 'Microsoft Internet Explorer' ? 'block' : 'table-row')
		} else {
			e.style.display = 'none'
		}
	}
}

function showTab(tab, div) {
	
	var t = document.getElementById(tab)
	var d = document.getElementById(div)

	CURRENT_TAB = t
    CURRENT_DIV = d
	
	if (t != null && d != null) {
		
		if (CURRENT_TAB != null) {
			CURRENT_TAB.className =''
		}
		
		t.className = 'selected'
		CURRENT_TAB = t
		
		if (CURRENT_DIV != null) {
			CURRENT_DIV.style.display = 'none'
		}
	
		CURRENT_DIV = d
		d.style.display = "block"
	
	} else {
	
		alert("Tab '" + tab + "' or div '" + div + "' not found")
	}
}

// Executes javascript in div's with a class that is named javascript.
// This is a workaround for Telerik RAD editor that sometimes fails to
// have JavaScript. Requires jquery-1.3.1.min.js or newer version of
// jQuery that is added in PageBase.cs.
$(function()
{
	$('.javascript').each(function (i)
	{
		eval(this.innerHTML);
	});

});
