<?php
if (!defined("root")) {
	define("root", $_SERVER['DOCUMENT_ROOT']);
}
#echo'<xmpp><pre>';print_r($_SERVER).'</pre></xmp>';
session_start();
require(root."/_common.php");
require(root."/_lib/db.php");
require(root."/_lib/main.php");
require(root."/_lib/bootstraps.php");
require(root."/_tpl/html_begin.php");
require(root."/_tpl/tag_head.php");
require(root."/_tpl/ie_style_exception.php");
/*
 * begin
 * additional style
 * */
cout('<style type="text/css">');
cout('.pointer {');
	  cout('cursor: pointer;');
  cout('}');
cout('</style>');
/*
 * end
 * additional style
 * 
 * v
 * v
 * closing tag head
 * 
 * */
require(root."/_tpl/body_open.php");

$rsa=array();$qa="SELECT * FROM s_announcements WHERE isactive=1 ORDER BY tanggal DESC LIMIT 0,1";
callRS($rsa, $qa);
if (count($rsa)!=0) {
	cout('<div class="container-fluid for-home-runningtext" style="padding-left:0;padding-right:0;">');
		cout('<div class="container">');
			cout('<div class="container-fluid" style="padding-left:0;padding-right:0;">');
				cout('<div class="row">');
					cout('<div class="col-sm-2 for-label-container"><div class="for-label">Announcements</div></div>');
					cout('<div class="col-sm-10 run-text-container"><div class="run-text pending-load-running-text">');
						#cout('<marquee behavior="scroll" scrollamount="1" direction="left">');
						#	cout('<a href="'.absDom.'/announcements/'.$rsa[0]["url"].'">'.$rsa[0]["judul"].'</a>');
						#cout('</marquee>');
					cout('</div></div>');
				cout('</div><!-- /.row -->');
			cout('</div><!-- /.container-fluid -->');
		cout('</div><!-- /.container -->');
	cout('</div><!-- /.container-fluid -->');
	#cout('<script>');
	#	cout('$(function () {');
	#		# basic version is: $("div.demo marquee").marquee() - but we\'re doing some sexy extras
	#		cout('$(".run-text marquee").marquee("pointer").mouseover(function () {');
	#			cout('$(this).trigger("stop");');
	#		cout('}).mouseout(function () {');
	#			cout('$(this).trigger("start");');
	#		cout('}).mousemove(function (event) {');
	#			cout('if ($(this).data("drag") == true) {');
	#				cout('this.scrollLeft = $(this).data("scrollX") + ($(this).data("x") - event.clientX);');
	#			cout('}');
	#		cout('}).mousedown(function (event) {');
	#			cout('$(this).data("drag", true).data("x", event.clientX).data("scrollX", this.scrollLeft);');
	#		cout('}).mouseup(function () {');
	#			cout('$(this).data("drag", false);');
	#		cout('});');
	#	cout('});');
	#cout('</script>');
}
cout('<div class="container" style="padding:0;">');
	cout('<div class="container-fluid" style="padding:0;">');
		cout('<div class="row" style="margin:0;margin-bottom:20px;">');
			cout('<div class="col-sm-8" style="margin-bottom:10px;padding-left:0;">');
				$rs=array();$q="SELECT * FROM u_files WHERE kdslide!=0";
				callRS($rs, $q);
				cout('<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">');
					cout('<ol class="carousel-indicators">');
						for ($i=0;$i<count($rs);$i++) {
							$class_active = $i==0?'active':'';
							cout('<li data-target="#carousel-example-generic" data-slide-to="'.$i.'" class="'.$class_active.'"></li>');
						}
						#cout('<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>');
						#cout('<li data-target="#carousel-example-generic" data-slide-to="1" class=""></li>');
						#cout('<li data-target="#carousel-example-generic" data-slide-to="2" class=""></li>');
						#cout('<li data-target="#carousel-example-generic" data-slide-to="3" class=""></li>');
					cout('</ol>');
					cout('<div class="carousel-inner" role="listbox">');
						for ($i=0;$i<count($rs);$i++) {
							$path = str_replace("../../", "/", $rs[$i]["full_path"]);
							$resized = str_replace(".".$rs[$i]["file_ext"]."", "_1000.".$rs[$i]["file_ext"]."", $path);
							$resized = $resized."?".time();
							$class_active = $i==0?'active':'';
							cout('<div class="item '.$class_active.' text-center">');
								cout('<img src="'.$resized.'" alt="'.$rsi[$i]["image_title"].'" class="img-responsive">');
							cout('</div>');
						}
						#cout('<div class="item active text-center">');
						#	cout('<img src="'.absDom.'/img/slides/slide1.jpg" alt="Agen Togel" class="img-responsive">');
						#cout('</div>');
						#cout('<div class="item">');
						#	cout('<img src="'.absDom.'/img/slides/slide2.jpg" alt="Agen Judi">');
						#cout('</div>');
						#cout('<div class="item">');
						#	cout('<img src="'.absDom.'/img/slides/slide3.jpg" alt="Bandar Casino">');
						#cout('</div>');
						#cout('<div class="item">');
						#	cout('<img src="'.absDom.'/img/slides/slide4.jpg" alt="Bandar Bola">');
						#cout('</div>');
					cout('</div>');
					cout('<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">');
						cout('<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>');
						cout('<span class="sr-only">Previous</span>');
					cout('</a>');
					cout('<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">');
						cout('<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>');
						cout('<span class="sr-only">Next</span>');
					cout('</a>');
				cout('</div><!-- /#carousel-example-generic -->');
			cout('</div><!-- /.col-sm-8 -->');
			cout('<div class="col-sm-4" style="margin:0;padding-right:0;">');
				cout('<div class="panel panel-success home-panel">');
					$rsb=array(); $qb="SELECT * FROM banks WHERE isactive=1";
					callRS($rsb, $qb);
					$ion = ''.absDom.'/img/led-on.png';
					$ioff = ''.absDom.'/img/led-off.png';
					$bca_on = ''.absDom.'/img/BANK_BCA_ON.png';
					$bca_off = ''.absDom.'/img/BANK_BCA_OFF.png';
					$mandiri_on = ''.absDom.'/img/BANK_MANDIRI_ON.png';
					$mandiri_off = ''.absDom.'/img/BANK_MANDIRI_OFF.png';
					$bni_on = ''.absDom.'/img/BANK_BNI_ON.png';
					$bni_off = ''.absDom.'/img/BANK_BNI_OFF.png';
					$bri_on = ''.absDom.'/img/BANK_BRI_ON.png';
					$bri_off = ''.absDom.'/img/BANK_BRI_OFF.png';
					#printR($rsb);
					#cout('<div class="panel-heading">Jadwal Bank Offline</div>');
					cout('<div class="panel-body isi isi-bank" style="">');
						#cout('<h3 class="text-warning"><strong>Jadwal Bank Offline</strong></h3>');
						#cout('<p>&nbsp;</p>');
						for ($bb=0;$bb<count($rsb);$bb++) {
							$kdbank = $rsb[$bb]["kdbank"];
							cout('<div class="row" style="margin-bottom:5px;">');
								switch ($kdbank) {
									case 1: { $isrc = (intval($rsb[$bb]["ison"])==1)?$bca_on:$bca_off;
										$jadwal = '<div>SEN - JUM | 21:00 - 00:30 WIB</div>';
										$jadwal.= '<div>SABTU | 22:00 - 23:00 WIB</div>';
										$jadwal.= '<div>MINGGU | 00:00 - 06:00 WIB</div>';
										break;
									}
									case 2: { $isrc = (intval($rsb[$bb]["ison"])==1)?$mandiri_on:$mandiri_off;
										$jadwal = '<div>SEN - JUM | 23:00 - 04:00 WIB</div>';
										$jadwal.= '<div>SABTU | 22:00 - 04:00 WIB</div>';
										$jadwal.= '<div>MINGGU | 23:00 - 06:00 WIB</div>';
										break;
									}
									case 3: { $isrc = (intval($rsb[$bb]["ison"])==1)?$bni_on:$bni_off;
										$jadwal = '<div>&nbsp;</div>';
										$jadwal.= '<div>SETIAP HARI</div>';
										$jadwal.= '<div>23:00 - 24:00 WIB</div>';
										break;
									}
									case 4: { $isrc = (intval($rsb[$bb]["ison"])==1)?$bri_on:$bri_off;
										$jadwal = '<div>&nbsp;</div>';
										$jadwal.= '<div>SETIAP HARI</div>';
										$jadwal.= '<div>00:00 - 06:00 WIB</div>';
										break;
									}
								}
								cout('<div class="hidden-xs hidden-sm">');
									cout('<div class="col-sm-6 text-center" style="margin-bottom:10px;">');
										cout('<img class="img-responsive" src="'.$isrc.'" alt="agenVIP88 | '.$rsb[$bb]["inisial"].'" />');
									cout('</div><!-- /.col-sm-6 text-center -->');
									cout('<div class="col-sm-6" style="margin-bottom:10px;padding:0;font-size:11px;line-height:16px;">');
										cout($jadwal);
									cout('</div><!-- /.col-sm-6 text-center -->');
								cout('</div><!-- /.hidden-xs hidden-sm -->');
								
								cout('<div class="hidden-md hidden-lg hidden-xl">');
									cout('<div style="width:37%;height:60px;float:left;">');
										cout('<img class="img-responsive" src="'.$isrc.'" alt="agenVIP88 | '.$rsb[$bb]["inisial"].'" />');
									cout('</div>');
									cout('<div style="width:60%;float:left;font-size:11px;line-height:16px;">');
										cout($jadwal);
									cout('</div>');
								cout('</div><!-- /.hidden-md hidden-lg hidden-xl -->');
							cout('</div>');
						}
					cout('</div><!-- /.panel-body -->');
				cout('</div><!-- /.panel-default -->');
				cout('</div>');
			cout('</div><!-- /.col-xs-4 -->');
		cout('</div><!-- /.row -->');
	cout('</div><!-- /.container-fluid -->');
