﻿$(document).ready(function(){
	var y=1;
//定义前后按钮鼠触效果
$(".gu_next").hover(
function () {
    $(this).addClass("gu_next1");
  },
  function () {
    $(this).removeClass("gu_next1");
  }


);
$(".gu_prev").hover(
function () {
    $(this).addClass("gu_prev1");
  },
  function () {
    $(this).removeClass("gu_prev1");
  }


);

//定义导航菜单点击函数
$("dd").click(function()
{
$(".boxgu_cent p").remove();
$(".box_gu2").remove();
$(".box_gu").css("display","block");
y=1;
$(".gu_next").show();
$(".gu_prev").css("visibility","hidden");
$("dd").removeClass("cur");
$(this).addClass("cur");
var i=$(this).attr("id");
$(".boxgu_cent .img1").remove();
 $("<img/>").appendTo("#Imageshow").addClass("img1").attr("src","http://mat.esunny.com/v2/images/help/imgarray/demosmall_" +i+"_1.gif");
 $("<p />").appendTo("#Imageshow");
$(".boxgu_cent .img2").attr("src","http://mat.esunny.com/v2/images/help/imgarray/demo_" +i+"_1.jpg");
}
);

//定义向后点击函数
$(".gu_next").click(function()
{
$(".gu_prev").css("visibility","visible");
var i=$("dd.cur").attr("id");
y++;
if(i==1 || i==11 || i==12 || i==14)
{
	if(y>2)
	{
	y=3;
	$(".gu_next").hide();
	}
}
if(i==2)
{
	if(y>7)
	{
	y=8;
	$(".gu_next").hide();
	}
}
if(i==3 || i==4 || i==5 || i==13 || i==15 )
{
	if(y>1)
	{
	y=2;
	$(".gu_next").hide();
	}
}
if(i==6)
{
	if(y>3)
	{
	y=4;
	$(".gu_next").hide();
	}
}
if(i==7 || i==8 || i==9 || i==10)
{
	if(y>4)
	{
	y=5;
	$(".gu_next").hide();
	}
}
$(".boxgu_cent p").remove();
$(".boxgu_cent .img1").remove();
$(".boxgu_cent .img2").fadeOut("100");
$("<img/>").appendTo("#Imageshow").addClass("img1").attr("src","http://mat.esunny.com/v2/images/help/imgarray/demosmall_" +i+"_"+y+".gif");
$("<p />").appendTo("#Imageshow");
$(".boxgu_cent .img2").attr("src","http://mat.esunny.com/v2/images/help/imgarray/demo_" +i+"_"+y+".jpg");
}
);

//定义向前点击函数
$(".gu_prev").click(function()
{
$(".gu_next").show();
var i=$("dd.cur").attr("id");
y--;
if(y<2)
{
	y=1;
	$(".gu_prev").css("visibility","hidden");
	}
$(".boxgu_cent p").remove();
$(".boxgu_cent .img1").remove();
$(".boxgu_cent .img2").fadeOut("100");
$("<img/>").appendTo("#Imageshow").addClass("img1").attr("src","http://mat.esunny.com/v2/images/help/imgarray/demosmall_" +i+"_"+y+".gif");
$("<p />").appendTo("#Imageshow");
$(".boxgu_cent .img2").attr("src","http://mat.esunny.com/v2/images/help/imgarray/demo_" +i+"_"+y+".jpg");
}
)

//定义图片单击函数
$(".boxgu_cent .img2").bind("click",function(){
var i=$("dd.cur").attr("id");
if(i==1 || i==11 || i==12 || i==14)
{
	if(y>2)
	{
	y=3;
	$(".gu_next").hide();
	}
	else{
		$(".gu_next").click();
		}
}
if(i==2)
{
	if(y>7)
	{
	y=8;
	$(".gu_next").hide();
	}
	else{
		$(".gu_next").click();
		}
}
if(i==3 || i==4 || i==5 || i==13 || i==15 )
{
	if(y>1)
	{
	y=2;
	$(".gu_next").hide();
	}
	else{
		$(".gu_next").click();
		}
}
if(i==6)
{
	if(y>3)
	{
	y=4;
	$(".gu_next").hide();
	}
	else{
		$(".gu_next").click();
		}
}
if(i==7 || i==8 || i==9 || i==10)
{
	if(y>4)
	{
	y=5;
	$(".gu_next").hide();
	}
	else{
		$(".gu_next").click();
		}
}
});

});

//定义图片onload函数
function ShowImg(){
$(".boxgu_cent .img1").remove();
$(".boxgu_cent p").remove();
$(".boxgu_cent .img2").hide().fadeIn("0");
}