function cFadeCK() { this.nFadeCKCurrentUserSelection = -1; this.oDiv = ""; this.oDiv2 = ""; this.oLink = ""; this.oDivTop = ""; this.oDivBottom = ""; this.oDivCurrent = ""; this.nFadeCount = 0; this.nFadeCKCurrentOpacity = 10; this.rgImages = new Array(); this.rgLinks = new Array(); this.nCurrentHeaderSlideImage = 1; this.bStarted = false; this.szLink = ""; this.szSelectButton = ""; this.nFadeID = 0; this.nLinkType = 1; var _this = this; this.setOpacity = function(oID, val) { if (!this.bStarted) return; var obj = oID; obj.style.MozOpacity = val; obj.style.opacity = val/10; obj.style.filter = 'alpha(opacity=' + val*10 + ')'; } this.divFadeCK = function(szImageDiv1,szImageDiv2,rgImageArray,rgLinkArray,szLink,szSelectButton) { this.oDiv = document.getElementById(szImageDiv1); this.oDiv2 = document.getElementById(szImageDiv2); if (szLink != "") { this.oLink = document.getElementById(szLink); this.szLink = szLink; } if (szSelectButton != "") this.szSelectButton = szSelectButton; this.oDivTop = this.oDiv; this.oDivBottom = this.oDiv2; this.oDivCurrent = this.oDiv; this.rgImages = rgImageArray; this.rgLinks = rgLinkArray; //alert(this.oDivTop); if (this.oDiv == null || this.oDiv2 == null) return; //var nCurrentImage = 1; //if (this.oDiv2.style.zIndex > this.oDiv.style.zIndex) //{ // this.oDivTop = this.oDiv2; // this.oDivBottom = this.oDiv; //} this.nFadeCKCurrentOpacity = 10; this.nFadeCount = 0; this.bStarted = true; setTimeout(function () {_this.fnStartFadeCK();},Math.floor(Math.random()*1000)); } this.fnStartFadeCK = function() { if (!this.bStarted) return; //alert(this.oDivTop); this.nFadeCount++; if (this.nFadeCount > 50) this.nFadeCKCurrentOpacity--; if (this.nFadeCKCurrentUserSelection >= 0) this.fnFadeCKUserChange(); if (this.nFadeCKCurrentOpacity < 1) { if (this.oDivTop == this.oDiv) { this.oDivTop = this.oDiv2; this.oDivBottom = this.oDiv; this.oDivCurrent = this.oDiv2; } else { this.oDivTop = this.oDiv; this.oDivBottom = this.oDiv2; this.oDivCurrent = this.oDiv; } this.oDivTop.style.zIndex = 11;//this.oDiv.style.zIndex; //10; this.oDivBottom.style.zIndex = 10;//this.oDiv2.style.zIndex; //11; this.setOpacity(this.oDivTop,10); this.setOpacity(this.oDivBottom,10); this.nFadeCKCurrentOpacity = 10; var nCurrentIndex = this.nCurrentHeaderSlideImage - 1; if (nCurrentIndex < 0) nCurrentIndex = this.rgImages.length-2; if (this.szSelectButton != "") { strTemp = ""; strTemp = this.szSelectButton + nCurrentIndex; oSelectButtonPrevious = document.getElementById(strTemp); strTemp = this.szSelectButton + this.nCurrentHeaderSlideImage; oSelectButtonNext = document.getElementById(strTemp); oSelectButtonPrevious.className = this.szSelectButton; strTemp = this.szSelectButton + "Current"; oSelectButtonNext.className = strTemp; } this.nCurrentHeaderSlideImage++; if (this.nCurrentHeaderSlideImage >= this.rgImages.length-1) this.nCurrentHeaderSlideImage = 0; this.oDivBottom.style.backgroundImage = "url("+this.rgImages[this.nCurrentHeaderSlideImage]+")"; if (this.nLinkType == 1) { if (this.oLink != undefined && this.oLink != "") this.oLink.href =this.rgLinks[nCurrentIndex+1]; // if (document.links[this.szLink] != undefined) document.links[this.szLink].href = this.rgLinks[nCurrentIndex+1]; } else if (this.nLinkType == 2 && this.rgLinks[nCurrentIndex+1] != "" && this.rgLinks[nCurrentIndex+1] != "undefined") { this.oLink.value = this.rgLinks[nCurrentIndex+1]; } setTimeout(function () {_this.fnStartFadeCK();},100); this.nFadeCount = 0; } else { setTimeout(function () {_this.fnStartFadeCK();},100); //alert(this.oDivTop); this.setOpacity(this.oDivTop,this.nFadeCKCurrentOpacity); } } this.fnFadeCKUserChange = function() { if (!this.bStarted) return; //this.oDivTop.style.backgroundImage = "url("+this.rgImages[this.nFadeCKCurrentUserSelection]+")"; //if (this.oLink != undefined) // this.oLink.href =this.rgLinks[this.nFadeCKCurrentUserSelection]; // //if (document.links["MoreInfoLinkHeader"] != undefined) // document.links["MoreInfoLinkHeader"].href = this.rgLinks[this.nFadeCKCurrentUserSelection]; var nCurrentIndex = this.nCurrentHeaderSlideImage-1; if (nCurrentIndex < 0) nCurrentIndex = this.rgImages.length-2; if (this.szSelectButton != "") { var strTemp = ""; strTemp = this.szSelectButton + nCurrentIndex; oSelectButtonPrevious = document.getElementById(strTemp); strTemp = this.szSelectButton + this.nFadeCKCurrentUserSelection; oSelectButtonNext = document.getElementById(strTemp); oSelectButtonPrevious.className = this.szSelectButton; strTemp = this.szSelectButton + "Current"; oSelectButtonNext.className = strTemp; } //this.nFadeCKCurrentOpacity = 10; this.oDivBottom.style.backgroundImage = "url("+this.rgImages[this.nFadeCKCurrentUserSelection]+")"; this.nFadeCKCurrentOpacity = 0; this.nCurrentHeaderSlideImage = this.nFadeCKCurrentUserSelection this.nFadeCKCurrentUserSelection = -1; } this.fnFadeCKSelect = function(nSelect) { if (!this.bStarted) return; this.nFadeCKCurrentUserSelection = nSelect; } } divFCKHeader = new cFadeCK(); divFCKHeader.nFadeID = 1;