<?php
	if(is_dir("install")) {
		echo '<script>location.href="install/step-1.php";</script>';
		exit;
	}
	
	// include configuration file
	require_once('admin/includes/dbconfig.php');
	require_once('classes/database.class.php');
	$dclass = new database();	
	require_once('classes/general.class.php');	
	$gnrl = new general();
	$SITE_CSS = $gnrl->getSettings("SITE_CSS");
	$HOME_PAGE_CONTENT = $gnrl->getSettings("HOME_PAGE_CONTENT");
	
	// Only fetch pages if no stand alone contact us
	$STAND_ALONE_CONTACT_US = $gnrl->getSettings("STAND_ALONE_CONTACT_US");
	if($STAND_ALONE_CONTACT_US == 0) {
		$show_data = $dclass->select("*","tbl_cms","AND i_parent_id = 0 AND e_status='active'"," ORDER BY i_order ASC");
	}
	
	$google_analytics_id = $gnrl->getSettings("GOOGLE_ANALYTICS_ID");
	
	$FONT_COLOR = $gnrl->getSettings("FONT_COLOR");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo $gnrl->getSettings("HOME_META_TITLE_1");?></title>
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Language" content="de" />
<meta name="keywords" content="<?php echo $gnrl->getSettings("HOME_META_KEYWORDS_1");?>" />
<meta name="description" content="<?php echo $gnrl->getSettings("HOME_META_DESCRIPTION_1");?>" />
<meta name="robots" content="all" />
<meta name="author" content="" />
<meta name="google-site-verification" content="" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="apple-touch-fullscreen" content="YES" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<?php
if($SITE_CSS == 'blue-square') {
	include("css/blue-square/style.php");
}
else {
?>
<link rel="Stylesheet" type="text/css" href="css/<?php echo $SITE_CSS?>/style.css" />
<?php
}
?>

<link rel="Stylesheet" media="screen and (max-device-width: 480px)" type="text/css" href="css/<?php echo $SITE_CSS?>/tablet.css" />
<?php
if($SITE_CSS != 'blue-square') {
?>
<!--[if !IE]>-->

<link media="only screen and (max-width: 480px)" rel="stylesheet" type="text/css" href="css/<?php echo $SITE_CSS?>/style.css" />

<!--<![endif]-->
<?php
}
?>
</head>

<body class=" mobilehome  ">
<div id="frontPage">

  <?php require_once("inc/header.php");?>	
  <div class="clear"></div>
  <div id="homecontent">
  <?php
  	if($HOME_PAGE_CONTENT) {
		echo $HOME_PAGE_CONTENT;
	}
  ?>	
  </div>	
  <div class="clear"></div>
  <?php
  	if($STAND_ALONE_CONTACT_US) {
		$contactus_phone_link = $gnrl->getSettings("CONTACT_US_PHONE_LINK");
		$contactus_phone = $gnrl->getSettings("CONTACT_US_PHONE");
		$contactus_phone_note = $gnrl->getSettings("CONTACT_US_PHONE_NOTE");
		$contactus_email = $gnrl->getSettings("CONTACT_US_EMAIL");
		$contactus_email_note = $gnrl->getSettings("CONTACT_US_EMAIL_NOTE");
		$google_map = $gnrl->getSettings("CONTACT_US_GOOGLE_MAP");
		$contactus_content = $gnrl->getSettings("CONTACT_US_CONTENT");
  ?>
  <div id="content">
    <div class="clear"></div>
    <?php
	if($contactus_phone) {
	?>
    <div class="navblock">
      <ul class="applyeffect">
        <li> <a title="Minimize box" class="toggleBox"></a>
          <h2> <span>Telefon / SMS</span> </h2>
        </li>
        <li class="featured">
        	<a href="<?php if($contactus_phone) { if($contactus_phone_link) echo $contactus_phone_link; else echo 'tel:'; echo $contactus_phone; } ?>"><?php echo $contactus_phone; ?></a>
            <br />
            <?php
				if($contactus_phone_note)
					echo $contactus_phone_note;
			?>
        </li>
        <!-- Hidden links for when user clicks "more news" -->
      </ul>
    </div>
    <?php
	}
	if($contactus_email) {
	?>
    <div class="navblock">
      <ul class="applyeffect">
        <li> <a title="Minimize box" class="toggleBox"></a>
          <h2> <span>E-Mail senden</span> </h2>
        </li>
        <li class="featuredcontact">
        	<a href="mailto:<?php echo $contactus_email;?>"><?php echo $contactus_email;?></a>
            <br />
            <?php
				if($contactus_email_note)
					echo $contactus_email_note;
			?>
        </li>
        <!-- Hidden links for when user clicks "more news" -->
      </ul>
    </div>
    <?php
		}
		if($google_map) {
	?>
    <div class="navblock">
      <ul class="applyeffect">
        <li> <a title="Minimize box" class="toggleBox"></a>
          <h2> <span>Google Map</span> </h2>
        </li>
        <li class="featuredcontact">
        	<?php echo $google_map;?>
        </li>
        <!-- Hidden links for when user clicks "more news" -->
      </ul>
    </div>
    <?php
		}
		if($contactus_content) {
	?>
    <div class="navblock">
      <ul class="applyeffect">
        <li> <a title="Minimize box" class="toggleBox"></a>
          <h2> <span>Impressum</span> </h2>
        </li>
        <li class="featuredcontact">
        	<?php echo $contactus_content;?>
        </li>
        <!-- Hidden links for when user clicks "more news" -->
      </ul>
    </div>
    <?php
		}
	?>
  </div>
  <?php
	}
	else {
  ?>
  <div id="content">
    <div class="clear"></div>
    <?php  foreach($show_data as $key=>$val){ ?>
    <div class="navblock">
      <ul class="applyeffect">
        <li> <a title="Minimize box" class="toggleBox"></a>
          <h2> <span><?php echo  $val['v_title'];?></span> </h2>
        </li>
        <li class="featured"> 
          <?php
          if($val['v_cms_image'] && file_exists("uploads/page/".$val['v_cms_image'])) {
		  ?>
          <img src="uploads/page/<?php echo $val['v_cms_image'];?>" alt="" class="descimg" />
          <?php
		  }
		  ?>
          <p><?php echo $val['l_description'];?></p>
        </li>
        <?php
$res_child = $dclass->select("*","tbl_cms"," AND i_parent_id='".$val['id']."'"," ORDER BY i_order ASC");
if(!empty($res_child)){
		foreach($res_child as $key=> $child_val){
		
?>
        <li class="standard-page">
          <h3><a href="<?php echo 'detail.php?id='.$child_val['id'];?>"><?php echo $child_val['v_title'];?></a></h3>
        </li>
        <?php 	}
	}
 ?>
        
      </ul>
    </div>
    <?php } ?>
    
  </div>
  <?php
	}
  ?>
  <?php require_once("inc/footer.php");?>
</div>

<!-- GLOBALSTAT --> 

<?php
	if($google_analytics_id) {
?>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try{ 
var pageTracker = _gat._getTracker("<?php echo $google_analytics_id;?>");
pageTracker._trackPageview();
} catch(err) {} 
</script>
<?php
	}
?>
<script src="js/jquery.min.js" type="text/javascript"></script> 
<script src="js/behaviours.js" type="text/javascript"></script> 
<script src="js/jquery.innerfade.js" type="text/javascript"></script>
<!-- software copyright http://software4.mobi -->
<!-- Remember you my use it but you dont own it //  http://software4.mobi -->
<!-- german version of this software copyright http://easymobilehomepage.com -->
</body>
</html>
