/********************************************************
Set of Global JavaScript functions for the CodeStore.net
DomBlog template
Jake Howlett, v2.1, 15/12/02 16:14
********************************************************/
/*doSearch is called from the button 
below simple query box on all forms */
function doSearch ( s ) {
	var regExp1 = /\bfield\b/i; //used to test for reserved word field in query string
	var regExp2 = /[(,),<,>,\[,\]]/; //used to test for reserved char(s) in the query string
	var str = s.value;
	if ( trim(str) == "" ){
		alert("Please be sure to enter something to search for.");
		s.focus();
		return false;
	} else {
		if ( typeof regExp1.source != 'undefined' ) //supports regular expression testing
			if ( regExp1.test( str ) || regExp2.test( str ) ){
					var alrt = "Please note that you can not include:";
					alrt += "\n\nThe reserved word 'field'\nthe characters [, ], (, ), < or >";
					alrt += "\n\nin your search query!\n\nIf you are confident that you know";
					alrt += "\nwhat you are doing, then you can\nmanually produce the URL required."
					alert( alrt );
					s.focus();
					return false;
			}
			
			location.href = "/A55C22/bibleblog.nsf/srch?SearchView&Query=" + escape( str ) + "&start=1&count=10&SearchFuzzy=True";
	}
}
//Remove leading and trailing spaces from a string
//Originally written by Jim Fricker
function trim(aStr) {
	return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "")
}
/* All code below by Jerry Carter, DatatribeSoftwerks.com */
// Keep external scripts from slowing down our page load.
function loadThese()
{
	loadExternal('http://embed.technorati.com/embed/qyxu647ai3.js','updateTechnorati');
	
}
function loadExternal(url,successCall)
{
	var myAjax = new Ajax.Updater( 'ignore',
					url, 
					{
						method: 'get', 
						onComplete: eval(successCall), 
						onFailure: reportError,
						evalScripts: true				
					});
	$('technorati').innerHTML='<script type="text/javascript" src="http://embed.technorati.com/embed/qyxu647ai3.js"></script> ';
}
function updateTechnorati(originalRequest)
{
	$('technorati').innerHTML=originalRequest.responseText;
}