cout('</div><!-- /.container -->');

cout('<div class="container-fluid for-results" style="padding-left:0;padding-right:0;">');
	cout('<div class="container">');
		cout('<div class="container-fluid" style="padding-left:0;padding-right:0;">');
			cout('<div class="row" style="position:relative;">');
				cout('<div style="position:absolute;top:-19px;left:50%;margin-left:-200px;z-index:2;"><img src="'.absDom.'/img/head-our-games.png" /></div>');
				#cout('<div class="col-sm-4 hasil">PERMAINAN KAMI</div>');
				$rsr=array(); $qr="SELECT * FROM games WHERE isactive=1";
				callRS($rsr, $qr);
				switch (count($rsr)) {
					case 1: { $cols=12; break; }
					case 2: { $cols=6; break; }
					case 3: { $cols=4; break; }
					case 4: { $cols=3; break; }
					case 5: { $cols=2; break; }
					case 6: { $cols=2; break; }
				}
				for ($r=0;$r<count($rsr);$r++) {
					$rsi=array(); $qi="SELECT * FROM u_files WHERE kdgame_logo='".$rsr[$r]["kdgame"]."'";
					callRS($rsi, $qi);
					$path = str_replace("../../", "/", $rsi[0]["full_path"]);
					$resized = str_replace(".".$rsi[0]["ext"]."", "_220.".$rsi[0]["ext"]."", $path);
					#$resized = $resized==""?''.absDom.'/img/_noimg.jpg':$resized;
					$image_alt = trim($rsr[$r]["image_alt"])==""?$rsr[$r]["nama"]:$rsr[$r]["image_alt"];
					$first__hidden_margin = ($r==0)?'margin-top:50px;':'';
					$f_class = '';
					if (count($rsr)==5) {
						$f_class = $r==0?' col-sm-offset-1 ':'';
					}
					cout('<a class="hidden-xs hidden-sm col-sm-'.$cols.' '.$f_class.' hasil vcenter" href="#" onclick="showPop(\'games\', \''.$rsr[$r]["kdgame"].'\');return false;">');
						#cout('<!--<span class="games-name">'.$rsr[$r]["nama"].'</span>-->');
						cout('<span class="img-logo"><br/><br/><br/><img class="img-responsive" src="'.$resized.'" alt="'.$image_alt.'" /></span>');
					cout('</a>');
					
					cout('<a class="hidden-md hidden-lg hidden-xl col-sm-'.$cols.' '.$f_class.' hasil text-center" style="'.$first__hidden_margin.'margin-bottom:5px;text-align:center;display:block;height:50px;" href="#" onclick="showPop(\'games\', \''.$rsr[$r]["kdgame"].'\');return false;">');
						cout('<img style="height:40px;" src="'.$resized.'" alt="'.$image_alt.'" />');
					cout('</a>');
				}
				
			cout('</div><!-- /.row -->');
		cout('</div><!-- /.container-fluid -->');
	cout('</div><!-- /.container -->');
