<?php
ob_start();
$err = array();
if(isset($_REQUEST['ccmi']) && $_REQUEST['ccmi'] > 0 ) {
	// Set the Page Title
	$popup_title = tx("Weather Print");
	$display_title = tx("Current Weather + 5 Days Forecast");
	$print_screen = 1;
	
	// Get the META Tags and domain title
	$q = "select * from domaincategories where catdom_id='$domain_id'";
	$r = mysql_query($q);
	if($r && mysql_num_rows($r)>0) {
		$meta = mysql_fetch_assoc($r);
		if(is_array($meta)) {
			foreach ($meta as $key=>$val) {
				$meta[$key] = stripslashes($val);
			}
		}
		
		$display_title = "<strong>" . strtoupper($meta['logo_text']) . "</strong> &raquo; " . $display_title;
	}
	
	
	
	if(isset($_REQUEST['page']) && $_REQUEST['page'] == 1) {
		?>
		<html>
			<title><?php echo $popup_title;?></title>
			<head>
				<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
				<meta content=en http-equiv=Content-Language>
				<meta content="15 days" name=revisit-after>
				<meta content="index, follow" name=robots>
				<meta content=All name=Robots>
				<meta name="description" content="<?php echo  $meta["metatags_$lang2iso"];?>">
				<meta name="keywords" content="<?php echo  $meta["metakeyword_$lang2iso"];?>">
				<meta name="alt" content="<?php echo  $meta["metaalt_$lang2iso"];?>">
				<link href="<?php echo $css_path;?>style.css" rel=stylesheet type="text/css" media="print,screen"/>
				<script type="text/javascript" src="<?php echo  $path;?>js/jquery-latest.js"></script> 
			</head>
			<body style="text-align: center;">
				<div class="site_container" style="height: 100%;">
					<div id="page_container">
						<div id="page_content">
							<table class="sides_content" width="100%" cellspacing="0" cellpadding="0" border="0">
								<tbody>
									<tr valign="top">
										<td valign="top" align="left">
											<div class="weather_print_title">
												<h1><?php echo $display_title;?></h1>
											</div>
											<div class="">
											<?php
											
											$q = "select * from left_content where catdom_module_id='".$_REQUEST['ccmi']."';";
											$r = mysql_query($q);
											if($r && mysql_num_rows($r)>0) {
												$row = mysql_fetch_assoc($r);
												$module_params = unserialize(base64_decode($row['module_params']));
												$module_params['catdom_module_id'] = $_REQUEST['ccmi'];
												$module_params['module_show_print_link'] = 1;
												$mc_module_id = $row['module_id'];
												$module_dir = "weather_advanced";
												include_once("$modules_path/$module_dir/weather_advanced_init.php");
												include_once("$modules_path/$module_dir/weather_advanced_default.php");
											}
											else {
												$err [] = tx("The requested action cannot be processed.");
											}
											?>
											</div>
										</td>
									</tr>
								</tbody>
							</table>				
						</div>
					</div>
				</div>		
			</body>
		</html>		
	<?php
	}
	else {
		$err [] = tx("The requested action cannot be processed.");
	}
}
else {
	$err [] = tx("The requested action cannot be processed.");
}
$weather_print_page = ob_get_contents();
ob_end_clean();
if(count($err) == 0) {
	echo $weather_print_page;
}
else {
	?>
	<div class="inline_container">
		<p class="note">
		<?php
		foreach ($err as $k=>$er) {
			echo "<br/>$er";
		}
		?>
		</p>
	</div>
	<?php
}
?>