<?php
define('IN_SYS',TRUE);
require './config.php';
require './setup.php';
require './lib/system_SqlIn.php';
$conn = new dbo();
$maxType = 0;
?><!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $siteTitle;?></title>
<meta name="description" content="<?php echo $siteDescription;?>" />
<meta name="keywords" content="<?php echo $siteKeywords;?>" />
<meta name="author" content="<?php echo $siteAuthor;?>" />
<link href="temp/css/style.css" rel="stylesheet" type="text/css">
<script src="temp/js/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="temp/js/jquery.carouFredSel-6.2.0-packed.js" type="text/javascript"></script>
<script src="temp/js/jquery.SuperSlide.2.1.js" type="text/javascript"></script>
<script type="text/javascript" src="temp/js/public.js"></script>
</head>
<body>
<!--头部header层-->
<? require_once('./public_header.php');?>

<!--banner层-->
<div class="banner clr">
        <div class="fullSlide">
            <div class="bd">
                <ul style="position: relative; width: 1680px; height: 392px; margin:0 auto">
      	<?php
        $pic = mysql_query("select id,type,title,pic from ".DB_TablePre."content where type in(7) and pic != '' order by adate desc limit 0,5");
        while($row = mysql_fetch_row($pic)){
    			?>
                <li><a href="#none"  style="background-image: url(<?=$row[3]?>);left: 0px; top: 0px; display: list-item; background-position: 50% 0px; background-repeat: no-repeat no-repeat;"></a></li>
                <? }  ?>                	
                </ul>
            </div>
            <div class="hd"><ul></ul></div>
            <span class="prev" style="opacity: 0.0392; display: inline;"></span>
            <span class="next" style="opacity: 0.0392; display: inline;"></span>
        </div>
</div>
<!--公告bulletin层-->
<div class="bulletin">
	<div class="commonWidth">
    	<div id="news-slide">
           <?
            $conn->query("select id,type,title,adate from site_content where type in(15,16,17) and isHeadlines='1' order by adate desc limit 8");
			while($rs = $conn->fetch_array()){
				$date = FormatTime(1,$rs["adate"]);
			?>
            <div class="item"><a href="./view.php?aid=<?=$rs["id"]?>" title="<?=$rs['title']?>"><?=KillWord($rs["title"],28)?><span><?=$date?></span></a><a href="./page.php?cid=<?=$rs["type"]?>" class="more">更多新闻</a></div>
           	<? }?>
        </div>
	</div>
</div>
<!--内容content层-->
<div class="content">
    <div class="commonWidth">
        <div id="wrapper">
            <div id="slider">
 			  <?
				$conn->query("select id,type,title,adate,content,pic,jumpUrl from site_content where type in(26) order by adate desc");
				while($rs = $conn->fetch_array()){
					$date = FormatTime(1,$rs["adate"]);
					$content = replaceHtmlAndJs($rs['content']);
					if($rs['jumpUrl']!=''){
						$alink = $rs['jumpUrl'];
					}else{
						$alink = "/view.php?aid=".$rs['id'];
					}
				?>
                <div class="slide" style="background-image:url(<?=$rs['pic']?>)">
                    <a href="<?=$alink?>"><div class="slide-block">
                        <h4><?=$rs['title']?></h4>
                        <p><?=KillWord($content,80)?></p>
                    </div></a>
                </div>
                <?
                }
			   ?>  
                
                
            </div>
        </div>
    </div>
</div>

<!--footer底部层-->
<? require_once('./public_footer.php');?>

<script type="text/javascript">	
	//内容展示【润德地产内容处】
	$(function() {
	$('#slider').carouFredSel({
	width: '100%',
	align: false,
	items: 4,
	items: {
	width: $('#wrapper').width() * 0.2,
	height: 220,
	visible: 1,
	minimum: 1
	},
	scroll: {
	items: 1,
	timeoutDuration : 10000,
	onBefore: function(data){
	
	//	find current and next slide
	var currentSlide = $('.slide.active', this),
	nextSlide = data.items.visible,
	_width = $('#wrapper').width();
	
	//	resize currentslide to small version
	currentSlide.stop().animate({
	width: _width * 0.2
	});		
	currentSlide.removeClass( 'active' );
	
	//	hide current block
	data.items.old.add( data.items.visible ).find( '.slide-block' ).stop().fadeOut();					
	
	//	animate clicked slide to large size
	nextSlide.addClass( 'active' );
	nextSlide.stop().animate({
	width: _width * 0.4
	});						
	},
	onAfter: function(data) {
	//	show active slide block
	data.items.visible.last().find( '.slide-block' ).stop().fadeIn();
	}
	},
	onCreate: function(data){
	
	//	clone images for better sliding and insert them dynamacly in slider
	var newitems = $('.slide',this).clone( true ),
	_width = $('#wrapper').width();
	
	$(this).trigger( 'insertItem', [newitems, newitems.length, false] );
	
	//	show images 
	$('.slide', this).fadeIn();
	$('.slide:first-child', this).addClass( 'active' );
	$('.slide', this).width( _width * 0.2 );
	
	//	enlarge first slide
	$('.slide:first-child', this).animate({
	width: _width * 0.4
	});
	
	//	show first title block and hide the rest
	$(this).find( '.slide-block' ).hide();
	$(this).find( '.slide.active .slide-block' ).stop().fadeIn();
	}
	});
	
	//	Handle click events
	$('#slider').children().click(function() {
	$('#slider').trigger( 'slideTo', [this] );
	});
	
	//	Enable code below if you want to support browser resizing
	$(window).resize(function(){
	
	var slider = $('#slider'),
	_width = $('#wrapper').width();
	
	//	show images
	slider.find( '.slide' ).width( _width * 0.2 );
	
	//	enlarge first slide
	slider.find( '.slide.active' ).width( _width * 0.4 );
	
	//	update item width config
	slider.trigger( 'configuration', ['items.width', _width * 0.2] );
	});
	
	});
	//控制左右按钮显示【banner滚动处】 
		jQuery(".fullSlide").hover(function(){ jQuery(this).find(".prev,.next").stop(true,true).fadeTo("show",0.5) },function(){ jQuery(this).find(".prev,.next").fadeOut() });

		//调用SuperSlide 
		jQuery(".fullSlide").slide({ titCell:".hd ul", mainCell:".bd ul", effect:"fold",  autoPlay:true, autoPage:true, trigger:"click",
			startFun:function(i){
				var curLi = jQuery(".fullSlide .bd li").eq(i); /* 当前大图的li */
				if( !!curLi.attr("_src") ){
					curLi.css("background-image",curLi.attr("_src")).removeAttr("_src") /* 将_src地址赋予li背景，然后删除_src */
				}
			}
		});
		//菜单		
		jQuery("#navmenu").slide({ type:"menu", titCell:".nLi", targetCell:".sub",effect:"slideDown",delayTime:300,triggerTime:0,defaultPlay:false,returnDefault:true});
	// 新闻轮播
    (function() {
        var sup   = $('#news-slide'),
            items = sup.children(),
            first = items.eq(0);

        win.on('load', function() {auto();});

        function slide(elem) {
            elem = first;
            first.animate({'margin-top':-57}, 500, function() {
                first = first.next();
                sup.append(elem.css('margin-top', 0));
            });
            auto();
        }

        function auto() {
            setTimeout(function(){
                slide();
            }, 5000);
        }
    }());
</script>
</body>
</html>
