// GRACEWAY SEARCH EVENT HANDLING


//<div class="CenterPreview">
//<div style="z-index: 1000;" class="DownloadTag">
//
//<img width="6" height="21" src="gfx/DLTagEnd.png" class="DownloadTagEnd">
//<h5></h5>
//<img src="gfx/DLTagCap.png" class="DownloadTagCap" >
//
//</div>
//
//<a href=""><div class="POBox">
//<div style="top: 431px; left: 573px; display: none;" class="ProductOverlay">
//<img src="images/composite/00019911_thumb.jpg" class="ProductPreviewStyle"></img>
//</div></div>
//</a>
//
//<img src="/images/medium/00019911.jpg" class="ProductImage">
//<div class="FooterTab"><div class="thumb_title"><a href="" class="thumb_link"></a></div>
//
//<div class="thumb_description">Happy Birthday!</div>
//<div class="FooterFooter">
//<div class="DownloadInput">
//<form class="DownloadDropDownForm" action="/" method="get">
//<div id="download_form_19911"  class="SnowBall">
//<input type="hidden" value="download" name="page">
//<select id="" style="width: 77px;" class="DownloadDropDown">
//<option>Download</option>
//<optgroup style="text-shadow: none;" label="Images Packs">
//<option value="Wide">Widescreen</option>
//<option value="zip">Standard</option>
//</optgroup>
//<optgroup style="text-shadow: none;" label="PowerPoints">
//<option value="text">As Shown</option>
//<option value="notext">Title Only</option>
//<option value="blank">Blank</option>
//</optgroup>
//</select>
//
//<div class="DownloadButtons">
//<a onclick="JavaScript:return download();" style="cursor: pointer;" title="Download" class="DownloadBtn"></a>
//<a onclick="JavaScript:return retitle(19911, 3778);" href="/?page=customize_selection&amp;sermon_id=19911" title="Retitle" class="RetitleBtn"></a>
//<a onclick="JavaScript:return BookmarkIt();" style="cursor: pointer;" title="Bookmark" class="BookmarkBtn"></a>
//</div>
//</div>
//</form>
//</div>
//</div>



$(document).ready(function() {
	

	$('.KeywordKill').click (function () {
	
	var WhatDelete;
	WhatDelete = $(this).html();		
	$('.'+ WhatDelete  +'').remove(); 	
	$(this).remove();
	return false;
});
	
	
$('.SearchBoxInput').click(function (){  $(this).val('')  });
	
$('.SearchBoxInput').bind('keypress', function(e) {
	
$('.KeywordKill').click (function () {
	
	var WhatDelete;
	WhatDelete = $(this).html();		
	$('.'+ WhatDelete  +'').remove(); 	
	$(this).remove();
	return false;
});

$('.KeywordSearch').click(function (){  $(this).val('')  });


	
    if(e.keyCode==13){
		
		
		function GetResults () {
	
		   $.getJSON('/SiteSearchFunction/PHP/GetSearch.php?KeywordID=' + KeywordValue + '', function(data){
				var html = '';
				var len = data.length;
				for (var i = 0; i< len; i++)
				{
			   		html += '<h2 class="'+ KeywordValue +'">' + data[i].sermon_title + '</h2>';
				
				
				}
			   $('#BigDiv').append(html);
			});	
	
	};	
           
		var KeywordValue;	
		KeywordValue = $('.SearchBoxInput').val();	   
		$('#homecontent').remove ();
		$('#BigDiv').css('border','1px solid #ccc');
		$('#BigDiv').css('height','100%');
	
		GetResults();
		
		$('#side_nav_keywords').show();
		
		$('<a class="KeywordKill">'+ KeywordValue +'</a>').appendTo('#KeywordsUsed');	   

    
	

	
	
		return false;	
}

   
  

});
});
	



$(document).ready(function() {
$('.KeywordSearch').bind('keypress', function(b) {
	
$('.KeywordKill').click (function () {
	
	var WhatDelete;
	WhatDelete = $(this).html();		
	$('.'+ WhatDelete  +'').remove(); 	
	$(this).remove();
	return false;
});
	
	
if(b.keyCode==13){


var KeywordInputValue;	
KeywordInputValue = $('.KeywordSearch').val();

 $.getJSON('/SiteSearchFunction/PHP/GetSearch.php?KeywordID=' + KeywordInputValue + '', function(data){
			  var html = '';
			  var len = data.length;
			  for (var i = 0; i< len; i++)
			  {
				  html += '<h2 class="'+ KeywordInputValue +'">' + data[i].sermon_title + '</h2>';
			  
			  
			  }
			 $('#BigDiv').append(html);
		  });	
  


$('<a class="KeywordKill">'+ KeywordInputValue +'</a>').appendTo('#KeywordsUsed');

		
  
  

return false;}
});
});




function searchEnter (){}
	
	
	


	
	
	

	
	
