function church_search()
{
	var form = $('search_form');
	new Ajax.Request('ajax_search.php',
	{      
		parameters: form.serialize(),
		requestHeaders: {Accept: 'application/json'},
		onSuccess: function(transport){                    
			/*var result = transport.responseText.evalJSON(true);*/
			var result = transport.responseText;
			//alert(result);
			if(result)    
			{
				if(result>1)
					str = result + ' Churches Found';
				else
					str = result + ' Church Found';
				$('total_church').update(str);
				
			}
			else
				alert("An error occurs while submitting form");
		},
		onFailure: function(){ alert('An error occurs while submitting form') }
	}
	);

}	




function CheckFieldLength(fn,wn,rn,mc) {
            var len = fn.value.length;
            if (len > mc) {
            fn.value = fn.value.substring(0,mc);
            len = mc;
            }
            document.getElementById(wn).innerHTML = len;
            document.getElementById(rn).innerHTML = mc - len;
            }
			
function order_handle(value)
{
	location.href= 'index.php?order=' + value;
}

function order_handle_buypage(value, category_id)
{
	location.href= 'buy.php?category_id=' + category_id + '&order=' + value;
}

function display_college_ministry(diplay_action)
{
	document.getElementById('college_ministry').style.display = diplay_action;
	if(diplay_action=='none')
		$('college_ministry_id').value='';
	church_search();
}	

function display_registration_form(disply_action)
{	
	if(disply_action=="website")
	{
		location.href='sell.php?listing_type=website';
	}
	else if(disply_action=="domain_name")
	{		
		location.href='sell.php?listing_type='+disply_action;	
	}
}

function menu_mouseover_effect(obj, image_title)
{
	obj.src = 'images/' + image_title;
}

function header_mouseover_effect(obj, image_title)
{
	obj.src = 'images/' + image_title;
}

function menu_mouseout_effect(obj, image_title)
{
	//alert(obj);
	obj.src = 'images/' + image_title
}

function textCheckChanged(action, action_element)
{	
	document.getElementById(action_element).disabled = !(action);	
}
		

