<?php 

include('php/config.php');
include('php/functions.php');

if (preg_match('|^/([^/]+)/|', $_SERVER['PATH_INFO'], $matches)) {
    if ($MySQL->select_one("SELECT COUNT(*) FROM vikingir_norse.secondary_services WHERE id='".$matches[1]."'") == 1) {
    	$id = $matches[1];
    } 
	else {
		print $matches[1]."<br>\n";
		// die ("case not found in database: ".$_SERVER['SCRIPT_NAME'].$_SERVER['PATH_INFO']);
		header('Location: /errors/notfound.php');
	}
} 
else {
	//die ("case not found (no match): ".$_SERVER['SCRIPT_NAME'].$_SERVER['PATH_INFO']);
	header('Location: /errors/notfound.php');
}
$vars = $MySQL->select_row("SELECT * FROM vikingir_norse.secondary_services WHERE id='$id'");
	if (strlen($vars['title'])>0) {
			$PAGE_TITLE =$vars['title'];
		//	print PAGE_TITLE;
        }
        else {
			$PAGE_TITLE = DEFAULT_PAGE_TITLE;
        }
	if (strlen($vars['meta_description'])>0) {
		$PAGE_DESCRIPTION = $vars['meta_description'];
	} 
    else {
		$PAGE_DESCRIPTION =DEFAULT_PAGE_DESCRIPTION;
	}
	if (strlen($vars['meta_keywords'])>0) {
		$PAGE_KEYWORDS = $vars['meta_keywords'];
	} 
    else {
		$PAGE_KEYWORDS = DEFAULT_PAGE_KEYWORDS;
	}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html class="wf-kulturistaweb1kulturistaweb2-n6-active wf-kulturistaweb1kulturistaweb2-n7-active wf-active" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

    <head>
        <?php include("modules/page_head.php"); ?>
        <script type="text/javascript" src="/js/floating_nav.js"></script>
    </head>

    <body>
        
		<?php include("modules/header.php"); ?>
        
    	<div id="body_container" class="content_column">
            <div id="content_wrapper">
                
                <div id="content_left">
                	<a href="/secondary_services.php"><h2>Secondary Services</h2></a>                    
                    <?php include("modules/quote_request_dropdown.php"); ?>
                	<div id="floating_nav">
                	   <?php print_secondaryServices_nav(); ?>
                    </div>
                </div><!-- content_left -->
                
                <div id="content_center">
					<a href="/secondary_services.php">Back to Secondary Services</a>
					<?php print_secondary_services_page($id); ?>
                </div><!-- content_center -->
            
            </div><!-- content_wrapper -->
        </div><!-- body_container -->
    	
        <div id="clearfix"></div>
        
        <?php 
			include("modules/footer.php"); 
		?>
        
    </body>
</html>