var KcbIndexFlash = {bigPicObjArray:[], bigPicHolderObj:[], smallPicObjArray:[], smallPicHolderObj:[], loadIndex:0, currentPicIndex:0, loadComplete:[], fadeTime:800, jiangeTime:8000, effect:"swing", loopTimeID:0, lockJiaoHu:false, mouseisout:true, picLength:0, init:function () {var index;var tempDivTop = 0;this.picLength = this.flashvars.bigs.length;for (index = 1; index <= this.picLength; index++) {this.bigPicHolderObj[index - 1] = $("<div></div>");this.bigPicHolderObj[index - 1].css({position:"absolute", width:799, height:452, left:-999, top:0, opacity:0,backgroundColor:'#000'});this.bigPicHolderObj[index - 1].append("<a target='_blank' href=" + this.hrefDomain + this.flashvars.hrefs[index - 1] + "></a>");$("#bigPicArea").append(this.bigPicHolderObj[index - 1]);this.smallPicHolderObj[index - 1] = $("<div></div>");this.smallPicHolderObj[index - 1].css({position:"absolute", width:160, height:151, left:0, top:tempDivTop});tempDivTop = index * 150 + index;tempDivTop = tempDivTop < 0 ? 0 : tempDivTop;$("#smallPicAlbum").append(this.smallPicHolderObj[index - 1]);}$("#bigPicArea").append("<img id=\"bigloadgif\" src=\"" + this.picDomain + this.loadPicUrl + "\" alt=\"\" />");KcbIndexFlash.startLoad(0);}, startLoad:function (index) {this.loadComplete[index] = {small:0, big:0};this.bigPicObjArray[index] = $("<img />");this.bigPicObjArray[index].attr("src", this.picDomain + this.flashvars.bigs[index]);this.bigPicObjArray[index].css({position:"absolute", width:799, height:452, left:0, top:0, opacity:1});this.bigPicObjArray[index].load(function () {KcbIndexFlash.loadFinish(index, "big");});this.smallPicObjArray[index] = $("<img />");this.smallPicObjArray[index].attr("src", this.picDomain + this.flashvars.smalls[index]);this.smallPicObjArray[index].css({position:"absolute", width:320, height:150, left:-999, top:0, opacity:0});this.smallPicObjArray[index].hover(function () {$(this).css({left:0});KcbIndexFlash.mouseisout = false;}, function () {KcbIndexFlash.mouseisout = true;var curIndex = KcbIndexFlash.currentPicIndex % KcbIndexFlash.picLength;if (curIndex == index) {return;}$(this).css({left:-160});});this.smallPicObjArray[index].load(function () {KcbIndexFlash.loadFinish(index, "small");});this.smallPicObjArray[index].click(function () {KcbIndexFlash.manualFadeShow(index);});this.bigPicHolderObj[index].children("a").append(this.bigPicObjArray[index]);this.smallPicHolderObj[index].append(this.smallPicObjArray[index]);}, scrollDown:function () {setTimeout(function () {KcbIndexFlash.moveSmallPicHolder(KcbIndexFlash.currentPicIndex + 1);}, this.fadeTime / 2);this.scroll(this.currentPicIndex + 2);}, scroll:function (index) {if (index >= 3) {this.lockJiaoHu = true;$("#smallPicAlbum").css("height", parseInt($("#smallPicAlbum").css("height")) + 151);$("#smallPicAlbum").stop().animate({top:-1 * (index - 2) * 151}, this.fadeTime, this.effect, function () {KcbIndexFlash.moveSmallPicHolder(index);KcbIndexFlash.lockJiaoHu = false;});}}, moveSmallPicHolder:function (index) {if (index >= 3) {var tempIndex = KcbIndexFlash.picLength - 1 + (index - 2);var tempDivTop = tempIndex * 150 + tempIndex;var i = (index - 3) % KcbIndexFlash.picLength;KcbIndexFlash.smallPicHolderObj[i].css({top:tempDivTop});}}, loadFinish:function (index, pic) {this.loadComplete[index][pic] = 1;if (this.loadComplete[index].small + this.loadComplete[index].big == 2) {this.initSmallPic(index);if (index == 0) {$("#bigloadgif").remove();$("#sepb").css("visibility", "visible");var i;for (i = 0; i < this.picLength; i++) {if (i != 0) {this.smallPicHolderObj[i].append("<img id=\"smallLoadPic" + i + "\" src=\"" + this.picDomain + this.loadPicUrl + "\" alt=\"\" style=\"position:absolute;width:24px;height:24px;left:68px;top:62px;\" />");}KcbIndexFlash.smallPicHolderObj[i].append("<div style=\"position:absolute;top:150px;height:1px;background-color:#FFF;width:160px;overflow:hidden;left:0;\"></div>");}setTimeout(function () {KcbIndexFlash.bigPicHolderObj[0].css({left:0}).animate({opacity:1}, KcbIndexFlash.fadeTime);KcbIndexFlash.smallPicObjArray[0].css({left:0});}, 10);}if (index == 2) {this.startLoop();}this.loadIndex++;if (this.loadIndex == this.picLength) {return;}setTimeout(function () {KcbIndexFlash.startLoad(KcbIndexFlash.loadIndex);}, 280);}}, initSmallPic:function (index) {if (index != 0) {setTimeout(function () {$("#smallLoadPic" + index).remove();}, 100);}this.smallPicObjArray[index].css({left:-160});setTimeout(function () {KcbIndexFlash.smallPicObjArray[index].animate({opacity:1}, KcbIndexFlash.fadeTime);}, 10);}, startLoop:function () {this.loopTimeID = setTimeout(function () {KcbIndexFlash.canShowPic();}, this.jiangeTime);}, canShowPic:function () {if (this.mouseisout) {var index = (this.currentPicIndex + 1) % this.picLength;clearTimeout(this.loopTimeID);if (this.loadComplete[index].small + this.loadComplete[index].big == 2) {this.picFadeShow(index);this.currentPicIndex = this.currentPicIndex + 1;this.scrollDown();} else {this.loopTimeID = setTimeout(function () {KcbIndexFlash.canShowPic();}, 500);return;}}this.startLoop();}, picFadeShow:function (index) {var curIndex = this.currentPicIndex % this.picLength;this.bigPicHolderObj[curIndex].animate({opacity:0}, this.fadeTime, this.effect, function () {$(this).css({left:-999});});this.bigPicHolderObj[index].css({left:0}).animate({opacity:1}, this.fadeTime);this.smallPicObjArray[index].css({left:0});this.smallPicObjArray[curIndex].css({left:-160});}, manualFadeShow:function (index) {if (this.lockJiaoHu) {return;}var curIndex = this.currentPicIndex % this.picLength;clearTimeout(this.loopTimeID);this.startLoop();if (index == curIndex) {return;}var c = index - curIndex;if (Math.abs(index - curIndex) == this.picLength - 1) {c = 1;}if (Math.abs(index - curIndex) == this.picLength - 2) {c = 2;}this.picFadeShow(index);this.currentPicIndex = this.currentPicIndex + c;this.scrollDown();}};
