<?php

/*
*	Copyright VeryIDE,2007-2008
*	http://www.veryide.com/
*
*	$Id: index.php,v1 10:47 2008-9-16 Lay $
*/

//调用实例，要放在最前
require("../../../class/cart.php");

setlocale(LC_MONETARY, 'it_IT');

//载入全局配置和函数包
require '../../../include/global.php';

//广告配置
require(VI_ROOT."module/adsview/config.php");
require(VI_ROOT."module/adsview/setting.php");

//通行证
require(VI_ROOT."module/passport/function.php");

//当前 APPID
$appid = Module :: get_appid();

/////////////////////////////////////////////

//加载缓存
Cached :: loader( $appid, "table.adsarea");

$action=getgpc('action');
$do=getgpc('do');

//是否有支付模块
$modpay = file_exists( VI_ROOT.'module/payment/' );

//初始化购物车
if( isset($_SESSION['cart']) ){
	$cart = unserialize($_SESSION['cart']);
}else{
	$cart = new Cart();
}

?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $_G['product']['charset'];?>" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>广告服务 - <?php echo $_G['setting']['global']['site'];?> - Powered By VeryIDE</title>
<link href="service/style/style.css" type="text/css" rel="stylesheet" />

<?php


echo loader_script(array(VI_HOST."js/mo.js",VI_HOST."js/mo.ui.js",VI_HOST."js/mo.form.js"),"utf-8",$_G['product']['version']);

?>

<body>

	<?php
		
	//隐藏导航LOGO
	$_G['setting']['passport']['hidelogo'] = "Y";
		
	require VI_ROOT.'module/passport/include.header.php';
	?>
    
    <?php	
	//如果有配置独立域名
	if( $_G['setting']['adsview']['domain'] ){
	?>
	<script type="text/javascript"> Passport.API = 'sso.php'; /*跨域支持*/ </script>
    <?php
	}
	?>

<div id="shell">

    <!--顶部导航_开始-->
    <div id="header">
    
        <p>
            <a href="<?php echo $_G['setting']['global']['url'];?>"><img alt="<?php echo $_G['setting']['global']['site'];?>" src="<?php echo $_G['setting']['passport']['logo'];?>" /></a>
            <a href="./"><img src="service/image/service.png" /></a>
        </p>
        
        <ul>
        	<li><a href="./service.php"<?php echo $action=='' ? ' class="active"' : ''?>>首页</a></li>
            <?php
			if( $modpay ){
			?>
        	<li><a href="?action=order"<?php echo $action=='order' ? ' class="active"' : ''?>>购物车<?php echo count($cart->getCart())? '（'.count($cart->getCart()).'）' : '';?></a></li>
        	<li><a href="?action=query"<?php echo $action=='query' ? ' class="active"' : ''?>>查询订单</a></li>
            <?php
			}
			?>
        	<li><a href="?action=glory"<?php echo $action=='glory' ? ' class="active"' : ''?>>营销案例</a></li>        
        	<li><a href="?action=about"<?php echo $action=='about' ? ' class="active"' : ''?>>联系我们</a></li>        
        </ul>
        
    </div>
    <!--顶部导航_结束-->

    <!--主体内容_开始-->
    <div id="content">
    
        <?php
		
		
    
		$active = array(''=>'include.index.php','order'=>'include.order.php','query'=>'include.query.php','payto'=>'include.payto.php','glory'=>'include.glory.php','about'=>'include.about.php');
        
        if(array_key_exists($action,$active)){

			//连接数据库
			System :: connect();
			
            require("./service/".$active[$action]);	

			//关闭数据库
			System :: connect();
		
        }
		
        ?>
        
    </div>
    <!--主体内容_结束-->
    

	<div id="footer">
		<?php echo $_G['setting']['passport']["footer"];?>
    
        <?php echo $_G['setting']['passport']["statcode"];?>
    </div>
</div>

</body></html>