cout('</div><!-- /.container-fluid /.for-results -->');
#cout('<!-- Modal -->');
cout('<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">');
	cout('<div class="modal-dialog">');
		cout('<div class="modal-content">');
			cout('<div class="modal-header">');
				cout('<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>');
				cout('<h4 class="modal-title">Modal title</h4>');
			cout('</div>');
			cout('<div class="modal-body row"><div class="te modal-body-x"></div></div>');
			cout('<div class="modal-footer">');
				cout('<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>');
			cout('</div>');
		cout('</div><!-- /.modal-content -->');
	cout('</div><!-- /.modal-dialog -->');
cout('</div><!-- /.modal -->');


#cout('<script>');
#	cout('function showPop(parJenis, parKD) {');
#		cout('$("#myModal").modal("show");');
#		cout('$.ajax({');
#			cout('type: "GET",');
#			cout('url: "/_ajax/ajax_index.php",');
#			cout('data: "a=getdetailgames&id="+ parKD +"",');
#			cout('success: function(resp){');
#				cout('var tsp1 = resp.split("$$$");');
#				cout('var tsp2 = new Array();');
#				cout('for (var i=0;i<tsp1.length;i++) {');
#					cout('tsp2 = tsp1[i].split("$$");');
#					cout('$("."+tsp2[0]).html(tsp2[1]);');
#				cout('}');
#			cout('}');
#		cout('});');
#	cout('}');
#cout('</script>');


