var isDOM = (document.getElementById  ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers          ? true : false);
var isDyn = (isDOM || isIE4 || isNS4);

function getRef(id) {
if (isDOM) return document.getElementById(id);
if (isIE4) return document.all[id];
if (isNS4) return document.layers[id];
}

function getSty(id) 	{ return (isNS4 ? getRef(id) : getRef(id).style); } 
function toggleDiv (id) { s = getSty(id); s.display = (s.display == 'none') ? 'block' : 'none'; }
function showDiv (id)	{ s = getSty(id); s.display = 'block'; }
function hideDiv (id)	{ s = getSty(id); s.display = 'none'; }

function askSubmit (frm, msg) 		{ if (confirm(msg)) { document.forms[frm].submit(); } }
function askConfirmation (url, msg) { if (confirm(msg)) { self.location.href = url; } }
function toggleMore (id) 			{ hideDiv (id+'Less'); showDiv (id+'More'); }

function toggleDisplay (container_id, link_id, text_on, text_off)
{
	toggleDiv (container_id);
	getRef(link_id).innerHTML = (getSty(container_id).display == 'none') ? text_on : text_off;
}

function inlineHelp (msg)
{
	alert(msg);
}

var ADORABLE = {};
ADORABLE.initDocument = function() {};
ADORABLE.removeMessage = function(msg_type) {
	$(".info" + msg_type).hide();
	$(".commonMessage").show();
};

document.getElementsByClassName = function(tag, name_of_class) 
{
	var retnode = [];
	var myclass = new RegExp('\\b'+name_of_class+'\\b');
	if (tag == '') tag = '*';
	var elem = this.getElementsByTagName(tag);
	for (var i = 0; i < elem.length; i++)
	{
		var classes = elem[i].className;
		if (myclass.test(classes)) { retnode.push(elem[i]) };
	}
	return retnode;
};

function addBookmark(title, url)
{
	if (window.sidebar) window.sidebar.addPanel(title, url,"");
	else if( document.all ) window.external.AddFavorite( url, title);
	else if( window.opera && window.print ) return true;
}
