<?php
cout('</head>');
cout('<body>');
cout('<div class="container-fluid super-top">');
	cout('<div class="container-fluid top-header">');
		cout('<div class="container-custom-fluid">');
			cout('<div class="hidden-md hidden-lg hidden-xl fleft mini-logo"><a href="/"><img src="/img/logo.ori.h40.png" alt="7WinCash.com"/></a></div>');
			cout('<div class="lang-switch">');
				cout('<span class="label">Language</span><!--/.label-->');
				$rsn=array();$qn="SELECT a.*, b.flag AS lang_flag, kodelang FROM negara a LEFT JOIN langs b ON b.kdlang=a.kdlang WHERE a.isactive=1";
				callRS($rsn, $qn);
				cout('<ul class="langs">');
					for ($i=0;$i<count($rsn);$i++) {
						$kodelang = strtolower($rsn[$i]["kodelang"]);
						$onclick = 'return false;';
						if (isset($_SESSION["lang"]) && strtolower($_SESSION["lang"])!="") {
							$act = ($kodelang==$_SESSION["lang"] || $kodelang==$_SESSION["lang"])?'act':'';
						} else {
							$act = ($kodelang=="uk" || $kodelang=="us")?'act':'';
						}
						$onclick = ($act=="")?'switchLang(\''.$kodelang.'\');return false;':$onclick;
						cout('<li><a class="lang lang-'.$kodelang.' '.$act.'" href="#" onclick="'.$onclick.'"></a></li>');
					}
					#cout('<li><a class="lang lang-uk" href="#" onclick="switchLang(\'uk\');return false;"></a></li>');
					#cout('<li><a class="lang lang-id act" href="#" onclick="return false;"></a></li>');
				cout('</ul><!--/.langs-->');
				#cout('<ul class="langs">');
				#	cout('<li class=""><a class="lang lang-id" href="#" onclick="return false;"></a></li>');
				#	cout('<li class=""><a class="lang lang-en" href="#" onclick="return false;"></a></li>');
				#cout('</ul><!--/.langs-->');
			cout('</div><!--/.lang-switch-->');
		cout('</div><!--/.container-custom-fluid-->');
	cout('</div><!--/.container-fluid top-header-->');
	cout('<div class="container-fluid header">');
		cout('<div class="container-custom-fluid">');
			cout('<div class="for-logo hidden-xs hidden-sm">');
				cout('<a href="/"><img src="/img/logo.220.png" alt="7WinCash.com" /></a>');
			cout('</div><!--/.for-logo-->');
			
			cout('<div class="for-menu">');
				cout('<ul class="de-menu">');
					cout('<li class="utama">');
						cout('<a href="/" class="menu-link">');
							cout('<div class="icon icon-home"></div>');
							cout('<div class="text">Home '.(isset($_SESSION["lang"])?$_SESSION["lang"]:'').'</div>');
						cout('</a>');
					cout('</li>');
					$rsgc=array();$qgc="SELECT a.* FROM game_cats a WHERE a.isactive=1";
					callRS($rsgc, $qgc);
					for ($i=0;$i<count($rsgc);$i++) {
						$icon = '';
						switch($rsgc[$i]["url"]) {
							case "sportsbook": { $icon='icon-sports';break; }
							case "live-casino": { $icon='icon-lc';break; }
							case "slot-games": { $icon='icon-slot';break; }
							case "poker": { $icon='icon-poker';break; }
							default: { $icon='icon-lc';break; }
						}
						$rsg=array();$qg="SELECT a.* FROM games a LEFT JOIN game_cats b ON b.kdgame_cat=a.kdgame_cat LEFT JOIN negara c ON c.kdnegara=a.kdnegara WHERE a.kdgame_cat='".$rsgc[$i]["kdgame_cat"]."' AND a.isactive=1 AND (a.kdnegara=0 OR c.kdlang='".(isset($_SESSION["lang_id"])?$_SESSION["lang_id"]:'3')."')";
						callRS($rsg, $qg);
						cout('<li class="utama">');
							cout('<a href="/'.$rsgc[$i]["url"].'" class="menu-link">');
								cout('<div class="icon '.$icon.'"></div>');
								cout('<div class="text">'.$rsgc[$i]["nama"].'</div>');
							cout('</a>');
							if (count($rsg)!=0) {
								cout('<div class="dropdown dropdown-split-'.count($rsg).'">');
									cout('<ul>');
										for ($j=0;$j<count($rsg);$j++) {
											$rsi=array(); $qi="SELECT * FROM u_files WHERE kdgame_girl='".$rsg[$j]["kdgame"]."'";
											callRS($rsi, $qi);
											$path = '';
											$resized = '';
											if (count($rsi)!=0) {
												$path = str_replace("../../", "/", (isset($rsi[0]["full_path"])?$rsi[0]["full_path"]:''));
												$resized = str_replace(".".(isset($rsi[0]["file_ext"])?$rsi[0]["file_ext"]:'')."", "_500.".(isset($rsi[0]["file_ext"])?$rsi[0]["file_ext"]:'')."", $path);
											}
											$rsil=array(); $qil="SELECT * FROM u_files WHERE kdgame_logo='".$rsg[$j]["kdgame"]."'";
											callRS($rsil, $qil);
											$pathl = '';
											$resizedl = '';
											if (count($rsi)!=0) {
												$pathl = (count($rsi)!=0)?str_replace("../../", "/", (isset($rsil[0]["full_path"])?$rsil[0]["full_path"]:'')):'';
												$resizedl = (count($rsil)!=0)?str_replace(".".(isset($rsil[0]["file_ext"])?$rsil[0]["file_ext"]:'')."", "_220.".(isset($rsil[0]["file_ext"])?$rsil[0]["file_ext"]:'')."", $pathl):'';
											}
											#cout('<div class="item">');
											#	cout('<div class="game-img"><img src="'.$resized.'" class="img-responsive" /></div>');
											#cout('</div>');
											cout('<li class="game-lists-menu">
												<a href="/'.$rsgc[$i]["url"].'/'.$rsg[$j]["url"].'">
													<div class="game-img"><img src="'.$resized.'" width="220" class="img-responsivex center-block" /></div>
													<div class="text-center game-nama"><img src="'.$resizedl.'" alt="'.$rsg[$j]["nama"].'" /></div>
												</a>
											</li>');
										}
									cout('</ul>');
									/* 
									cout('<div class="owl-carousel'.$rsgc[$i]["kdgame_cat"].'">');
										for ($j=0;$j<count($rsg);$j++) {
											$rsi=array(); $qi="SELECT * FROM u_files WHERE kdgame_logo='".$rsg[$j]["kdgame"]."'";
											callRS($rsi, $qi);
											$path = (count($rsi)!=0)?str_replace("../../", "/", $rsi[0]["full_path"]):'';
											$resized = (count($rsi)!=0)?str_replace(".".$rsi[0]["file_ext"]."", "_220.".$rsi[0]["file_ext"]."", $path):'';
											cout('<div class="item">');
												cout('<div class="game-img"><img src="'.$resized.'" class="img-responsive" /></div>');
											cout('</div>');
										}
									cout('</div><!--/.owl-carousel-->'); */
								cout('</div><!--/.dropdown-->');
							}
						cout('</li>');
					}
					cout('<li class="utama">');
						cout('<a href="/promotions" class="menu-link">');
							cout('<div class="icon icon-promo"></div>');
							cout('<div class="text">Promotion</div>');
						cout('</a>');
					cout('</li>');
					cout('<li class="utama">');
						cout('<a href="/members" class="menu-link">');
							cout('<div class="icon icon-blog"></div>');
							cout('<div class="text">Blog</div>');
						cout('</a>');
					cout('</li>');
					cout('<li class="utama">');
						if (isset($_SESSION["member"])) {
							cout('<a href="/members/logout" class="menu-link">');
								cout('<div class="icon icon-trans"></div>');
								cout('<div class="text">Logout</div>');
							cout('</a>');
						} else {
							cout('<a href="/members" class="menu-link">');
								cout('<div class="icon icon-trans"></div>');
								cout('<div class="text">Dashboard</div>');
							cout('</a>');
						}
					cout('</li>');
				cout('</li>');
				
			cout('</div><!--/.for-menu-->');
		cout('</div><!--/.container-custom-fluid-->');
	cout('</div><!--/.container-fluid header-->');
cout('</div><!--/.container-fluid-->');

cout('<script>');
	/*
	for ($i=0;$i<count($rsgc);$i++) {
		cout('var owl'.$rsgc[$i]["kdgame_cat"].' = $(".owl-carousel'.$rsgc[$i]["kdgame_cat"].'");');
		cout('owl'.$rsgc[$i]["kdgame_cat"].'.owlCarousel({');
			cout('margin:10,');
			if (count($rsg)>4) {
				#cout('loop:true,');
			} else {
				cout('items:'.count($rsg).',');
			}
			cout('autoplay:true,');
			cout('autoplayTimeout:4000,');
			cout('autoplayHoverPause:false,');
			cout('responsive:{');
				cout('0:{ items:1 },');
				cout('600:{ items:3 },');
				cout('1000:{ items:4 }');
			cout('}');
		cout('});');
	}
	*/
	cout('
	function switchLang(parLang) {
		$.ajax({
			type: "GET",
			url: "/_ajax/ajax_index.php",
			data: "a=changelang&lang="+ parLang +"",
			success: function(resp){
				location.reload();
			}
		});
	}
	');
	cout('var sticky;');
	cout('function replaceTopSticky(){');
		cout('if ($(".sticky-wrapper").length) {sticky.destroy();}');
		cout('if ($(window).width()<=768) {');
			cout('sticky = new Waypoint.Sticky({');
				cout('element: $(".super-top")[0]');
			cout('});');
		cout('} else {');
			cout('sticky = new Waypoint.Sticky({');
				cout('element: $(".header")[0]');
			cout('});');
		cout('}');
	cout('}');
	cout('$(window).load(function(){replaceTopSticky()});');
	cout('$(window).resize(function(){replaceTopSticky()});');
cout('</script>');


?>