//滚动图片js特效=========================================================开始	 
(function(a){
    a.fn.amazon_scroller=function(p){
        var p=p||{};

        var g=p&&p.scroller_time_interval?p.scroller_time_interval:"3000";
        var h=p&&p.scroller_title_show?p.scroller_title_show:"enable";
        var i=p&&p.scroller_window_background_color?p.scroller_window_background_color:"white";
        var j=p&&p.scroller_window_padding?p.scroller_window_padding:"5";
        var k=p&&p.scroller_border_size?p.scroller_border_size:"1";
        var l=p&&p.scroller_border_color?p.scroller_border_color:"black";
        var m=p&&p.scroller_images_width?p.scroller_images_width:"50";
        var n=p&&p.scroller_images_height?p.scroller_images_height:"70";
        var o=p&&p.scroller_title_size?p.scroller_title_size:"12";
        var q=p&&p.scroller_title_color?p.scroller_title_color:"blue";
        var r=p&&p.scroller_show_count?p.scroller_show_count:"5";
        var d=p&&p.directory?p.directory:"images";
        j += "px";
        k += "px";
        m += "px";
        n += "px";
        o += "px";
        var dom=a(this);
        var s;
        var t=0;
        var u;
        var v;
        var w=dom.find("ul:first").children("li").length;
        var x=Math.ceil(w/r);
        if(dom.find("ul").length==0||dom.find("li").length==0){
            dom.append("Require content");
            return null
            }
            dom.find("ul:first").children("li").children("a").children("img").css("width",m).css("height",n);
        if(h=='enable'){
            dom.find("ul:first").children("li").children("a").each(function(){
                $(this).append('<br/>'+$(this).attr("title"))
                })
            }
            s_s_ul(dom,j,k,l,i);
        s_s_nav(dom.find(".amazon_scroller_nav"),d);
        m=parseInt(m);
        dom.find("ul:first").children("li").css("width",m+"px");
        dom.find("ul:first").children("li").children("a").css("color",q);
        dom.find("ul:first").children("li").children("a").css("font-size",o);
        begin();
        play();
        dom.find(".amazon_scroller_nav").children("li").hover(
            function(){
                if($(this).parent().children().index($(this))==0){
                $(this).css("background-position","left -50px");
                }else if($(this).parent().children().index($(this))==1){
                $(this).css("background-position","right -50px");
                }
            },
            function(){
                if($(this).parent().children().index($(this))==0){
                $(this).css("background-position","left top");
                }else if($(this).parent().children().index($(this))==1){
                $(this).css("background-position","right top");
                }
            }
        );
        dom.find(".amazon_scroller_nav").children("li").click(function(){
            if($(this).parent().children().index($(this))==0){
                previous()
                }else if($(this).parent().children().index($(this))==1){
                next()
                }
            });
    function begin(){
        var a=dom.find("ul:first").children("li").outerWidth(true)*w;
        dom.find("ul:first").children("li").hide();
        dom.find("ul:first").children("li").slice(0,r).show();
        u=dom.find("ul:first").outerWidth();
        v=dom.find("ul:first").outerHeight();
        dom.find("ul:first").width(a);
        dom.width(u+60);
        dom.height(v);
        dom.children(".amazon_scroller_mask").width(u);
        dom.children(".amazon_scroller_mask").height(v);
        dom.find("ul:first").children("li").show();
        dom.css("position","relative");
        dom.find("ul:first").css("position","absolute");
        dom.children(".amazon_scroller_mask").width(u);
        dom.children(".amazon_scroller_mask").height(v);
        dom.find(".amazon_scroller_nav").css('top',(v-50)/2+parseInt(j)+"px");
        dom.find(".amazon_scroller_nav").width(u+60)
        }
        function previous(){
        if(t==0){
            t=x-2
            }else{
            if(t==1){
                t=x-1
                }else{
                t-=2
                }
            }
        play()
    }
    function next(){
    play()
    }
    function play(){
    clearTimeout(s);
    dom.find("ul:first").animate({
        left:-(t*u)
        },500);
    t++;
    if(t>=x){
        t=0
        }
        s=setTimeout(play,g)
    }
    function s_s_ul(a,b,c,d,e){
    b=parseInt(b);
    c=parseInt(c);
    var f="border: "+d+" solid "+" "+c+"px; padding:"+b+"px; background-color:"+e;
    a.attr("style",f)
    }
    function s_s_nav(a,d){
    var b=a.children("li:first");
    var c=a.children("li:last");
    a.children("li").css("width","25px");
    a.children("li").css("height","50px");
    a.children("li").css('background-image','url("'+d+'/arrow.gif")');
    c.css('background-position','right top');
    a.children("li").css('background-repeat','no-repeat');
    c.css('right','0px')
    }
}
})(jQuery);
//滚动图片js特效=========================================================结束

