//Utility Functions
function getElementsByClass( className, container, tagName ) {

	if( !container ) {

		container = document;
	}

	if( !tagName ) {

		tagName = "*";
	}

	var all = container.getElementsByTagName( tagName );

	var elements = new Array();

	for( var e = 0; e < all.length; e++ ) {

		if( all[e].className.match( className ) ) {

			elements[elements.length] = all[e];
		}
	}

	return elements;
}

/** Open Link in new window **/
function popUp( url ) {

	newwindow = window.open( url, '_blank' );

	if( window.focus ) {

		newwindow.focus();
	}

	return false;
}

/** Add onblur/onfocus items to all input(text) **/
//Focus color
var setFocusColor = "#cccccc";
var setFocusBorder = "1px solid #ff0000";
//Blur color
var setBlurColor = "#ffffff";
var setBlurBorder = "1px solid #000000";

document.observe( "dom:loaded", function() {

	var elemList = $$( 'textarea' ).concat( $$( 'select' ), $$('input[type="text"]') );

	for( i = 0; i < elemList.length; i++ ) {

		elemList[i].observe( 'focus', focusOnInput ).observe( 'blur', blurOnInput );
	}
} );

function focusOnInput( e ) {

	var e = e || window.event;
	var targ = e.target || e.srcElement;

	targ.style.background = setFocusColor;
	targ.style.border = setFocusBorder;
}

function blurOnInput( e ) {

	var e = e || window.event;
	var targ = e.target || e.srcElement;

	targ.style.background = setBlurColor;
	targ.style.border = setBlurBorder;
}
