﻿                jQuery(function(){
                if (!$('#slidePic')[0]) 
                return;
                var i = 0, p = $('#slidePic ul'), pList = $('#slidePic ul li'), len = pList.length;
                var elePrev = $('#prev'), eleNext = $('#next');
                //var firstClick = false;
                var w = 134, num = 2;  
                p.css('width',w*len);
                if (len <= num) 
                eleNext.addClass('gray');
                function prev(){
                if (elePrev.hasClass('gray')) {
                //alert('已经是第一张了');
                return; 
                }
                p.animate({ 
                marginTop:-(--i) * w
                },10);
                if (i < len - num) {
                eleNext.removeClass('gray');
                }
                if (i == 0) {
                elePrev.addClass('gray');
                }
                }
                function next(){
                if (eleNext.hasClass('gray')) {
                //alert('已经是最后一张了');
                return;
                }
                //p.css('margin-left',-(++i) * w);
                p.animate({
                marginTop:-(++i) * w
                },10);
                if (i != 0) {
                elePrev.removeClass('gray');
                }
                if (i == len - num) {
                eleNext.addClass('gray');
                }
                }
                elePrev.bind('click',prev);
                eleNext.bind('click',next);
                pList.each(function(n,v){
                $(this).click(function(){
                //if(n-i == 2){
//                next();
//                }
//                if(n-i == 0){
//                prev()
//                }
                //$('#slidePic ul li.cur').removeClass('cur');
                //$(this).addClass('cur');
                //show(n);
                }).mouseover(function(){
                //$(this).addClass('hover');
                //}).mouseout(function(){
               // $(this).removeClass('hover');
                })
                }); 
                function show(i){
                //var ad = areaDailyList[i]; 
                //$('#dailyContent').html(ad.content);
                //var shareRRUrl = encodeURIComponent('http://www.nuomi.com/share365/'+ad.id);
                //var shareUrl = encodeURIComponent('http://www.nuomi.com/#reading');
                //var shareTitle = encodeURIComponent(ad.title + 'http://www.lanrentuku.com');
                //var shareContent = encodeURIComponent(ad.content.substring(0,100)+'...');
                
                }
                });
