// Adasoft.WIY.UI.Rotator
//Yılmaz Özçalışkan
//(c) Adasoft
Type.registerNamespace("Adasoft.WIY.UI"); Adasoft.WIY.UI.Rotator = function (element) {
Adasoft.WIY.UI.Rotator.initializeBase(this, [element]); this._sid = '#' + element.id; this._u = 'undefined'; if (typeof (window.jQuery) != this._u) { window.jQuery(this._sid).show().find('img').each(function () { window.jQuery('')[0].src = this.src; }); }
this._params = { pause: true }; this._cycle = null; this._aktiv = null; this._altEnabled = false; this._InitDelegate = Function.createDelegate(this, this._Init); this._StartDelegate = Function.createDelegate(this, this._Start); this._BeforeDelegate = Function.createDelegate(this, this._Before); this._AfterDelegate = Function.createDelegate(this, this._After); this._OnOverDelegate = Function.createDelegate(this, this._OnOver); this._OnOutDelegate = Function.createDelegate(this, this._OnOut); this._PagerBuilderDelegate = Function.createDelegate(this, this._PagerBuilder);
}
Adasoft.WIY.UI.Rotator.prototype = { initialize: function () { Adasoft.WIY.UI.Rotator.callBaseMethod(this, 'initialize'); if (window.jQuery) { Sys.Application.add_init(this._InitDelegate); } }, get_params: function () { return this._params; }, set_params: function (v) {
this._params = v; if (typeof (this._params.before2) == 'string')
this._params.before2 = eval(this._params.before2); if (typeof (this._params.after2) == 'string')
this._params.after2 = eval(this._params.after2); if (typeof (this._params.pagerevent2) == 'string')
this._params.pagerevent2 = eval(this._params.pagerevent2); if (typeof (this._params.pagerbuilder) == 'string')
this._params.pagerbuilder = eval(this._params.pagerbuilder); if (typeof (this._params.onPagerEvent) == 'string')
this._params.onPagerEvent = eval(this._params.onPagerEvent);
}, dispose: function () { window.jQuery(this._sid).cycle('stop'); Adasoft.WIY.UI.Rotator.callBaseMethod(this, 'dispose'); }
}
Adasoft.WIY.UI.Rotator.prototype._Init = function () {
if (typeof (window.jQuery.fn.cycle) != this._u) {
window.jQuery(this._sid).find(this._params.classnames[0]).hide(); this._aktiv = null; this._altEnabled = false; this._params.before = this._BeforeDelegate; this._params.after = this._AfterDelegate; this._params.pagerAnchorBuilder = this._PagerBuilderDelegate; if (this._params.height == 'auto' || this._params.height == '0') this._params.height = window.jQuery(this._sid).height(); if (this._params.width == 'auto' || this._params.width == '0') this._params.width = window.jQuery(this._sid).width(); if (isNaN(this._params.ustheight) || this._params.ustheight == '0') this._params.ustheight = (this._params.height / 2); window.jQuery(this._sid).fadeIn(1).find(this._params.classnames[0]).css({ height: this._params.height, width: this._params.width }); if (this._params.ust) { window.jQuery(this._sid).mouseover(this._OnOverDelegate).mousemove(this._OnOverDelegate); }
if (typeof (this._params.startDelay) == 'undefined')
this._params.startDelay = 0; if (this._params.startDelay == 0)
this._params.startDelay = 10; window.jQuery(this._sid).fadeOut(this._params.startDelay, this._StartDelegate);
}
}
Adasoft.WIY.UI.Rotator.prototype._Start = function () {
if (typeof (this._params.r_css) != 'undefined')
window.jQuery(this._sid).addClass(this._params.r_css); if (typeof (this._params.r_style) != 'undefined')
window.jQuery(this._sid).attr('style', this._params.r_style); window.jQuery(this._sid).show().css({ backgroundImage: '', opacity: 1 }); window.jQuery(this._sid).find(this._params.classnames[0]).show(); window.jQuery(this._sid).cycle(this._params);
}
Adasoft.WIY.UI.Rotator.prototype._HideUst = function () {
if (this._params.ust) {
try { var _h = (window.jQuery(this._sid).height()); var t = window.jQuery(this._sid).find(this._params.classnames[2]); t.stop().hide().css('height', _h) }
catch (e) { Sys.Debug.trace(e.message); }
}
}
Adasoft.WIY.UI.Rotator.prototype._After = function (a, b, c, d) {
if (this._cycle == null) this._cycle = c; if (this._params.ust) { this._aktiv = this._cycle.elements[this._cycle.currSlide]; this._altEnabled = true; }
if (typeof (this._params.after2) == 'function')
this._params.after2.apply(this, arguments);
}
Adasoft.WIY.UI.Rotator.prototype._Before = function (a, b, c, d) {
if (this._cycle == null) this._cycle = c; if (this._params.ust) {
if (a == b) { this._altEnabled = true; }
else { this._altEnabled = false; this._cycle.elements[this._cycle.currSlide]; this._HideUst(); }
}
if (typeof (this._params.before2) == 'function')
this._params.before2.apply(this, arguments);
}
Adasoft.WIY.UI.Rotator.prototype._OnOver = function (e, a) {
if (this._params.ust && this._altEnabled == true && typeof (this._cycle) != this._u) {
if (this._cycle.busy)
return; if (this._aktiv == null)
this._aktiv = this._cycle.elements[this._cycle.currSlide]; var _a = window.jQuery(this._aktiv).find(this._params.classnames[2] + ':hidden'); if (_a.length == 1) { _a.stop(); var _h = (window.jQuery(this._sid).height()); var h = this._params.ustheight; if (h == 0) h = _h; var w = (window.jQuery(this._sid).width()); var zIndex = parseInt(window.jQuery(this._aktiv).find(this._params.classnames[2]).css('zIndex')); if (isNaN(zIndex)) zIndex = 1; zIndex++; _a.show().css({ zIndex: zIndex, opacity: this._params.ustopacity, overflow: 'auto', width: w, height: h }); _a.css({ top: _h, left: 0 }).animate({ top: _h - h }, this._params.ustspeed, 'linear', null); }
}
}
Adasoft.WIY.UI.Rotator.prototype._OnOut = function (e, a) {
if (this._aktiv != null && this._params.ust) {
var _a = window.jQuery(this._aktiv).find(this._params.classnames[2] + ':visible'); if (_a.length == 1) {
var _h = (window.jQuery(this._sid).height()); var t = window.jQuery(a).find(this._params.classnames[2]).stop()
t.stop().animate({ top: _h + 1 }, this._params.ustspeed, 'linear', function () { t.hide(); });
}
}
}
Adasoft.WIY.UI.Rotator.prototype._PagerBuilder = function (a, b) {
if (typeof (this._params.pagerbuilder) == 'function')
return this._params.pagerbuilder.apply(this, arguments); else { var a = '' + (a + 1) + ''; var d = window.jQuery(a); return a; }
}
Adasoft.WIY.UI.Rotator.prototype.MyFunc = function (a, b) { return function () { b.apply(a, arguments); } }
Adasoft.WIY.UI.Rotator.registerClass('Adasoft.WIY.UI.Rotator', Sys.UI.Control);