﻿//页面加载
$(document).ready(function(){     
$('DL DT a,.PICBOX UL LI a,.UL T LI a,.S UL LI a').click(    
function(){     
myloadoriginal = this.text; $(this).text('嘿咻嘿咻！页面努力加载中 ...');     
var myload = this; setTimeout(function()    
{ $(myload).text(myloadoriginal); }, 6000);     
});     
});   


//tab1
function cur(ele){ 
	$(ele).addClass("SELECTED").siblings().removeClass("SELECTED"); 
} 
function tab(id_tab,tag_tab,id_con,tag_con,act){ 
	$(id_tab).find(tag_tab).eq(0).addClass("SELECTED"); 
	$(id_con).find(tag_con).eq(0).show().siblings(tag_con).hide(); 
	if(!act){ act="click"}; 
	if(act=="click"){ 
	$(id_tab).find(tag_tab).each(function(i){ 
	$(id_tab).find(tag_tab).eq(i).click(function(){ 
	cur(this); 
	$(id_con).find(tag_con).eq(i).show().siblings(tag_con).hide();})}) 
} if(act=="mouseover"){ 
	$(id_tab).find(tag_tab).each(function(i){ 
	$(id_tab).find(tag_tab).eq(i).mouseover(function(){ 
	cur(this); 
	$(id_con).find(tag_con).eq(i).show().siblings(tag_con).hide(); 
})})} 
} 
//

(function () {
    $.fn.infiniteCarousel = function () {
        function repeat(str, n) {
            return new Array( n + 1 ).join(str);
        }
        return this.each(function () {
            // magic!
            var $wrapper = $('> div', this).css('overflow', 'hidden'),
                $slider = $wrapper.find('> ul').width(9999),
                $items = $slider.find('> li'),
                $single = $items.filter(':first')
                
                singleWidth = $single.outerWidth(),
                visible = Math.ceil($wrapper.innerWidth() / singleWidth),
                currentPage = 1,
                pages = Math.ceil($items.length / visible);
            /* TASKS */
            // 1. pad the pages with empty element if required
            if ($items.length % visible != 0) {
                // pad
                $slider.append(repeat('<li class="empty" />', visible - ($items.length % visible)));
                $items = $slider.find('> li');
            }
            // 2. create the carousel padding on left and right (cloned)
            $items.filter(':first').before($items.slice(-visible).clone().addClass('cloned'));
            $items.filter(':last').after($items.slice(0, visible).clone().addClass('cloned'));
            $items = $slider.find('> li');
            // 3. reset scroll
            $wrapper.scrollLeft(singleWidth * visible);
            // 4. paging function
            function gotoPage(page) {
                var dir = page < currentPage ? -1 : 1,
                    n = Math.abs(currentPage - page),
                    left = singleWidth * dir * visible * n;
                $wrapper.filter(':not(:animated)').animate({
                    scrollLeft : '+=' + left
                }, 500, function () {
                    // if page == last page - then reset position
                    if (page > pages) {
                        $wrapper.scrollLeft(singleWidth * visible);
                        page = 1;
                    } else if (page == 0) {
                        page = pages;
                        $wrapper.scrollLeft(singleWidth * visible * pages);
                    }
                    currentPage = page;
                });
            }
            // 5. insert the back and forward link
            $wrapper.after('<a href="#" class="arrow back">&lt;</a><a href="#" class="arrow forward">&gt;</a>');
            // 6. bind the back and forward links
            $('a.back', this).click(function () {
                gotoPage(currentPage - 1);
                return false;
            });
            $('a.forward', this).click(function () {
                gotoPage(currentPage + 1);
                return false;
            });
            $(this).bind('goto', function (event, page) {
                gotoPage(page);
            });
            // THIS IS NEW CODE FOR THE AUTOMATIC INFINITE CAROUSEL
            $(this).bind('next', function () {
                gotoPage(currentPage + 1);
            });
        });
    };
})(jQuery);

//================
function resizepic(thispic){
	if(thispic.width>650) thispic.width=650;
}

//无级缩放图片大小
function bbimg(o){
	var zoom=parseInt(o.style.zoom, 10)||100;
	zoom+=event.wheelDelta/12;
	if (zoom>0) o.style.zoom=zoom+'%';
	return false;
}

function showMood(){
	$("#MOOD").load(str00+"/themes/Sean_Cms/plugin/Sean_case/Sean_Action.asp?act=showmood");
﻿}

