if(!block_arr)
{
	var block_arr = new Array();
}
function Popup(url, target, features)
{
	var theWindow = window.open(url, target, features);
	//http://developer.mozilla.org/en/docs/DOM:window.open
	//window.open will return null on popup blocker and sort of
	if (theWindow==null)
			location.href = url;
		else if (window.focus)
			theWindow.focus();
	return theWindow;
}

/**
 * create balloon div
 * @access public
 * @return void
 **/
function CreateBalloon()
{
	var balloon = document.createElement('div');
	balloon.id = J_BALLOON;
	document.body.appendChild(balloon);
}

/**
 * show balloon. Can be called directly
 * @access public
 * @return void
 **/
function ShowBalloon(objA, x, y)
{
	gTmp_ATitle = objA.title; //preserve the title in global var
	objA.title = ''; //empty it, so that it won't popup
	var tmp_title = 'Help', tmp_desc = gTmp_ATitle, pos_colon; //safe init
	//e.g., gTmp_ATitle = 'Help: Help is a help...'
	if ((pos_colon=gTmp_ATitle.indexOf(':')) !=-1 )
		{
			tmp_title = gTmp_ATitle.substring(0, pos_colon);
			tmp_desc = gTmp_ATitle.substring(pos_colon+1);
		}
	//&#13 (new line) to <br /> conversion...Note: chr(13) is actually \r
	tmp_desc = tmp_desc.replace(/\r\n|\n|\r/g, '<br \/>');
	Element.addClassName(J_BALLOON, J_CLSBALLOON);
	Element.show(J_BALLOON);
	Element.setStyle(J_BALLOON, {width: J_BALLOONWIDTH + 'px',
								 top: y + 'px',
								 left: x + 'px'});
	$(J_BALLOON).innerHTML = '<span class="' + J_CLSBALLOONTITTLE + '">'+ tmp_title +'<\/span><div class="' + J_CLSBALLOONDESC + '">'+ tmp_desc + '<\/div>';
	return true;
}

/**
 * Hides balloon
 * @access public
 * @return void
 **/
function HideBalloon(objA)
{
	Element.hide(J_BALLOON);
	objA.title = gTmp_ATitle; //re-assign
}
function selectAll(thisForm)
	{
		for (var i=0; i<thisForm.elements.length; i++)
			{

				if (thisForm.elements[i].type == "checkbox" && thisForm.elements[i].name != 'checkall')
					{
						if(thisForm.checkall.checked)
							{
								thisForm.elements[i].checked=true;
							}
						else
							{
								thisForm.elements[i].checked=false;
							}
					}
			}
			/**/
	}
//code execution starts here...

//global vars
var gTmp_ATitle; //temp variable to hold and swap title attributes
//global constants. Used to change behaviors quickly
//presumably IE doesn't support const on strings
var J_BALLOON = 'balloon'; //balloon id
var J_CLSHELP = 'clsHelp';
var J_CLSBALLOON = 'clsBalloon';
var J_CLSBALLOONTITTLE = 'clsBalloonTittle';
var J_CLSBALLOONDESC = 'clsBalloonDesc';
var J_BALLOONPOSADJX = 10;
var J_BALLOONPOSADJY = 10;
var J_POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,width=400,height=300,top=200,left=200';
var J_POPUP_TARGET = 'help';
var J_BALLOONWIDTH = 160;

var Rules = {
   '.clsHelp:mouseover': function(element, e) {
	var posx = 0, posy = 0;
	posx = Event.pointerX(e);
	posy = Event.pointerY(e);
	//Note: using the x, y as it is cause the div to flicker in certain border points in FF (IE, Opera works fine).
	ShowBalloon(element, posx+J_BALLOONPOSADJX, posy+J_BALLOONPOSADJY);
	Event.stop(e);
   },

   '.clsHelp:mouseout': function(element, e) {
	HideBalloon(element);
   },

   '.clsHelp:click': function(element, e) {
   	Popup(element.href, element.getAttribute('target') || J_POPUP_TARGET, J_POPUP_FEATURES);
   	Event.stop(e);
   }
 }

window.onload = function()
				{
					CreateBalloon();
					EventSelectors.start(Rules);
				}