function featuredcontentslider_init(a) {
featuredcontentslider.init(a)
}
var featuredcontentslider = {
settingcaches: {},
init: function(a) {
if (this.$(a.id) == null) return;
this.settingcaches[a.id] = a;
a.contentdivs = [];
a.toclinks = [];
a.topzindex = 0;
a.currentpage = a.playtab || 1;
a.prevpage = a.currentpage;
a.etype = "on" + (a.revealtype || "click");
a.curopacity = 0;
this.buildpaginate(a)
},
buildpaginate: function(b) {
this.buildcontentdivs(b);
var e = this.$(b.id),
f = this.$("paginate-" + b.id),
j = "",
i = b.toc,
d = b.nextprev;
if (typeof i == "string" && i != "markup" && i != "scroll" || typeof i == "object") {
for (var c = 1; c <= b.contentdivs.length; c++) {
j += '' + (typeof i == "string" ? i.replace(/#increment/, c) : i[c - 1]) + ' '
}
j = (d[0] != '' ? '' + d[0] + ' ': '') + j + (d[1] != '' ? '' + d[1] + '': '');
f.innerhtml = '' + j + ''
}
var h = [],
m = f.getelementsbytagname("*");
for (var c = 0; c < m.length; c++) {
if (m[c].nodetype == 1) h.push(m[c])
}
var k = 0,
n = this;
for (var c = 0; c < h.length; c++) {
if (this.css(h[c], "toc", "check")) {
if (k > b.contentdivs.length - 1) {
h[c].style.display = "none";
continue
}
if (i == "scroll") {
if (!k) {
var o = f.getelementsbytagname("div");
this.masker = o[0];
this.maskee = o[1];
this.thumbwidth = [0]
}
var l = this.thumbwidth,
g = h[c];
g.style.stylefloat = g.style.cssfloat = "left";
l.push(l[l.length - 1] + g.offsetwidth + this.style(g, "marginleft", true) + this.style(g, "marginright", true) + this.style(g, "borderleftwidth", true) + this.style(g, "borderrightwidth", true))
}
h[c].setattribute("rel", ++k);
h[c][b.etype] = function() {
var a = this.getattribute("rel");
if (n.delaytimer) window.cleartimeout(n.delaytimer);
n.delaytimer = window.settimeout(function() {
featuredcontentslider.turnpage(b, a)
},
b.delay);
return false
};
b.toclinks.push(h[c])
} else if (this.css(h[c], "prev", "check") || this.css(h[c], "next", "check")) {
h[c].onclick = function() {
featuredcontentslider.turnpage(b, this.classname);
return false
}
}
}
this.turnpage(b, b.currentpage, true);
if (b.autorotate[0]) {
f[b.etype] = function() {
return false
};
e["onmouseover"] = f["onmouseover"] = function() {
featuredcontentslider.cleartimer(b, window["fcsautorun" + b.id]);
return true
};
e["onmouseout"] = f["onmouseout"] = function() {
featuredcontentslider.autorotate(b);
return true
};
b.autorotate[1] = b.autorotate[1] + (1 / b.enablefade[1] * 80);
this.autorotate(b)
}
},
buildcontentdivs: function(a) {
var b = this.$(a.id).getelementsbytagname("div");
for (var e = 0; e < b.length; e++) {
if (this.css(b[e], "contentdiv", "check")) {
a.contentdivs.push(b[e]);
b[e].style.display = "none";
b[e].style.overflow = "hidden"
}
}
},
jumpto: function(a, b) {
this.turnpage(this.settingcaches[a], b)
},
turnpage: function(a, b, e) {
var f = a.currentpage,
j = a.contentdivs,
i = j.length,
d = (/prev/i.test(b)) ? f - 1 : (/next/i.test(b)) ? f + 1 : b | 0;
d = (d < 1) ? i: (d > i) ? 1 : d;
if (d == a.currentpage && typeof e == "undefined") return;
a.currentpage = d;
j[a.prevpage - 1].style.display = "none";
j[d - 1].style.zindex = ++a.topzindex;
this.cleartimer(a, window["fcsfade" + a.id]);
a.cacheprevpage = a.prevpage;
if (a.enablefade[0]) {
a.curopacity = 0;
this.fadeup(a)
}
j[d - 1].style.visibility = "visible";
j[d - 1].style.display = "block";
if (a.prevpage <= a.toclinks.length) this.css(a.toclinks[a.prevpage - 1], "selected", "remove");
if (d <= a.toclinks.length) this.css(a.toclinks[d - 1], "selected", "add");
a.prevpage = d;
if (a.toc == "scroll") {
var c = this,
h = 0.25,
m = 20,
k = c.masker.clientwidth,
n = a.contentdivs.length,
o = a.toclinks[d - 1],
l = this.thumbwidth[this.thumbwidth.length - 1],
d = k / 2 - o.offsetwidth / 2 - this.thumbwidth[d - 1],
g = c.maskee.currentstyle ? c.maskee.currentstyle["marginleft"] : window.getcomputedstyle(c.maskee, "").getpropertyvalue("margin-left");
g = g.substr(0, g.length - 2) | 0;
d = d <= k - l ? k - l: d;
d = d > 0 ? 0 : d;
function p() {
g += (d - g) * h;
if (math.round(d - g) == 0) {
window.clearinterval(c.thumbtimer);
return
}
c.maskee.style.marginleft = math.ceil(g) + "px"
}
if (c.thumbtimer) window.clearinterval(c.thumbtimer);
c.thumbtimer = window.setinterval(p, m)
}
},
setopacity: function(a, b) {
var e = a.contentdivs[a.currentpage - 1];
e.classname = "contentdiv sliderfilter";
e.style.csstext += ";filter:alpha(opacity=" + b * 100 + ");-moz-opacity:" + b + ";opacity:" + b;
a.curopacity = b
},
fadeup: function(a) {
if (a.curopacity <= 0.95) {
this.setopacity(a, a.curopacity + a.enablefade[1]);
window["fcsfade" + a.id] = settimeout(function() {
featuredcontentslider.fadeup(a)
},
25)
} else {
this.setopacity(a, 1);
var b = a.contentdivs[a.currentpage - 1];
b.classname = "contentdiv";
if (a.cacheprevpage != a.currentpage) a.contentdivs[a.cacheprevpage - 1].style.display = "none"
}
},
cleartimer: function(a, b) {
if (b) {
cleartimeout(b);
clearinterval(b);
if (a.cacheprevpage != a.currentpage) {
a.contentdivs[a.cacheprevpage - 1].style.display = "none"
}
}
},
css: function(a, b, e) {
var f = new regexp("(^|\\s+)" + b + "($|\\s+)", "ig");
if (e == "check") return f.test(a.classname);
else if (e == "remove") a.classname = a.classname.replace(f, "");
else if (e == "add") a.classname += " " + b
},
style: function(a, b, e) {
var f;
if (a.currentstyle) {
f = a.currentstyle[b]
} else if (window.getcomputedstyle) {
b = b.replace(/([a-z])/g, "-$1");
b = b.tolowercase();
f = window.getcomputedstyle(a, "").getpropertyvalue(b)
}
return ! e ? f: f.substr(0, f.length - 2) | 0
},
autorotate: function(a) {
window["fcsautorun" + a.id] = setinterval(function() {
featuredcontentslider.turnpage(a, "next")
},
a.autorotate[1])
},
$: function(a) {
return document.getelementbyid(a)
}
}