// JavaScript Document

function addOnLoad(fn, args)
{
	var current_onload = window.onload;

	if (typeof(current_onload) != "function")
	{
		window.onload = fn;
	}
	else
	{
		window.onload = function() {
			if (current_onload) current_onload();
			fn();
		};
	}
}

function main()
{
//	alert("This is my kung fu, and it is strong.");
}
addOnLoad(main);




<!--

function popup( url )
{
	newwindow = window.open(url.href,'infopopup','height=545,width=340,resizable=no,scrollbars=yes,menubar=no,toolbar=no,status=no,location=no');
	if( window.focus )
	{
		newwindow.focus();
	}
	
	return false;
}

function PopupWindow( url, name, width, height )
{
	var left = ( screen.availWidth - width )/2;
	var top = ( screen.availHeight - height )/2;
	
	return window.open( url, name, "top=" + top + ",left=" + left + ",width=" + width + ",height=" + height + ",menubar=no,location=no,statusbar=no,toolbar=no,scrollbars=yes,resizable=yes" );	
}

//-->




// JavaScript Document

function popup(url, name, w, h, attribs)
{
	if (attribs.length>0) attribs=','+attribs;
	var t = new Date().getTime();
	window['popup_' + t] = window.open(url,'popup_' + t,'height='+h+',width='+w+''+attribs);
	return !window['popup_' + t];
}

function loadPage(url, time, replace_page)
{
	if (replace_page) window.setTimeout('window.location.replace("' + url + '");', (time*1000));
	else window.setTimeout('window.location.href = "' + url + '";', (time*1000));
}

String.prototype.trim = function() {
	return this.replace(/^\s*|\s*$/g, '');
};
String.prototype.ucwords = function() {
	return this.replace(/\b\w/gi, function(c) { return c.toUpperCase(); });
};

function pngFix()
{
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])

	if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
	{
		var images = document.images;
		for (var i=0; i<images.length; i++)
		{
			var img = images[i];
			var imgName = img.src.toUpperCase();
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
			{
				var imgID = (img.id) ? "id='" + img.id + "' " : "";
				var imgClass = (img.className) ? "class='" + img.className + "' " : "";
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
				var imgStyle = "display: block;" + img.style.cssText;
				if (img.align == "left") imgStyle = "float:left;" + imgStyle;
				if (img.align == "right") imgStyle = "float:right;" + imgStyle;
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
				var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width: " + img.width + "px; height: " + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\">&nbsp;</span>";
				img.outerHTML = strNewHTML;
				i = i-1;
			}
		}
	}
}

var css = {
	getElementsByClass : function( node, searchClass, tag ) {
		var classElements = new Array();
		var els = node.getElementsByTagName( tag );
		var pattern = new RegExp( "(^|\\s)" + searchClass + "(\\s|$)" );

		for(var i=0, j=0; i<els.length; i++)
		{
			if( this.elementHasClass(els[i], searchClass) )
			{
				classElements[j] = els[i];
				j++;
			}
		}
		return classElements;
	},

	privateGetClassArray: function( el ) {
		return el.className.split(' '); 
	},

	privateCreateClassString: function( classArray ) {
		return classArray.join(' ');
	},

	elementHasClass: function( el, classString ) {
		if ( !el ) return false;
		var re = new RegExp( '\\b' + classString + '\\b' );
		return el.className.match( re );
	},

	addClassToId: function( id, classString ) {
		this.addClassToElement( document.getElementById( id ), classString );
	},

	addClassToElement: function( el, classString ) {
		var classArray = this.privateGetClassArray( el );

		if (this.elementHasClass( el, classString) ) return;

		classArray.push( classString );

		el.className = this.privateCreateClassString( classArray );
	},

	removeClassFromId: function(id, classString ) {
		this.removeClassFromElement( document.getElementById( id ), classString );
	},

	removeClassFromElement: function(el, classString) {
		var classArray = this.privateGetClassArray( el );

		for (i in classArray)
		{
			if (classString == classArray[i])
			{
				classArray[i] = '';
				break;
			}
		}

		el.className = this.privateCreateClassString( classArray );
	}
}

// JavaScript Document

function initSecondApplicant()
{
	var cb = document.forms[0].elements["second_person"];

	cb.onclick = function() {
		toggleSecondPerson(this);
	};
}
addOnLoad(initSecondApplicant);

function toggleSecondPerson(cb)
{
	fs = document.getElementById("fieldset_applicant_two");
	if (cb.checked) css.removeClassFromElement(fs, "hidden");
	else css.addClassToElement(fs, "hidden");
}