function ShowLabel(c,id,str){
	switch (c){ 
	case 1: ﻿idbox="."+id;break;
	case 2: idbox="#"+id;break;
	}$(idbox).load(str00+"/themes/Sean_Cms/INCLUDE/"+str+".TXT");
};
//flash幻灯开始
$(function(){
	var len  = $(".num > li").length;
	var index = 0;
	var adTimer;
	$(".num li").mouseover(function(){
	  index  =   $(".num li").index(this);
	  showImg(index);
	}).eq(0).mouseover();	
	
	$('.FLASH_IMG').hover(function(){clearInterval(adTimer);
	   },function(){
		   adTimer = setInterval(function(){
			  index++;
			  if(index==len){index=0;}
			  showImg(index);	
			} , 5000);
	}).trigger("mouseleave");
})

function showImg(index){
	var adHeight = $(".FLASH_IMG").height();
	$(".slider").stop(true,false).animate({top : -adHeight*index},1000);
	$(".num li").removeClass("on")
		.eq(index).addClass("on");
}
//flash幻灯结束
$(document).ready(function(){
    pageLabel();displayPage(1);//置顶分页控制
    var autoscrolling = true;
    $('.infiniteCarousel').infiniteCarousel().mouseover(function(){autoscrolling=false;}).mouseout(function(){autoscrolling=true;});
    setInterval(function(){if (autoscrolling){$('.infiniteCarousel').trigger('next');}},5000);
    $('.backtotop').click(function(){$('html,body').animate({scrollTop: '0px'},1000);return false;});
	tab("#TRI","LI","#PICBOX","UL","mouseover");
	tab("#TRI_SIDEBAR","LI","#PICBOX_SIDEBAR","UL","mouseover");
	showMood();var id1=0;id1=window.setInterval("showMood()",60000);
});


jQuery(function($) {
       //附件图标
　    $("a[href$=.doc]").addClass("doc");
　    $("a[href$=.exe]").addClass("exe");
        $("a[href$=.pdf]").addClass("pdf");
        $("a[href$=.7z]").addClass("7z");
        $("a[href$=.zip]").addClass("zip"); 
        $("a[href$=.rar]").addClass("rar"); 
        $("a[href^= http://www.rayfile.com]").addClass("rayfile"); 
        $("a[href^= http://www.dbank.com]").addClass("dbank"); 
        $("a[href^= http://dl.dbank.com]").addClass("dbank"); 
        $("a[href^= http://d.namipan.com]").addClass("nami");  
        $("a[href^= http://u.xunzai.com]").addClass("xunzai"); 
        $("a[href^=thunder://]").addClass("thunder");  
        $("a[href^=Flashget://]").addClass("Flashget");  
        $("a[href^=qqdl://]").addClass("qqd");  
        $("a[href^=ed2k://]").addClass("ed2k");
});

jQuery(document).ready(function($){
$("#friendly-txt a").each(function(e){
$(this).prepend("<img src=http://www.google.com/s2/favicons?domain="+this.href.replace(/^(http:\/\/[^\/]+).*$/, '$1').replace( 'http://', '' )+" style=float:left;padding:5px;/>");
});
});


//返回顶部
var scrolltotop={
	//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
	//scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
	setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
	controlHTML: '<img src="up.gif" style="width:11px; height:32px" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
	controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
	anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links

	state: {isvisible:false, shouldvisible:false},

	scrollup:function(){
		if (!this.cssfixedsupport) //if control is positioned using JavaScript
			this.$control.css({opacity:0}) //hide control immediately after clicking it
		var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
		if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
			dest=jQuery('#'+dest).offset().top
		else
			dest=0
		this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
	},

	keepfixed:function(){
		var $window=jQuery(window)
		var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
		var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
		this.$control.css({left:controlx+'px', top:controly+'px'})
	},

	togglecontrol:function(){
		var scrolltop=jQuery(window).scrollTop()
		if (!this.cssfixedsupport)
			this.keepfixed()
		this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
		if (this.state.shouldvisible && !this.state.isvisible){
			this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
			this.state.isvisible=true
		}
		else if (this.state.shouldvisible==false && this.state.isvisible){
			this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
			this.state.isvisible=false
		}
	},
	
	init:function(){
		jQuery(document).ready(function($){
			var mainobj=scrolltotop
			var iebrws=document.all
			mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
			mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
			mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
				.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
				.attr({title:'TOP'})
				.click(function(){mainobj.scrollup(); return false})
				.appendTo('body')
			if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
				mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
			mainobj.togglecontrol()
			$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
				mainobj.scrollup()
				return false
			})
			$(window).bind('scroll resize', function(e){
				mainobj.togglecontrol()
			})
		})
	}
}

