﻿//'~/siteinfo/javascript/specific/components/biblesearch.ascx

addEvent(window, "load", initBibleSearchForm);

function initBibleSearchForm(){
	var searchForm = new BibleSearch();
}

function BibleSearch(){
	var searchForm = $('bibleSearchForm');
	var searchPostUrl = $('bibleSearchPostUrl');
	var searchKeywords = $('bibleSearchKeywords');
	var biblePart = $('biblePart');
	var bibleTranslation = $('bibleTranslation');
	var searchSubmit = $('bibleSearchSubmit');

	function ValidateForm(){
		if (searchKeywords.value.isEmpty()){
			searchKeywords.focus();
		}else{
			return true;
		}
	}
	
	function Cleanup(){
		removeEvent(window,"unload",Cleanup);
		removeEvent(searchForm, "submit", stopEvent);
		searchForm = null;
		searchPostUrl = null;
		searchKeywords = null;
		biblePart = null;
		bibleTranslation = null;
		searchSubmit = null;
	}
	addEvent(window,"unload",Cleanup);
	addEvent(searchSubmit, "click", ValidateForm);
	addEvent(searchForm, "submit", stopEvent);
}