//滚动图片参数设置=========================================================开始	
	$(function() {
                
				$("#amazon_scroller3").amazon_scroller({
                    scroller_title_show: 'enable',
                    scroller_time_interval: '3000',
                    scroller_window_background_color: "none",
                    scroller_window_padding: '11',
                    scroller_border_size: '1',
                    scroller_border_color: '#e6e6e6',
                    scroller_images_width: '118',
                    scroller_images_height: '100',
                    scroller_title_size: '12',
                    scroller_title_color: '#555555',
                    scroller_show_count: '7',
                    directory: 'images'
                });
            });
//滚动图片参数设置=========================================================结束



//幻灯图片显示效果设置======================================================开始
$(function(){
	
	// 图片上下翻滚
	var len = $('.slidebtn>ul>li').length;
	var index = 0;
	var autoplay;
	$('.slidebtn li').mouseover(function(){
		index = $('.slidebtn li').index(this);
		showImg(index);
	}).eq(0).mouseover();
	
	$('.slidebox').hover(function(){
		clearInterval(autoplay);
	},function(){
		autoplay = setInterval(function(){
			showImg(index)
			index++;
			if(index==len){
				index=0;
			}
		},3000);
	}).trigger('mouseleave');

	function showImg(index){
		var picheight = $('.slidebox').height();
		$('.slidepic').stop(true,false).animate({top:-picheight*index},600)
		$('.slidebtn li').removeClass('current').eq(index).addClass('current');
	};
	
	
	// 图片左右翻滚
	var size = $('.slidebtn-01>ul>li').length;
	var frist = 0;
	var datetime;
	$('.slidebtn-01 li').mouseover(function(){
		frist = $('.slidebtn-01 li').index(this);
		showpic(frist);
	}).eq(0).mouseover();
	
	$('.slidebox-01').hover(function(){
		clearInterval(datetime);
	},function(){
		datetime = setInterval(function(){
			showpic(frist)
			frist++;
			if(frist==size){
				frist=0;
			}
		},3000);
	}).trigger('mouseleave');

	function showpic(frist){
		var imgheight = $('.slidebox-01').width();
		$('.slidepic-01').stop(true,false).animate({left:-imgheight*frist},600)
		$('.slidebtn-01 li').removeClass('current').eq(frist).addClass('current');
	};
	
});

//图片淡隐淡现
var defaultOpts ={ interval:5000, fadeInTime:300, fadeOutTime:200 };

	var _titles = $("ul.slide-txt li");
	var _titles_bg = $("ul.op li");
	var _bodies = $("ul.slide-pic li");
	var _count = _titles.length;
	var _current = 0;
	var _intervalID = null;
	
	var stop = function(){
		window.clearInterval(_intervalID);
	};
	
	var slide = function(opts){
		if (opts){
			_current = opts.current || 0;
		} else{
			_current = (_current >= (_count - 1)) ? 0 :(++_current);
		};
		_bodies.filter(":visible").fadeOut(defaultOpts.fadeOutTime, function(){
			_bodies.eq(_current).fadeIn(defaultOpts.fadeInTime);
			_bodies.removeClass("current").eq(_current).addClass("current");
		});
		_titles.removeClass("current").eq(_current).addClass("current");
		_titles_bg.removeClass("current").eq(_current).addClass("current");
	}; 
	
	var go = function(){
		stop();
		_intervalID = window.setInterval(function(){
			slide();
		}, defaultOpts.interval);
	}; 
	
	var itemMouseOver = function(target, items){
		stop();
		var i = $.inArray(target, items);
		slide({ current:i });
	};
	
	_titles.hover(function(){
		if($(this).attr('class')!='current'){
			itemMouseOver(this, _titles);
		}else{
			stop();
		}
	}, go);

	_bodies.hover(stop, go);

	go();