scrolltotop.init()


//分享代码
var title = document.title ;
var url = window.location.href;
function share_this(target, u, t) {
if (t == "") {
var share = target+'?'+u+'='+url;
} else {
var share = target+'?'+u+'='+url+'&'+t+'='+title;
}
window.open(share);
}



//textarea counter
function countChar(textareaName,spanName){
	document.getElementById(spanName).innerHTML = parseInt(intMaxLen) - document.getElementById(textareaName).value.length;
	if (parseInt(document.getElementById(spanName).innerHTML) > 0)
	{
	document.getElementById(spanName).className = "counterPos";
	}else{
	document.getElementById(spanName).className = "counterNeg";
}
}


/*
//已输入字数统计
function countChar(textareaName,spanName){
document.getElementById(spanName).innerHTML = document.getElementById(textareaName).value.length;
}
*/

//建站时间统计
<!-- 
function show_date_time(){ 
  window.setTimeout("show_date_time()", 1000); 
  BirthDay=new Date("02/14/2009 19:45:30"); //这里输入你的建站时间
  today=new Date(); 
  timeold=(today.getTime() - BirthDay.getTime()); 
  sectimeold=timeold/1000 
  secondsold=Math.floor(sectimeold); 
  msPerDay=24*60*60*1000 
  e_daysold=timeold/msPerDay 
  daysold=Math.floor(e_daysold); 
  e_hrsold=(e_daysold-daysold)*24; 
  hrsold=Math.floor(e_hrsold); 
  e_minsold=(e_hrsold-hrsold)*60; 
  minsold=Math.floor((e_hrsold-hrsold)*60); 
  seconds=Math.floor((e_minsold-minsold)*60); 
  $("#times").html("<span>跟小妞一起已有:"+daysold+ "天" +hrsold+"小时"+minsold+"分"+seconds+"秒"+"</span>");
} 
show_date_time(); 
//--> 



//置顶分页
var pageSize = 8;  //每页显示的记录数   
function displayPage(page){      
    $("#pageLabel a").removeClass("intro");  //移除所有分页链接的intro样式    
    $("#pageLabel a#p"+page).addClass("intro");   //给当前页面的分页链接增加intro样式   
    var begin=(page-1)*pageSize;//起始记录号      
    var end=page*pageSize;//终止记录号      
    $("ul#TOP_ART li").hide();      
    $("ul#TOP_ART li").each(function(i){      
        if(i>=begin && i<end)//显示第page页的记录      
        $(this).show();      
    });      
    return false;      
}      
     
function pageLabel(){      
    var page=($("ul#TOP_ART li").length-1)/pageSize+1;//根据记录条数，计算页数      
    var pageLabel=''     
    for(i=1;i<=page;i++)      
            pageLabel+="<a href='javascript:void("+i+")' id='p"+i+"' onclick='displayPage("+i+");'>"+i+"</a>";    $("#pageLabel").html(pageLabel);//显示分页控制列表      
} 

//复制文章地址
function copyThreadUrl(obj) {
	window.clipboardData.setData("Text",obj.alt + '\n' + obj.u);
	alert("复制成功,您可以发送给你的好友啦!");
	return false;
}


//文章字体大中小
function put_layer(no){   
     if ( !!no ){    
        obj = document.getElementById("put_layer" + no);   
        if ( obj.style.display != "none" ) {   
            obj.style.display = "none";    
        }   
       else {   
           obj.style.display = "block";   
        }}    
}   
function setfs(id){   
    document.getElementById('article_content').style.fontSize=id+"px";   
}   
function setbg(id){   
document.getElementById('article_content').style.backgroundColor=id;   
}   
function setfc(id){   
document.getElementById('article_content').style.color = id;   
}  


//链接平移
jQuery(document).ready(function($){
$('#NEW_INFO_LIST a').hover(function() {
$(this).stop().animate({'left': '8px'}, 'fast');
}, function() {
$(this).stop().animate({'left': '0px'}, 'fast');
});
});

