<?php
@session_start();
/*error_reporting(E_ALL);
ini_set('display_errors', 1);*/
$auth_admin = false;
$screenshot_url = 'https://cypruspics.com/thumbshot?';
require_once(dirname(__FILE__) . "/../../../adbcon.php");
if(strpos($_SERVER['HTTP_HOST'], 'cypruswebsites.') === false) {
    require_once(dirname(__FILE__). "/../../../functions.php");
}
else {
    require_once(dirname(__FILE__). "/../../../ageneral/functions.php");
}
/****************************************************************************************************/

$is_hotel = true;

//echo '<pre>', var_export($_REQUEST, true), '</pre>';

$adv_code = trim($_REQUEST['adv_code']);
if($adv_code != "") {
	
	// Get domain catdoms
	$catdoms = array();
	
	$domainname = isset($_REQUEST['domainname']) ? trim($_REQUEST['domainname']) : $_SERVER['HTTP_HOST'];
	$addonname = "";
	$q = "SELECT * FROM  domaincategories WHERE domainname='$domainname' and parent_id='0';";
	$r = @mysql_query($q);
	if($r && mysql_num_rows($r) == 1) {
		$row = mysql_fetch_assoc($r);
		$domain_id = intval($row['catdom_id']);
		$addonname = $row['addonname'];
		
		$catdoms [] = $domain_id;
		$result_sub = mysql_query ("SELECT * FROM  domaincategories WHERE parent_id='$domain_id';");
		if (mysql_num_rows($result_sub) <> 0){			  
			while($line_sub = mysql_fetch_array($result_sub)){ 
				$catdoms [] = intval($line_sub["catdom_id"]);
			}
		}
		
	}
	
	$microdata_host = $_SERVER['HTTP_HOST'];
	if(str_replace('www.', '', $microdata_host) != str_replace('www.', '', $domainname)) {
		$microdata_host .= "/$addonname";
	}
	

	$wb_domainname = str_replace('www.', '', $domainname);
	$q = "select a.* from wb_categories_adverts a, wb_categories_domains d where a.wb_advert_uid='$adv_code' and a.wb_status='1' and a.wb_uid=d.wb_uid and d.wb_domainname='$wb_domainname'";
	//echo $q;
	$r = @mysql_query($q);
	if($r && mysql_num_rows($r) == 1) {
		$row = mysql_fetch_assoc($r);
		
		$wb_uid = $row['wb_uid'];
		
		// Get InfoWindow Template
		$template_file = dirname(__FILE__) . "/../templates/witmpl_$wb_uid.tmpl.php";
		if(!file_exists($template_file)) {
			$template_file = dirname(__FILE__) . "/../templates/default.tmpl.php";
		}
		
		//echo $template_file;
		
		require_once($template_file);
	}
}

/****************************************************************************************************/
?>