
<?php
	if($page!="profile" ){
 ?>
    <script src="<?php echo $js."jquery-3.2.1.min.js";?>"></script>
    <script src="<?php echo $js."popper.min.js";?>"></script>
    <script src="<?php echo $js."bootstrap.min.js";?>"></script>
    <script src="<?php echo $js."main.js";?>"></script>
	<!-- The javascript plugin to display page loading on top-->
<?php
	}
	if($page=="referrals" || $page=="block" || $page=="users" || $page=="links" || $page=="files" || $page=="premium"  || $page=="campaigns" || $page=="transactions" || $page=="ads"  || $page=="withdraws"){
 ?>
 	<script type="text/javascript" src="<?php echo $js."plugins/jquery.dataTables.min.js";?>"></script>
	<script type="text/javascript" src="<?php echo $js."plugins/dataTables.bootstrap.min.js";?>"></script>
	<script type="text/javascript">$('#sampleTable').DataTable();</script>
<?php

	}




	// Get Download And Views Chart
	

	if($page=="dashboard"){
		$r = $admin->getDataSet();
		$t = $admin->getTypeTraffic();	
			// Get last 10 Days
		$days = array();
		for($i=1;$i<11;$i++){
			$date=date_create(date("Y-m-d"));
			date_add($date,date_interval_create_from_date_string("-$i days"));
			$d = explode('-',date_format($date,"Y-m-d"));
			$days[] = end($d);
		}
		$label = '';
		$g = '';
		for($j=9;$j>=0;$j--){
			$label .= $days[$j].', ';
	}
?>
    <script src="<?php echo $js."plugins/pace.min.js";?>"></script>
    <!-- Page specific javascripts-->
    <script type="text/javascript" src="<?php echo $js."plugins/chart.js";?>"></script>
    <script type="text/javascript">
	// 30 days
	
      var data = {
		
      	labels: [<?php echo $label;?>],
      	datasets: [
      		
      		{
      			label: "Downloads Files",
      			fillColor: "rgba(151,187,205,0.2)",
      			strokeColor: "rgba(151,187,205,1)",
      			pointColor: "rgba(151,187,205,1)",
      			pointStrokeColor: "#fff",
      			pointHighlightFill: "#fff",
      			pointHighlightStroke: "rgba(151,187,205,1)",
      			data: [<?php echo $r[0];?>]
      		}
      	]
      };
	  
     // Top Contries
	 var Top_Contries = [
		  	<?php $admin->TopCountries(); ?>
      ]
      

      var ctxl = $("#lineChartDemo").get(0).getContext("2d");
      var lineChart = new Chart(ctxl).Line(data);

	  //var ctxl1 = $("#lineChartDemo1").get(0).getContext("2d");
      //var lineChart1 = new Chart(ctxl1).Line(data1);
      
      var ctxp = $("#pieChartDemo").get(0).getContext("2d");
      var pieChart = new Chart(ctxp).Pie(Top_Contries);


    </script>
    
<?php } ?>
<?php
	if($page =="upload" ){
?>
	<script type="text/javascript" src="<?php echo $js."input/custom-file-input.js";?>"></script>
	

<?php } ?>


<?php
	if($page == "users" || $page == "block"){
?>

	<script>

		function fun1(id) {
			window.location.href="view&id="+id;
		}

		function edit(id) {
			window.location.href="edit&id="+id;
		}

		function fun2(id) {
			var xhttp = new XMLHttpRequest();
			xhttp.open("GET", "../../ajax.php?userid="+id, true);
			xhttp.send();
			window.location.href="edit";
		}

		function block(id) {
          var r = confirm("Are you sure?");
          if (r == true) {
              window.location.href="block&blockuser="+id;
          }
      	}

		  function active(id) {
          var r = confirm("Are you sure?");
          if (r == true) {
              window.location.href="users&activeuser="+id;
          }
      	}


      	function dlt(id) {
         	 var r = confirm("Are you sure?");
          	if (r == true) {
              window.location.href="users&dlt_user="+id;
          	}
      	}

    
	</script>
	

<?php } ?>

<?php
	if($page == "withdraws"){
?>


	
	

<?php } ?>

<script>
	function funtz(){
		window.location.href="#contact";
	}
</script>

