/*
dHTML Navigation script v2.1
------------------------------------------
Copyright (C) 2003 tow ] Werbeagantur GmbH
All rights reserved.
** This class requires fLayer 1.1.x and DOM **
$Id: scrollnavi.js.php,v 1.1.1.1 2004/11/01 14:26:40 deegital Exp $
*/
// -- plattform specific values - do not modify --
var speed = 10;
var step_m = 5;
var step_s = 15;
// -- setup section end --
function fMenuCore() {
this.obj = new Array();
this.thread= new Array();
this.type = new Array();
this.state = new Array();
this.start = new Array();
this.stop = new Array();
this.pos = new Array();
this.sys_state = 0;
this.timer = -1;
this.fixed = 'none';
this.register = fmenu_addmenu;
this.setfixed = fmenu_setfixed;
this.activate = fmenu_activate;
this.deactivate = fmenu_deactivate;
this.on = fmenu_on;
this.off = fmenu_off;
this.worker = fmenu_worker;
this.cleaner = fmenu_cleaner;
this.leftalign = fmenu_left;
this.topalign = fmenu_top;
var tmp=this;
this.timer = setInterval(function(){ tmp.cleaner(); },1000);
}
// ***********************************************************************
function fmenu_addmenu(id,type,start,stop) {
if (!document.getElementById(id)) {
alert('Element "'+id+'" not found!');
return false;
}
this.obj[id] = new fLayer(id);
if (type=='h' || type=='horizontal') {
this.type[id]=1;
} else {
this.type[id]=0;
}
this.state[id] = 0;
this.pos[id] = start;
this.start[id] = start;
this.stop[id] = stop;
var tmp=this;
this.thread[id]= setInterval(function(){ tmp.worker(id); },speed);
}
// ***********************************************************************
function fmenu_left(id,to) {
if (!this.obj[id]) {
alert('obj '+id+' not found.');
return false;
}
if (!document.getElementById(to)) {
alert('obj '+to+' not found.');
return false;
}
this.obj[id].style.left=document.getElementById(to).offsetLeft + 'px';
}
function fmenu_top(id,to) {
if (!this.obj[id]) {
alert('obj '+id+' not found.');
return false;
}
if (!document.getElementById(to)) {
alert('obj '+to+' not found.');
return false;
}
this.obj[id].style.top=document.getElementById(to).offsetTop + 'px';
}
// ***********************************************************************
function fmenu_setfixed(id) {
this.fixed=id;
this.state[id]=3;
if (this.type[id]==1) {
this.obj[id].moveX(this.max[id]);
} else {
this.obj[id].moveY(this.max[id]);
}
}
// ***********************************************************************
function fmenu_worker(id) {
switch (this.state[id]) {
case 0: { break; } // closed
case 1: { this.on(id); break; } // scroll open
case 2: { this.off(id); break; } // scroll close
case 3: { break; } // closed
default: { break; }
} // switch
}
// ***********************************************************************
function fmenu_activate(id) {
if (this.state[id]!=0) { return; }
for (var m in this.state) {
if ((m!=id) && (this.state[m]!=0)) { this.deactivate(m); }
}
this.state[id]=1;
}
// ***********************************************************************
function fmenu_deactivate(id) {
this.sys_state=0;
if (this.state[id]==0) { return; }
this.state[id]=2;
}
// ***********************************************************************
function fmenu_on(id) {
if (this.pos[id]>=this.stop[id]) {
this.state[id]=3;
return;
}
this.pos[id] += (step_m);
if (this.type==1) {
this.obj[id].moveX(this.pos[id]);
} else {
this.obj[id].moveY(this.pos[id]);
}
}
// ***********************************************************************
function fmenu_off(id) {
if (this.pos[id]<=this.start[id]) {
this.state[id]=0;
return;
}
this.pos[id] -= (step_m);
if (this.type==1) {
this.obj[id].moveX(this.pos[id]);
} else {
this.obj[id].moveY(this.pos[id]);
}
}
// ***********************************************************************
function fmenu_cleaner() {
//if (this.state.length==0) { return; }
if (this.sys_state!=0) {
this.sys_state=0;
for (var m in this.state) {
if ((m!=this.fixed) && (this.state[m]!=0)) { this.deactivate(m); }
}
if (this.fixed!='none') {
this.activate(this.fixed);
}
}
}
// ***********************************************************************
var fMenu = new fMenuCore();