/*function area*/


/*use*/
$(function () {

$.extend({
	noCopy:function(){
		function noSelect() {
			return false;
		} 
		function rClick() { 
			if(event.button==2) 
				return false;
				//alert("您好，该网页不支持鼠标右键。");
		}
		function CtrlKeyDown(){ 
			if(event.ctrlKey) return false;
		}
		document.onkeydown=CtrlKeyDown; 
		document.onselectstart=noSelect; 
		document.onmousedown=rClick; 
	}
});

if ($('.ul_side').length) {
	$('.ul_side ul li.now').parents('li').addClass('on');
}

if($('#index_scrollShow').length){
var marqueeShow=new Marquee("index_scrollShow");
marqueeShow.Direction="left";
marqueeShow.Step=2;
marqueeShow.Width=873;
marqueeShow.Height=80;
marqueeShow.Timer=30;
marqueeShow.ScrollStep=1;
marqueeShow.Start();
$('#span_botLast').mouseover(function(){marqueeShow.Direction=3});
$('#span_botNext').mouseover(function(){marqueeShow.Direction=2});
}

if($('#member_scrollShow').length){
var marqueeShow=new Marquee("member_scrollShow");
marqueeShow.Direction="left";
marqueeShow.Step=1;
marqueeShow.Width=642;
marqueeShow.Height=80;
marqueeShow.Timer=5;
marqueeShow.ScrollStep=1;
marqueeShow.Start();
$('#span_botLast').mouseover(function(){marqueeShow.Direction=3});
$('#span_botNext').mouseover(function(){marqueeShow.Direction=2});

}


if ($('.scrollBox_a1').length) {
	var bigImg = $('.scrollBox_a1 .div_bigImg');
	var img_bot = $('.ul_scroll_a1 img');
	var size = img_bot.size();
	var nowIndex = 0; //定义全局指针
	var index;//定义全局指针
	var startRun;//预定义自动运行参数
	var delayRun;//预定义延迟运行参数

//主切换函数
function fadeAB () {
	if (nowIndex != index) {
		img_bot.removeClass().eq(index).addClass('now');
		bigImg.eq(nowIndex).fadeOut(1000);
		bigImg.eq(index).fadeIn(1000);
		nowIndex = index;
		clearInterval(startRun);//重置自动切换函数
		startRun = setInterval(runNext,5000);
	}

}

//切换到下一个
function runNext() {
	index =  (nowIndex+1)%size;
	fadeAB();
}
//初始化
	bigImg.eq(0).show();
	img_bot.eq(0).addClass('now');
//点击任一图片
	img_bot.click(function () {
		index = img_bot.index($(this));
		fadeAB();
		return false;
	});
	img_bot.mouseover(function () {
		index = img_bot.index($(this));
		delayRun = setTimeout(fadeAB,300);
	});
	img_bot.mouseout(function () {
		clearTimeout(delayRun);
	});
//点击上一个
	$('.scrollBox_a1 .a_next').click(function () {
		runNext();
		return false;
	});
//点击下一个
	$('.scrollBox_a1 .a_last').click(function () {
		index = (nowIndex+size-1)%size;
		fadeAB();
		return false;
	});
//自动运行
	startRun = setInterval(runNext,5000);

}





/*相册*/ 
if($("#albumAbsBox").length){
var a=0;
var b=0;
var imgC=$("#ul_scoller img");
var c=$("#ul_scoller a").length;
var d=c-5;
var n;
var maxW=656;
var timeOut;

/*宽高自适应*/
function autoWH() {
$("#a_bigShow img").css({width:'auto',height:'auto'});
var w = $("#a_bigShow img").width();
var h = $("#a_bigShow img").height();
//alert(w+","+h);
if(w>maxW){h=maxW*h/w,w=maxW}
$("#a_bigShow img").css({width:w+"px",height:h+"px"});
}

/*主要变化函数*/
function changeMain(x) {
	var aRel=imgC.eq(x).attr("longdesc");
	var  photoDetails=$("#ul_scoller span").eq(x).html();
	$("#ul_scoller a").removeClass("now").eq(x).attr("class","now");
	$("#a_bigShow img").attr("src",aRel);
	$("#a_bigShow").attr("href",aRel);
	$("#p_photoDetails").html(photoDetails);
	$("#photoNow").text(x+1);
	var timeOut = setTimeout(autoWH,100);	
}

/*图片居中函数*/
function autoCenter(index) {
	n=index-2;
	if(n<0){$("#ul_scoller").animate({marginLeft:0}, "");	 a=0;	
	}else if(n>d){
	$("#ul_scoller").animate({marginLeft:-126*d}, "");	a=d;
	}else{
	$("#ul_scoller").animate({marginLeft:-126*n}, "");	a=index-2;
	}
}


/*初始化*/
$("#photoAll").text(c);
changeMain(0);


/*切换大图*/ 
$("#ul_scoller a").click(function(){
	var index = $("#ul_scoller a").index($(this));
	changeMain(index);
	b=index;
	return false;
})


/*上下按钮翻页*/
$("#a_photoPrev").click(function() {
	if (b>0) {b--;changeMain(b);}
	if (c>5) {autoCenter(b);}
	return false;
});

$("#a_photoNext").click(function() {
	if (b<c-1) {b++;changeMain(b);}
	if (c>5) {autoCenter(b);}
	return false;	
});


/*左右每点击一下，滚动一张*/ 

$("#aAPrev").click(function(){
if(a>0){
	$("#ul_scoller").animate({"marginLeft": "+=126"}, "");
	a--;
}
	return false;
});

$("#aANext").click(function(){
if (a<d){
	$("#ul_scoller").animate({"marginLeft": "-=126"}, "");
	a++;
}
	return false;
});


/*点击图片，图片居中*/ 
function absClickScoller() {
	$("#ul_scoller a").click(function(){
	var index = $("#ul_scoller a").index($(this));
	autoCenter(index);
	return false;	
});

}


/*条件判断，调用*/ 
if (c<5) {
	
}else{
	absClickScoller();/*点击图片，图片居中*/ 
}


}





if($(".form_comment").length>0){
var boxHtml ='<div class="popBox" id="alertBox"><h2><span>提示</span><a href="#" class="popClose alertClose">关 闭</a></h2><p class="alertIn"></p></div>';
$("body").append(boxHtml);


window.alertBox=function(pIn) {
$(".alertIn").html(pIn);
var h =  $('#alertBox').height();
$("#alertBox").css({'margin-top':-(h/2+10)}).fadeIn();
if($.browser.msie&&($.browser.version == "6.0")&&!$.support.style ){
$("select").css("visibility","hidden");}
}


$(".alertClose").click(function(){
$("#alertBox").fadeOut("fast");
$("select").css("visibility","visible");
return false;});

}








});

var extension = '.php';