cout('<div class="container-fluid for-section" style="padding-left:0;padding-right:0;color:#fff;">');
	cout('<div class="container">');
		cout('<div class="container-fluid" style="padding-left:0;padding-right:0;">');
			cout('<div class="row">');
				cout('<div class="col-sm-8">');
					cout('<div class="row" style="margin-bottom:5px;">');
						cout('<div class="col-sm-6">');
							cout('<div class="last-dpwd-box">');
								cout('<div class="row r-tit">');
									cout('<div class="col-sm-12 text-center"><img src="'.absDom.'/img/head-latest-depo.png" height="45" alt="Deposit Terakhir" /></div>');
								cout('</div>');
								#cout('<div class="row r-tit">');
								#	cout('<div class="col-sm-3 text-center">User ID</div>');
								#	cout('<div class="col-sm-6 text-center">Nominal</div>');
								#	cout('<div class="col-sm-3 text-center">Status</div>');
								#cout('</div>');
								$RSstart = 0;
								$RSend = 20;
								$rs=array(); $q="SELECT * FROM deposits WHERE isactive=1 AND isclear=1 ORDER BY tanggal DESC LIMIT $RSstart,$RSend";
								callRS($rs, $q);
								cout('<div class="forscrolldp">');
									for ($i=0;$i<count($rs);$i++) {
										$cellType = $i%2==0?'r-eve':'r-odd';
										$stat = 'Transfered';
										cout('<div class="row '.$cellType.'">');
											cout('<div class="xxcol-sm-3 text-center col-userid"><strong>'.$rs[$i]["username"].'</strong></div>');
											cout('<div class="xxcol-sm-6 text-center col-jml">Rp. '.number_format($rs[$i]["jumlah"],0).'</div>');
											cout('<div class="xxcol-sm-3 text-center col-stat">'.$stat.'</div>');
										cout('</div>');
									}
								cout('</div><!-- /.forscrollwd -->');
							cout('</div><!-- /.last-dpwd-box -->');
							cout('<script>');
								
							cout('</script>');
						cout('</div><!-- /.col-sm-6 -->');
						cout('<div class="col-sm-6">');
							cout('<div class="last-dpwd-box">');
								cout('<div class="row r-tit">');
									cout('<div class="col-sm-12 text-center"><img src="'.absDom.'/img/head-latest-wd.png" height="45" alt="Tarikan Terakhir" /></div>');
								cout('</div>');
								#cout('<div class="row r-tit">');
								#	cout('<div class="col-sm-3 text-center">User ID</div>');
								#	cout('<div class="col-sm-6 text-center">Nominal</div>');
								#	cout('<div class="col-sm-3 text-center">Status</div>');
								#cout('</div>');
								$RSstart = 0;
								$RSend = 20;
								$rs=array(); $q="SELECT * FROM withdraws WHERE isactive=1 AND isclear=1 ORDER BY tanggal DESC LIMIT $RSstart,$RSend";
								callRS($rs, $q);
								cout('<div class="forscrollwd">');
									for ($i=0;$i<count($rs);$i++) {
										$cellType = $i%2==0?'r-eve':'r-odd';
										$stat = 'Transfered';
										cout('<div class="row '.$cellType.'">');
											cout('<div class="xxcol-sm-3 text-center col-userid"><strong>'.$rs[$i]["username"].'</strong></div>');
											cout('<div class="xxcol-sm-6 text-center col-jml">Rp. '.number_format($rs[$i]["jumlah"],0).'</div>');
											cout('<div class="xxcol-sm-3 text-center col-stat">'.$stat.'</div>');
										cout('</div>');
									}
								cout('</div><!-- /.forscrollwd -->');
							cout('</div><!-- /.last-dpwd-box -->');
							#cout('<script>');
							#	cout('function doScrollDP(parCST) {');
							#		cout('var nST = parCST + 250;');
							#		cout('if (nST>500) { nST = 0; }');
							#		cout('setTimeout(function(){');
							#			cout('$(".forscrolldp").animate({ scrollTop: nST }, 3000, function(){');
							#				cout('doScrollDP(nST);');
							#			cout('});');
							#		cout('}, 4000);');
							#	cout('}');
							#	cout('function doScrollWD(parCST) {');
							#		cout('var nST = parCST + 250;');
							#		cout('if (nST>500) { nST = 0; }');
							#		cout('setTimeout(function(){');
							#			cout('$(".forscrollwd").animate({ scrollTop: nST }, 3000, function(){');
							#				cout('doScrollWD(nST);');
							#			cout('});');
							#		cout('}, 4000);');
							#	cout('}');
							#	cout('$(window).load(function(){');
							#		cout('setTimeout(function(){');
							#			cout('doScrollDP(0);');
							#			cout('doScrollWD(0);');
							#		cout('}, 100);');
							#	cout('});');
							#cout('</script>');
						cout('</div><!-- /.col-sm-6 -->');
					cout('</div><!-- /.row -->');
					
				cout('</div><!-- /.col-sm-8 -->');
				
				cout('<div class="col-sm-4">');
					cout('<div class="panel panel-success home-panel">');
						cout('<div class="panel-heading">Tentang AgenVIP88</div>');
						cout('<div class="panel-body isi">');
							#cout('<h3 class="text-info"><strong>Tentang AgenVIP88</h3>');
							cout('<p>&nbsp;</p>');
							$rsa=array(); $qa="SELECT * FROM s_about";
							callRS($rsa, $qa);
							$isi = str_replace("\n", "<br/>", $rsa[0]["isi"]);
							$isi = str_replace("[h5]", '<h5 class="small text-warning">', $isi);
							$isi = str_replace("[/h5]", '</h5>', $isi);
							$isi = str_replace("[p]", '<p>', $isi);
							$isi = str_replace("[/p]", '</p>', $isi);
							cout(''.$isi.'');
							
						cout('</div><!-- /.panel-body -->');
					cout('</div><!-- /.panel -->');
				cout('</div><!-- /.col-sm-4 -->');
			cout('</div>');
			
		cout('</div><!-- /.container-fluid -->');
	cout('</div><!-- /.container -->');
