<?php
include("connection.php");
global $menu, $sidebar, $display, $show, $alert;	

$slider="
	<!--slider starts-->
	<div id=\"sliderFrame\" style=\"background:url('css/d.jpg');margin-top:5%;\">
	        <div id=\"slider\">
	            <img src=\"images/image1.jpg\" />
				<img src=\"images/image2.jpg\">
				<img src=\"images/image3.jpg\">
	        </div>
	        <!--Custom navigation buttons on both sides-->
	        <div class=\"group1-Wrapper\">
	            <a onclick=\"imageSlider.previous()\" class=\"group1-Prev\"></a>
	            <a onclick=\"imageSlider.next()\" class=\"group1-Next\"></a>
	        </div>
	        <!--nav bar-->
	        <div style=\"text-align:center;padding:20px;z-index:20;\">
	            <a onclick=\"imageSlider.previous()\" class=\"group2-Prev\"></a>
	            <a id='auto' onclick=\"switchAutoAdvance()\"></a>
	            <a onclick=\"imageSlider.next()\" class=\"group2-Next\"></a>
	        </div>
	    </div>
			<!--slider ends-->
	";
$sidebar='
	<div class="nav">
		<ul>
			<a href="index.php?menu=1"><li><img src="images/emergency.png" alt="Ebola emergency"/><p>The Ebola Emergency</p></li></a>
			<a href="index.php?menu=2"><li><img src="images/know.jpg" alt="About Ebola"/><p>About the Disease</p></li></a>
			<a href="index.php?menu=3"><li><img src="images/transmitted.jpg" alt="How Ebola is Transmitted"/><p>How is it Transmitted?</p></li></a>
			<a href="index.php?menu=4"><li><img src="images/prevention.jpg" alt="Ebola Prevention and avoidance"/><p>How it can be Prevented and Avoided?</p></li></a>
			<a href="index.php?menu=5"><li><img src="images/symptom.jpg" alt="Symptoms of EBola"/><p>What are its Symptoms?</p></li></a>
			<a href="index.php?menu=6"><li><img src="images/treatment.jpg" alt="Ebola Treatments"/><p>What are the known Treatments?</p></li></a>
			<a href="index.php?menu=7"><li><img src="images/FAQ.jpg" alt="Questions and Answers on Ebola"/><p>FAQs</p></li></a>
			<a href="index.php?menu=8"><li><img src="images/download.jpg" alt="Download files on Ebola"/><p>Downloads</p></li></a>
			<a href="index.php?menu=9"><li><img src="images/otherlinks1.jpg" alt="Download files on Ebola"/><p>Other Ebola sites</p></li></a>
		</ul>
	</div>
	';
	/*faqs function*/
	function faq($table){
	$alert="";
	$getFaq=mysql_query("SELECT* FROM $table") or die(mysql_error());
	if(mysql_num_rows($getFaq)>0){
		$alert.="<center class=\"banner\">More questions and answers on EBOLA</center>";
	while($infoFaq=mysql_fetch_array($getFaq)){
	$alert.="
	<div> 
	<p class=\"prospective_program_list\">$infoFaq[question] </p>
	<p class=\"details2\">".nl2br($infoFaq['answer']) ."</p>
	</div>
	";
	}
	}
	else{
	$alert.="<center class=\"alert\">Ebola FAQs Not Available </center>";
	}
	return $alert;
	}

if(isset($_GET["menu"])){
	$menu=$_GET["menu"];
	$sidebar="";
	$show="";
	$check=mysql_query("SELECT * FROM ebola")or die(mysql_error());
	if(mysql_num_rows($check)>0){
		$sidebar.="<center class=\"title\">Quick Links</center>";
		$sidebar.="<ul class=\"side\">";
		while($info2=mysql_fetch_array($check)){
			$sidebar.="<a href=\"index.php?menu=$info2[id]\"><li>$info2[title]</li></a>";
		}
		$sidebar.="</ul>";
	}
	/*ebola faqs*/
	if($menu==7){
		$display="";
		$display.=faq("faqs");
	}
	
	/*other ebola downloads*/
	else if($menu==8){
		$display="";
		$result=mysql_query("SELECT * FROM downloads")or die(mysql_error());
		if(mysql_num_rows($result)>0){
			$display.="<center class=\"banner\">EBOLA download files</center>";
			$display.="<ul class=\"download\">";
			while($info=mysql_fetch_array($result)){
				$display.="<a href=\"downloads/$info[link]\" target=\"_blank\"><li><img src=\"images/pdf.png\"/>$info[title]</li></a>";
			}
			$display.="</ul>";
		}
		else{
			$display.="<center class=\"alert\">no downloads found!!!</center>";
		}
	}
	
	/*link to other ebola websites*/
	else if($menu==9){
		$display="";
		$display.="
			<ul class=\"other\">
		<a href=\"http://www.cdc.gov/vhf/ebola/\" target=\"_blank\"><li><img src=\"css/pix/cdc_logo.gif\" alt=\"\"/><p>Center for Disease Control and Prevention</p></li></a>
		<a href=\"http://www.forbes.com/sites/davidkroll/2014/12/03/emory-to-receive-ebola-exposed-american-health-care-worker-from-west-africa/\" target=\"_blank\"><li><img src=\"css/pix/forbes_logo.gif\" alt=\"\"/><p>Forbes</p></li></a>
		<a href=\"http://ebola.thelancet.com/?elsca1=Ebola_Google_PPC&elsca2=PPC\" target=\"_blank\"><li><img src=\"css/pix/lancet_logo.gif\" alt=\"\"/><p>The Lancet</p></li></a>
		<a href=\"http://www.doctorswithoutborders.org/our-work/medical-issues/ebola\" target=\"_blank\"><li><img src=\"css/pix/medecins_logo.png\" alt=\"\"/><p>Doctors Without Borders</li></a>
		<a href=\"http://www.michigan.gov/emergingdiseases/0,4579,7-186-69879---,00.html\" target=\"_blank\"><li><img src=\"css/pix/michigan_logo.gif\" alt=\"\"/><p>Michigan Emerging Disease Issues</p></li></a>
		<a href=\"https://www.osha.gov/SLTC/ebola/\" target=\"_blank\"><li><img src=\"css/pix/usd_logo.gif\" alt=\"\"/><p>United States Department of Labour</p></li></a>
		<a href=\"http://www.who.int/csr/disease/ebola/en/\" target=\"_blank\"><li><img src=\"css/pix/who_logo.png\" alt=\"\"/><p>World Health Organizatio (WHO)</p></li></a>
		<a href=\"http://en.wikipedia.org/wiki/List_of_Ebola_outbreaks\" target=\"_blank\"><li><img src=\"css/pix/wiki_logo.jpg\" alt=\"\"/><p>Wikipedia</p></li></a>
		</ul>
			";
	}
	else{
		$display="";
	$result=mysql_query("SELECT * FROM ebola WHERE id='$menu'")or die(mysql_error());
	if(mysql_num_rows($result)>0){
		while($info=mysql_fetch_array($result)){
			$display.="
				<center class=\"banner\">$info[title]</center>
				<p class=\"details\">".nl2br($info['details'])."</p>
			";
		}
	}
	else{
		$display="<center class=\"alert\">No information to display</center>";
	}
}
	$show.="
		<div class=\"left\">
	$sidebar
	</div>
	<div class=\"right\">
	$display
	</div>
		";	
		$slider="";
}
else{
	$show="";
	$slider="";
	$show.=$sidebar;
}	
	
?>