/*********************************************************************************************
Sestavi cross-browser objekte
Copyright (C) 1999 Zavod za Računalniško Izobraževanje
All scripts are made by Simon Belak (Simon_Belak@yahoo.com)
*********************************************************************************************/
// Napoved spremenljivk
// Browsercheck
var n = (document.layers) ? 1:0;
var ie = (document.all) ? 1:0;
var tim;
// Izhodišča za postavitev objektov na stran
function makePageCoords() {
this.x=0;
this.y=0;
this.x2=(n)?innerWidth:document.body.offsetWidth;
this.y2=(n)?innerHeight:document.body.offsetHeight;
this.x50=this.x2/2;
this.y50=this.y2/2;
this.x10=this.x2/10;
this.y10=this.y2/10;
return this;
}
function makeObj(obj,nest) {
// Cross-browser properties (lastnosti)
nest=(!nest) ? '':'document.'+nest+'.'
this.css=(n) ? eval(nest+'document.'+obj):eval('document.all.' +obj+ '.style')
this.evnt=(n)? eval(nest+'document.'+obj):eval(obj);
this.ref=(n) ? eval(nest+'document.'+obj+'.document'):eval('document');
this.obj = obj + "Object"; eval(this.obj + "=this");
// Velikosti in postavitev
this.width=n?this.css.document.width:eval(obj+'.offsetWidth');
this.height=n?this.css.document.height:eval(obj+'.offsetHeight');
// Preusmerjanje
this.showIt = show; this.hideIt = hide;
this.paintIt = paint; this.unPaintIt = unPaint;
this.decorIt = textDecor; this.unDecorIt = unTextDecor;
this.moveIt = move;
this.resizeIt = resize;
this.ClipIt = clipTo;
this.getLeft = gLeft; this.getTop = gTop;
this.animR = animRight; this.animL = animLeft;
return this;
}
// Object methods
function show() {
this.css.visibility="visible"
}
function hide() {
this.css.visibility="hidden"
}
function paint() {
this.css.color="white"
}
function unPaint() {
this.css.color=""
}
function textDecor() {
this.css.textDecoration="underline"
}
function unTextDecor() {
this.css.textDecoration=""
}
function move(x,y) {
this.x=x;
this.y=y;
this.css.left=this.x;
this.css.top=this.y; }
function resize(w,h) {
this.h = h
this.w = w
this.css.height=this.h;
this.css.width=this.w;
}
function clipTo(t,r,b,l){
if(n){
this.css.clip.top=t;
this.css.clip.right=r;
this.css.clip.bottom=b;
this.css.clip.left=l
}else{
this.css.clip="rect("+t+","+r+","+b+","+l+")";
}
}
function gLeft(){
var left=(n) ? eval(this.css.left):eval(this.css.pixelLeft)
return left;
}
function gTop(){
var top=(n) ? eval(this.css.top):eval(this.css.pixelTop)
return top;
}
function animRight(xstop,korak,speed){
clearTimeout(this.tim)
if (this.getLeft()xstop){
this.showIt()
this.css.left=this.getLeft()-korak
this.tim=setTimeout(this.obj+".animL("+xstop+","+korak+","+speed+")",speed)
} else {
clearTimeout(this.tim)
}
}
[ Zapri | V novem oknu | Na začetek ]