	<!DOCTYPE html>
	<html>
	<head>
	

	<script>

	/*
	TOOLTIP
	*/

	$( function()
	{
	var targets = $( '[rel~=tooltip]' ),
	target	= false,
	tooltip = false,
	title	= false;

	targets.bind( 'mouseenter', function()
	{
	target	= $( this );
	tip		= target.attr( 'title' );
	tooltip	= $( '<div id="tooltip"></div>' );

	if( !tip || tip == '' )
	return false;

	target.removeAttr( 'title' );
	tooltip.css( 'opacity', 0 )
	.html( tip )
	.appendTo( 'body' );

	var init_tooltip = function()
	{
	if( $( window ).width() < tooltip.outerWidth() * 1.5 )
	tooltip.css( 'max-width', $( window ).width() / 2 );
	else
	tooltip.css( 'max-width', 340 );

	var pos_left = target.offset().left + ( target.outerWidth() / 2 ) - ( tooltip.outerWidth() / 2 ),
	pos_top	 = target.offset().top - tooltip.outerHeight() - 20;

	if( pos_left < 0 )
	{
	pos_left = target.offset().left + target.outerWidth() / 2 - 20;
	tooltip.addClass( 'left' );
	}
	else
	tooltip.removeClass( 'left' );

	if( pos_left + tooltip.outerWidth() > $( window ).width() )
	{
	pos_left = target.offset().left - tooltip.outerWidth() + target.outerWidth() / 2 + 20;
	tooltip.addClass( 'right' );
	}
	else
	tooltip.removeClass( 'right' );

	if( pos_top < 0 )
	{
	var pos_top	 = target.offset().top + target.outerHeight();
	tooltip.addClass( 'top' );
	}
	else
	tooltip.removeClass( 'top' );

	tooltip.css( { left: pos_left, top: pos_top } )
	.animate( { top: '+=10', opacity: 1 }, 50 );
	};

	init_tooltip();
	$( window ).resize( init_tooltip );

	var remove_tooltip = function()
	{
	tooltip.animate( { top: '-=10', opacity: 0 }, 50, function()
	{
	$( this ).remove();
	});

	target.attr( 'title', tip );
	};

	target.bind( 'mouseleave', remove_tooltip );
	tooltip.bind( 'click', remove_tooltip );
	});
	});

	</script>
	</head>
	<body>

	<?php
	$policeweapon = $_GET['policeweapon'];
	$servername = "localhost";
	$dbuser = "root";
	$dbpass = "root";
	$dbname = "deadly_force";
	$year2016='2016';
	try {
	$conn = new PDO("mysql:host=$servername;dbname=$dbname", $dbuser, $dbpass,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
	// set the PDO error mode to exception
	$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	//check if victim name exists in the database
	$sthandler = $conn->prepare("select * from police_killings where year(date_of_incident)=:year2016 and police_weapon=:policeweapon");
	$sthandler->bindParam(':year2016', $year2016);
	$sthandler->bindParam(':policeweapon', $policeweapon);
	$sthandler->execute();
	$victims = $sthandler->fetchAll();
	//return $sthandler->rowCount();
	echo "<div id='getvictimcount'>".$sthandler->rowCount()." record(s) found."."<span class='searchby'>You searched by police weapon used: <b>$policeweapon</b></span>"."</div>";
	foreach ($victims as $row) {
	$gender=$row['victim_gender'];
	if($gender=='M'){
	$icon='images/male.png';
	$gender="Male";}
	elseif($gender=='F'){
	$icon='images/female.png';
	$gender="Female";}
	else{
	$icon='images/unknown.png';}
	$incident_date=date_create($row['date_of_incident']);
	echo '<a title="'.
	'<div class=\'victim_names\'>'.'<span class=\'label label-danger\'>'.$row['victim_names'].'</span>'.'</div>'.
	'<div class=\'incident_date\'>'.'<span class=\'label label-default\'>'.'Date killed: '.date_format($incident_date,"F d, Y").'</div>'.'</div>'.
	'<div class=\'parentmid\'>'.//begin middle div
	'<div class=\'midleft\'>'.//begin image div
	'<img src=\''.$row['imagepath'].'\'>'.
	'</div>'.//end image div
	'<div class=\'midright\'>'.//begin midright div
	'<div class=\'victim_gender\'>'.$gender.'</div>'.
	'<div class=\'victim_age\'>'.'Age: '.$row['victim_age'].'</div>'.
	'<div class=\'incident_county\'>'.$row['incident_county_or_town'].' county'.'</div>'.
	'<div class=\'victim_armed\'>'.'Victim armed/unarmed: '.$row['victim_armed_unarmed'].'</div>'.
	'<div class=\'victim_occupation\'>'.'Occupation: '.$row['victim_occupation'].'</div>'.
	'<div class=\'police_weapon\'>'.'Police weapon used: '.$row['police_weapon'].'</div>'.
	'<div class=\'officer_involved\'>'.'<span class=\'label label-primary\'>'.'Officer(s) identified: '.$row['officer_involved'].'</span>'.'</div>'.
	'<div class=\'case_status\'>'.'Status of the case: '.$row['status_of_case'].'</div>'.
	'</div>'.//end midright div
	'</div>'.//end middle div
	'<div class=\'incident_summary\'>'.$row['incident_summary'].'</div>'.'"rel="tooltip">'.
	'<div id="victim_tile"><img src="'.$icon.'">'.'</div>'.
	'</a>';	
	}
	}
	catch(PDOException $e)
	{
	echo "error" . "<br>" . $e->getMessage();
	}
	$recordsfound=$sthandler->rowCount();
	$conn = null;
	?>
	</body>
	</html>