cout('</div><!-- /.container-fluid -->');




$rsn=array();$qn="SELECT * FROM news WHERE isactive=1 ORDER BY tanggal DESC LIMIT 0,6";
callRS($rsn, $qn);
if (count($rsn)!=0) {
	cout('<div class="container-fluid for-news-home" style="color:#fff;">');
		cout('<div class="container">');
			cout('<div class="container-fluid" style="padding:0;">');
				cout('<div class="row">');
					cout('<div class="col-sm-4">');
						
					cout('</div><!-- /.col-sm-4 -->');
					cout('<div class="col-sm-12">');
						#cout('<div class="row"><div class="col-sm-12 subtitle">Berita Terbaru</div></div>');
						cout('<div class="panel panel-info home-panel">');
							cout('<div class="panel-heading">Berita Terbaru</div>');
							cout('<div class="panel-body isi">');
								cout('<div class="row">');
									for ($n=0;$n<count($rsn);$n++) {
										$isi = first_n_words($rsn[$n]["isi"], 18);
										#$isi = str_replace("\n", "<br/>", $rsn[$n]["isi"]);
										$cls = ($n+1)%3==0?'last':'';
										$news_url = ''.absDom.'/news/'.$rsn[$n]["url"].'';
										cout('<div class="col-sm-4 each" style="">');
											cout('<div class="row">');
												#cout('<!--<div class="col-sm-4"><a href="'.$news_url.'" class="img"><img src="/img/rep_game_x.jpg" width="90" alt="" /></a></div>-->');
												cout('<div class="col-sm-12 detail">');
													cout('<a href="'.$news_url.'" class="date">'.$rsn[$n]["judul"].'</a><br/>');
													cout('<span class="date" style="text-decoration:none;font-size:90%;">'.date('d M Y', $rsn[$n]["tanggal"]).'</span>');
													cout('<div class="preview">'.$isi.' ... <a href="'.$news_url.'">more</a></div>');
												cout('</div><!-- /.col-sm-12 /.detail -->');
											cout('</div><!-- /.row -->');
										cout('</div><!-- /.col-sm-4 -->');
										if (($n+1)%3==0) {
											cout('</div><!-- /.row -->');
											cout('<div class="row">');
										}
									}
								cout('</div><!-- /.row -->');
							cout('</div><!-- /.panel-body -->');
						cout('</div><!-- /.panel-default -->');
					cout('</div><!-- /.col-sm-12 -->');
				cout('</div><!-- /.row -->');
			
				
			
			
			
			
			
				
				
			cout('</div><!-- /.container-fluid -->');
		cout('</div><!-- /.container -->');
	cout('</div><!-- /.container-fluid -->');
}
require(root."/_tpl/body_close.php");
?>