// begin: js/utils/slider.js function sfgtopslider(n, domid) { this.numels = n; this.domid = domid; this.notxt=false; this.preload=false; window[this.domid] = this; } sfgtopslider.prototype.gebi = function(subelid) { // alert('gebi ' + subelid + ' for ' + this.domid + '_' + subelid); return document.getElementById(this.domid + '_' + subelid); } sfgtopslider.prototype.setup = function() { this.display = new Array(); if (!this.preload) { this.img_content = new Array(); this.img_loaded = new Array(); for (var i = 1; i <= this.numels ; i += 1) { this.img_loaded[i] = false; } } this.display['img'] = 'inline'; if (!this.notxt) { this.display['txt'] = 'block'; } this.display['doton'] = 'inline'; this.display['dotoff'] = 'inline'; } sfgtopslider.prototype.init = function (initn) { this.cur = initn; if (this.cur < 1) { this.cur = 1; } else if (this.cur > this.numels) { this.cur = this.numels; } for (var i = 1; i <= this.numels ; i += 1) { if (i == this.cur) { this.show('img', i); if (!this.notxt) { this.show('txt', i); } this.hide('dotoff', i); this.show('doton', i); } else { this.hide('img', i); if (!this.notxt) { this.hide('txt', i); } this.hide('doton', i); this.show('dotoff', i); } } } sfgtopslider.prototype.getnextnum = function () { var nextnum = this.cur + 1; if (nextnum > this.numels) { nextnum = 1; } return nextnum; } sfgtopslider.prototype.getprevnum = function () { var prevnum = this.cur - 1; if (prevnum < 1) { prevnum = this.numels; } return prevnum; } sfgtopslider.prototype.show = function(subel, num) { var el = this.gebi(subel + '_' + num) if (subel == 'img' && !this.preload && !this.img_loaded[num]) { el.innerHTML = this.img_content[num]; this.img_loaded[num] = true; } el.style.display = this.display[subel]; } sfgtopslider.prototype.hide = function(subel, num) { var el = this.gebi(subel + '_' + num) el.style.display = 'none'; } sfgtopslider.prototype.showhide = function(num) { this.hide('img', this.cur); this.show('img', num); if (!this.notxt) { this.hide('txt', this.cur); this.show('txt', num); } this.hide('doton', this.cur); this.show('dotoff', this.cur); this.hide('dotoff', num); this.show('doton', num); this.cur = num; } sfgtopslider.prototype.prev = function() { this.showhide(this.getprevnum()); } sfgtopslider.prototype.next = function() { this.showhide(this.getnextnum()); } sfgtopslider.prototype.jump = function(num) { // var elon = this.gebi('doton' + '_' + num); // var eloff = this.gebi('dotoff' + '_' + num); // elon.blur(); // eloff.blur(); if (num < 1) { num = 1; } else if (num > this.numels) { num = this.numels; } this.showhide(num); } // end: js/utils/rot.js