if ( Element.Methods[ 'removeChildNodes' ] == null ) {
	Element.addMethods( {
		removeChildNodes:function( ctrl ) {
			ctrl = $( ctrl );
			while ( ctrl.childNodes[ 0 ] ) {
				ctrl.removeChild( ctrl.childNodes[ 0 ] );
			}
			return ctrl;
		}
	} );
}

function teamNav() {
	var w = document.fbTeam.team.selectedIndex;
	var url_add = document.fbTeam.team.options[w].value;
	window.location.href = url_add;
}

function removeChildNodes( ctrl ) {
	while ( ctrl.childNodes[ 0 ] ) {
		ctrl.removeChild( ctrl.childNodes[ 0 ] );
	}
}

function performSearch( which ) {
	if ( document.getElementById( which + '_search_web' ).checked ) {
		document.location = 'http://search.dailyherald.com/results/web/?Query=' + document.getElementById( which + '_search_box' ).value;
	}
	else {
		document.location = 'http://search.dailyherald.com/results/news/?Query=' + document.getElementById( which + '_search_box' ).value;
	}
	return false;
}


function CaspioDataPage( appKey, protocal, args ) {
	this.appKey = appKey;
	this.protocal = protocal;
	this.host = window.location.host;
	this.pathName = window.location.pathname;
	this.search = window.location.search;

	if ( args != null ) {
		for ( var i in args ) {
			this.search += ( this.search.indexOf( '?' ) > -1 ? '&' : '?' ) + i + '=' + args[ i ];
		}
	}
	
	this.load = function( v_sK, v_sP ) {
		var v_path = this.pathName + this.search;

		if ( ( v_path.toUpperCase().indexOf( "DP.ASP?APPKEY=" ) != -1 ) || ( v_path.toUpperCase().indexOf("DP.ASP?APPSESSION=") != -1) ) { 
			document.write( "<br/><b>Error</b></br>" );
		}
		else {
			document.write( "<scri" + "pt type=\"text/javascript\" src=\"" + this.protocal + "//b2.caspio.com/dp.asp?AppKey=" + this.appKey + "&amp;js=true&amp;pathname="+ window.location.protocol + "//" + this.host + this.pathName + "&amp;" + this.search + "\"></scr" + "ipt>" );
		}
	}
}