//幻灯图片显示效果设置======================================================结束	
	
//搜索关键字检测======================================================开始	
function SearchCheck(formct){
	if (formct.Keys.value=='')
		{
			alert('搜索关键词不可为空,请填写');
			formct.Keys.focus();
			return false; 
		}
}
//搜索关键字检测======================================================结束


// js时间特效======================================================开始
function SetCookie(name,value)//两个参数，一个是cookie的名子，一个是值
{
    var Days = 365; //此 cookie 将被保存 30 天
    var exp  = new Date();    //new Date("December 31, 9998");
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name)//取cookies函数        
{
    var err = "【即时备忘录】在此记录：\n\n●写下您今天的工作安排\n●输入您自己的问候语等\n  随写即入·安全方便";
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
    if(arr != null) return unescape(arr[2]); return err;
}

function textLimitCheck(thisArea, maxLength){
  if (thisArea.value.length > maxLength){
    alert(maxLength + ' 个字限制. \r超出的将自动去除.');
    thisArea.value = thisArea.value.substring(0, maxLength);
    thisArea.focus();
  }
    messageCount.innerText = thisArea.value.length;
}

// -->
function CalConv()
 {
	FIRSTYEAR = 1998;
	LASTYEAR = 2031;

	today = new Date();
	SolarYear = today.getFullYear();
	SolarMonth = today.getMonth() + 1;
	SolarDate = today.getDate();
	Weekday = today.getDay();
	LunarCal = [
 new tagLunarCal( 27, 5, 3, 43, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1 ),
 new tagLunarCal( 46, 0, 4, 48, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1 ), /* 88 */
 new tagLunarCal( 35, 0, 5, 53, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1 ), /* 89 */
 new tagLunarCal( 23, 4, 0, 59, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),
 new tagLunarCal( 42, 0, 1, 4, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),
 new tagLunarCal( 31, 0, 2, 9, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0 ),
 new tagLunarCal( 21, 2, 3, 14, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 ), /* 93 */
 new tagLunarCal( 39, 0, 5, 20, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 ),
 new tagLunarCal( 28, 7, 6, 25, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1 ),
 new tagLunarCal( 48, 0, 0, 30, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1 ),
 new tagLunarCal( 37, 0, 1, 35, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1 ), /* 97 */
 new tagLunarCal( 25, 5, 3, 41, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),
 new tagLunarCal( 44, 0, 4, 46, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),
 new tagLunarCal( 33, 0, 5, 51, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),
 new tagLunarCal( 22, 4, 6, 56, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ), /* 101 */
 new tagLunarCal( 40, 0, 1, 2, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ),
 new tagLunarCal( 30, 9, 2, 7, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),
 new tagLunarCal( 49, 0, 3, 12, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1 ),
 new tagLunarCal( 38, 0, 4, 17, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0 ), /* 105 */
 new tagLunarCal( 27, 6, 6, 23, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1 ),
 new tagLunarCal( 46, 0, 0, 28, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0 ),
 new tagLunarCal( 35, 0, 1, 33, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ),
 new tagLunarCal( 24, 4, 2, 38, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ), /* 109 */
 new tagLunarCal( 42, 0, 4, 44, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 ),
 new tagLunarCal( 31, 0, 5, 49, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0 ),
 new tagLunarCal( 21, 2, 6, 54, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),
 new tagLunarCal( 40, 0, 0, 59, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1 ), /* 113 */
 new tagLunarCal( 28, 6, 2, 5, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0 ),
 new tagLunarCal( 47, 0, 3, 10, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1 ),
 new tagLunarCal( 36, 0, 4, 15, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1 ),
 new tagLunarCal( 25, 5, 5, 20, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ), /* 117 */
 new tagLunarCal( 43, 0, 0, 26, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1 ),
 new tagLunarCal( 32, 0, 1, 31, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0 ),
 new tagLunarCal( 22, 3, 2, 36, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0 ) ];
 /* 民國年每月之日數 all by www.qpsh.com*/
 SolarCal = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];

 /* 民國年每月之累積日數, 平年與閏年 */ 
