
		
function searchNews(str){
	
	var getURL = 'ajax_bloglist.php?&keywords='+str;
	$('ajax_loader').setProperty('html','<img src="/img/ajax_loader.gif" border="0" />');
	var getHTML = new Request.HTML({update:$('blog'),evalScripts:true,onComplete:function(){
		$('ajax_loader').setProperty('html','');
	}}).get(getURL);
}

function filterBlog(a,b,c){
		//b might need to be different since this is ajax
		//var getURL = 'ajax_bloglist.php?' +b +'&filter='+a.value;
		var getURL = 'ajax_bloglist.php?&filter='+a.value;
	
		if(a.value!=""){
			$('ajax_loader').setProperty('html','<img src="/img/ajax_loader.gif" border="0" />');
			var getHTML = new Request.HTML({update:$('blog'),evalScripts:true,onComplete:function(){
				$('ajax_loader').setProperty('html','');
			}}).get(getURL);
		}
}

function getNews(getURL){
		$('ajax_loader').setProperty('html','<img src="/img/ajax_loader.gif" border="0" />');
		var getHTML = new Request.HTML({update:$('blog'),evalScripts:true,onComplete:function(){
			$('ajax_loader').setProperty('html','');
		}}).get(getURL);
}

function downloadPDF(file){
	//alert(file);
	window.open("/force_download.php?file=_files/" +file);
}

function submitMailingList(){
	var c1 = $('check_church').get('value');
	var c2 = $('check_general').get('value');
	var evalid =0;
	var eval = $('email').get('value');
	
	if(eval.trim()==""){
		evalid = 1;
	}
	if((c1!="on") && (c2!="on")){
		evalid = 2;
	}
	
	//if errors do this
	if(evalid == 0){
		
		var dataObj = {email2:eval,church:c1,general:c2};
		 var signup = new Request({url:'emailSubmit.php',method:'get',data:dataObj,onSuccess:function(t){
					if(t=="success"){
						$('listErrors').setProperty('html','');
						$('ebox').setProperty('html','');
						$('echecks').setProperty('html','');
						res = "Successfully Subscribed!";
						$('eprompt').setProperty('html',res);
					}else{
						$('listErrors').setProperty('html','Invalid email address');
					}
				
					
		 }}).send();
		
		
	}else if(evalid==1){
		$('listErrors').setProperty('html','Invalid email address');
	}else{
		$('listErrors').setProperty('html','Please choose a category');
	}
}


function submitComments(){
	var n = $('contact_name').get('value');
	var e = $('contact_email').get('value');
	var p = $('contact_phone').get('value');
	var c = $('contact_body').get('value');
	var checkers = new Array(n,e,p,c);
	var valid = true;
	checkers.each(function(a){
		if(a=="") valid =false;
	});
	//look for "on" value
	
	//if errors do this
	if(valid==false){
		$('commentsErrors').setProperty('html','Complete Required Fields');
	}else{	
			var dataObj = {method:'contact.sendComments',from_email:e,from_name:n,from_comments:c,from_phone:p};
			
			 var send = new Request({url:'rest.php',method:'get',data:dataObj,onSuccess:function(t){
					$('commentsErrors').setProperty('html','');
					$('cprompt').setProperty('html','Your comment was submitted and will be reviewed shortly');
					$('cbox1').setProperty('html','');
					$('cbox2').setProperty('html','');
					$('cbox3').setProperty('html','');
					$('cbox4').setProperty('html','');
			 }}).send();
		//submit to email thing 
	}
}


