// JavaScript Document

document.getElementsByClassName=function(classname){
	var pattern=new RegExp("(^|\s*)"+classname+"(\s*|$)");
	var results=new Array();
	var d=document.getElementsByTagName('*'), l=d.length;
	for (var k=0; k<l; k++) if (pattern.test(d[k].className)) results.push(d[k]);
	return results;
}

function main()
{
	// give the first item of the form focus
	if (typeof(formFocusFirst)=="function") formFocusFirst();

	// initialise the forms to highlight the <label>s onfocus
	if (typeof(initHighlightableForm)=="function") initHighlightableForm();

	// initialise the dropdown for the adverse credit section of the form
	if (typeof(initAdverseCretit)=="function") initAdverseCretit();

	// initialise the quotes table to highlight rows onmouseover/click
	if (typeof(initHighlightableRow)=="function") initHighlightableRow();
	
	// set all links with rel="external" to window.open()
	hookExternalLinks();
}

window.onload = main;