SolarDays = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 396, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366, 397 ];
	
	
	if ( SolarYear <= FIRSTYEAR || SolarYear > LASTYEAR ) return 1;
	sm = SolarMonth - 1;
		if ( sm < 0 || sm > 11 ) return 2;
		leap = GetLeap( SolarYear );
	if ( sm == 1 )
		d = leap + 28;
	else
		d = SolarCal[sm];
	if ( SolarDate < 1 || SolarDate > d ) return 3;
	y = SolarYear - FIRSTYEAR;
	acc = SolarDays[ leap*14 + sm ] + SolarDate;
	kc = acc + LunarCal[y].BaseKanChih;
	Kan = kc % 10;
	Chih = kc % 12;
	
	Age = kc % 60;
	if ( Age < 22 )
		Age = 22 - Age;
	else
		Age = 82 - Age;
	
	if ( acc <= LunarCal[y].BaseDays ) {
		y--;
		LunarYear = SolarYear - 1;
		leap = GetLeap( LunarYear );
		sm += 12;
		acc = SolarDays[leap*14 + sm] + SolarDate;
	 }
	else
		LunarYear = SolarYear;
			l1 = LunarCal[y].BaseDays;
	for ( i=0; i<13; i++ ) {
		l2 = l1 + LunarCal[y].MonthDays[i] + 29;
		if ( acc <= l2 ) break;
		l1 = l2;
	 }
	LunarMonth = i + 1;
	LunarDate = acc - l1;
	im = LunarCal[y].Intercalation;
	if ( im != 0 && LunarMonth > im ) {
		LunarMonth--;
		if ( LunarMonth == im ) LunarMonth = -im;
	 }
	if ( LunarMonth > 12 ) LunarMonth -= 12;
 today=new Date();
 function initArray(){
 this.length=initArray.arguments.length
 for(var i=0;i<this.length;i++)
 this[i+1]=initArray.arguments[i] }
 var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
 document.write("", today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日&nbsp;",d[today.getDay()+1],"");
 
 months = ["一","二","三","四","五","六","七","八","九","十","十一","十二"];
 
 days = ["初一","初二","初三","初四","初五","初六","初七","初八","初九","初十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十","廿一","廿二","廿三","廿四","廿五","廿六","廿七","廿八","廿九","三十"];
 
	 document.write( "&nbsp;农历"+months[LunarMonth-1]+"月" + days[LunarDate-1] + "");
 
 return 0; 
}
 /* 求此民國年是否為閏年, 返回 0 為平年, 1 為閏年 */
function GetLeap( year )
 {
 if ( year % 400 == 0 )
 return 1;
 else if ( year % 100 == 0 )
 return 0;
 else if ( year % 4 == 0 )
 return 1;
 else
 return 0;
 }
function tagLunarCal( d, i, w, k, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13) {
 this.BaseDays = d; /* 到民國 1 月 1 日到農曆正月初一的累積日數 */
 this.Intercalation = i; /* 閏月月份. 0==此年沒有閏月 */
 this.BaseWeekday = w; /* 此年民國 1 月 1 日為星期幾再減 1 */
 this.BaseKanChih = k; /* 此年民國 1 月 1 日之干支序號減 1 */
 this.MonthDays = [ m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13 ]; /* 此農曆年每月之大小, 0==小月(29日), 1==大月(30日) */
}
// js时间特效======================================================完毕


// js表格特效======================================================开始
$(document).ready(function(){
//demo1:
   //-隔行,滑动,点击 变色
 $('.cssraindemo1 tbody tr:even').addClass('odd');
 $('.cssraindemo1 tbody tr').hover(
  function() {$(this).addClass('highlight');},
  function() {$(this).removeClass('highlight');}
 );
 $('.cssraindemo1 tbody tr').click(
  function() {$(this).toggleClass('selected');}
 );

 // 如果单选框默认情况下是选择的，变色.
 $('.cssraindemo3 input[type="radio"]:checked').parents('tr').addClass('selected');
 
 // 单选框
 $('.cssraindemo3 tbody tr').click(
  function() {
   $(this).siblings().removeClass('selected');
   $(this).addClass('selected');
   $(this).find('input[type="radio"]').attr('checked','checked');
  }
 );
});
 
// js表格特效======================================================完毕