/* ----------------------------------------------------------------------- */
/* |                 Internet Explorer 4.01 Script                       | */
/* |                    Written by Steve Gore                            | */
/* |                     Last Update: 4/28/98                            | */
/* |      To use this script in a Web Page add the following lines:      | */
/* |            <script src=4script.js></script>                         | */
/* ----------------------------------------------------------------------- */
/* |    bubblo(el, gp)                                                   | */
/* |                   el -- Element ID to show or hide                  | */
/* |                   gp -- Group name (in quotes)  [optional]          | */
/* |                                                                     | */
/* |    moveo(el, x, y, px)                                              | */
/* |                    el -- Element ID to be moved                     | */
/* |                    x -- X value (horizontal) to move to             | */
/* |                    y -- Y value (vertical) to move to               | */
/* |                    px -- Number of pixels to move in 1 millisecond  | */
/* |                                                                     | */
/* |    fadeo(el)       style: WIDTH; VISIBILITY: HIDDEN;                | */
/* |                           FILTER: blendTrans(Duration=?)            | */
/* |                    el -- Element ID to fade up                      | */
/* |                                                                     | */
/* |    switcho(el, t, p)                                                | */
/* |                    el -- Element ID to cycle in                     | */
/* |                    t -- The series of text, images or links ex:     | */
/* |                           "Hey,This,Is,Cool" or "edit.gif,sale.gif" | */
/* |                    p -- Pause between cycles                        | */
/* |                                                                     | */
/* |    typeo(el, p)    style: VISIBILITY: HIDDEN                       | */
/* |                    el -- Element ID to type text to                 | */
/* |                    p -- Pause between letters (200 recomended)      | */
/* |                                                                     | */
/* |    wordo(el, d)                                                     | */
/* |                    el = Element to rotate                           | */
/* |                    d = Degrees to rotate (>360 is ok)               | */
/* |                                                                     | */
/* |    scrollo(tx)                                                      | */
/* |                    tx -- The text to scroll across the bottom       | */
/* |                                                                     | */
/* |                                                                     | */
/* |    profileo(fr)    VCard: valid_attribute                           | */
/* |                    fr -- The ID of the form                         | */
/* |                                                                     | */
/* |    styleo(sel, style, val)                                          | */
/* |                    sel = Selector Text (.abc)                       | */
/* |                    style = CSS Property (color)                     | */
/* |                    val = New Value (optional or returns current)    | */
/* |    isie4(pg)                                                        | */
/* |                    pg -- The page to go or function to run          | */
/* |                                                                     | */
/* |    MouseOver       mousetext: Text to be shown in status bar        | */
/* |                    newimg: Image to replace existing one            | */
/* |                    tip: A tool tip with HTML                        | */
/* |                                                                     | */
/* |PATH                xyz = new path(id); -- ID is object to move      | */
/* |                    xyz.addPoint(x, y, s); -- Points to go to        | */
/* |                            s -- Number of pixels / millisecond      | */
/* |                    xyz.Circle(r, s); -- Does a circular path        | */
/* |                            r -- Radius, s -- (see above)            | */
/* |                    xyz.runMe(); -- Runs Path                        | */
/* ----------------------------------------------------------------------- */
function bubblo(el, gp) {
        if (gp != null) {
                eval("p = document." + gp);
                if (p != null) {
                        p.style.display = "none";
                }
                if (p != el) {
                        el.style.display = "";
                        eval("document." + gp + " = " + el.id);
                } else {
                        eval("document." + gp + " = null");
                }
        } else {
                if (el.style.display == "none") {
                        el.style.display = "";
                } else {
                        el.style.display = "none";
                }
        }
}                                  
function moveo(el, x, y, px) {
        el.isMoving = 1;
        yNow = el.style.posTop;
        xNow = el.style.posLeft;
        var range = px - 1;
        if (yNow > (y + range)) {
                yNow = yNow - px;
                el.style.posTop = yNow;
        } else if (yNow < (y - range)) {
                yNow = yNow + px;
                el.style.posTop = yNow;
        } else {
                yNow = y;
                el.style.posTop = yNow;
        }
        if (xNow > (x + range)) {
                xNow = xNow - px;
                el.style.posLeft = xNow;
        } else if (xNow < (x - range)) {
                xNow = xNow + px;
                el.style.posLeft = xNow;
        } else {
                xNow = x;
                el.style.posLeft = xNow;
        }
        if (yNow == y && xNow == x) {
                el.isMoving = 0;
                if (el.onMoveo != null) {
                        el.onMoveo();
                }
		return;
        }
        ab1 = window.setTimeout("moveo("+el.id+","+x+","+y+","+px+");", 1);
}
function fadeo(el) {
        if (el.filters.blendTrans.status==0) {
                el.filters.blendTrans.Apply();
                if (el.style.visibility == "hidden" || el.style.visibility == "") {
                        el.style.visibility = "visible";
                } else {
                        el.style.visibility = "hidden";
                }
                el.filters.blendTrans.Play();
        }
}
function switcho(el, t, p) {
        if (el.selNum == null) {
                el.texts = new Array();
                el.currText = "";
                el.currNum = 0;     
                el.selNum = 0;
                el.Len = 0;
                for (el.i = 0; el.i < t.length; el.i++) {
                        if (t.charAt(el.i) == ",") {
                                el.texts[el.currNum] = el.currText;
                                el.currText = "";
                                el.currNum++;
                                el.i++;
                        }
                        el.currText = el.currText + t.charAt(el.i);
                }
                el.texts[el.currNum] = el.currText;
                el.Len = el.currNum;
        }
        if (el.selNum < el.Len) {
                el.selNum = el.selNum + 1;
        } else {
                el.selNum = 0;
        }                                     
        if (el.tagName == "A") {
                el.href = el.texts[el.selNum];
        } else if (el.tagName == "IMG") {
                if (el.style.filter = "") {
                        dur = (p - 5) / 10;
                        if (dur > 5) dur = 5;
                        el.style.filter = "blendTrans(duration=" + dur + ")";
                } else {
                        dur = (p - 5) / 10;
                        if (dur > 5) dur = 5;
                        el.style.filter = el.style.filter + "blendTrans(duration=" + dur + ")";
                }
                el.filters.blendTrans.Apply();
                el.src = el.texts[el.selNum];
                el.filters.blendTrans.Play();
        } else {
                el.innerHTML = el.texts[el.selNum];
        }
        ab1 = window.setTimeout("switcho(" + el.id + ",'" + t + "'," + p + ");", p * 100);
}
function typeo(el, p) {
        if (el.i == null) {
                el.i = -1;
                el.chri = 0;
                el.txt = el.innerHTML;
                el.lng = el.txt.length;
                el.innerHTML = "";
                el.style.visibility = "visible";
                el.msg = "";
        }
        /* still making msg */
        if (el.i < el.lng) {
                for (el.i = 0; el.i < el.lng; el.i++) {
                        chr = el.txt.charAt(el.i)      
                        if (chr == "<") {
                                aTag = "<";
                                while (chr != ">") {
                                        el.i++;
                                        chr = el.txt.charAt(el.i);
                                        aTag = aTag + chr;
                                }
                                aTag = aTag;
                                el.msg = el.msg + aTag;
                        }                            
                        if (chr != ">") {
                                el.msg = el.msg + "<span style='visibility: hidden' id=" + el.id + "_" + el.chri + ">" + chr + "</span>";
                                el.chri++;
                        } 
                }
        }
        /* made msg */
        if (el.i == el.lng) {
                if (el.cmpl == null) {
                        el.innerHTML = el.msg;                     
                        el.cmpl = el.chri;
                        el.chri = 0;
                }
                if (el.chri < el.cmpl) {
                        t = eval(el.id + "_" + el.chri);
                        t.style.visibility = "visible";
                        el.chri++;
                        ab1 = window.setTimeout("typeo(" + el.id + "," + p +")", p);
                }
        }
        if (el.chri == el.cmpl) {
                el.innerHTML = el.txt;
                if (el.onTypeo != null) {
                        el.onTypeo();
                }
                window.clearTimeout(ab1);
                return;
        }
}
function wordo(el, d) {
        theID = el.id + '_word_';
        theStr = el.innerText;
        deg = (d / 180) * Math.PI;
        el.totalWidth = 0
        el.totalHeight = 0
        el.innerText = "";
        el.insertAdjacentHTML('beforeEnd','<div id=' + theID + '0 style="position: absolute; top: 0; left: 0;">' + theStr.charAt(0) + '</div>');
        for (i=1; i<theStr.length; i++) {
                last = eval('last = document.all.' + theID + (i - 1));
                wh = (last.scrollWidth + last.scrollHeight) / 2         
                if (last.scrollWidth + last.offsetLeft > el.totalWidth) el.totalWidth = last.scrollWidth + last.offsetLeft;
                if (last.scrollHeight + last.offsetTop > el.totalHeight) el.totalHeight = last.scrollHeight + last.offsetTop;
                char = theStr.charAt(i);

                if (char == " ") char = "&nbsp;";
                       
                x = wh * Math.cos(deg) + last.offsetLeft;
                y = wh * Math.sin(deg) + last.offsetTop;
                el.insertAdjacentHTML('beforeEnd', '<div id=' + theID + i + ' style="position: absolute; top: ' + y + '; left: ' + x + ';">' + char + '</div>');
        }
                last = eval('last = document.all.' + theID + (i - 1));     
                if (last.scrollWidth + last.offsetLeft > el.totalWidth) el.totalWidth = last.scrollWidth + last.offsetLeft;
                if (last.scrollHeight + last.offsetTop > el.totalHeight) el.totalHeight = last.scrollHeight + last.offsetTop;

        el.style.width = el.totalWidth;
        el.style.height = el.totalHeight;
}
function scrollo(tx) {
        if (document.scrollText == null) {
                document.scrollText = "";
                for (i = 0; i < 200; i++) {
                        document.scrollText = document.scrollText + " ";
                }
                document.scrollText = document.scrollText + tx;
                document.scrollNum = 0;
                document.scrollMsg = "";
                document.scrollGo = "1";
        }
        if (document.scrollText != null && document.scrollGo == "1") {
                for (k = document.scrollNum; k < document.scrollText.length; k++) {
                        document.scrollMsg = document.scrollMsg + document.scrollText.charAt(k);
                }
                window.status = document.scrollMsg;
                document.scrollNum++;
                document.scrollMsg = "";
        }
        if (document.scrollNum == document.scrollText.length) {
                document.scrollText = null;
        }
        ab1 = window.setTimeout("scrollo('"+ tx +"');", 50);
}
function profileo(fr) {
        navigator.userProfile.clearRequest()
        for (i = 0; i < fr.length; i++) {              
                if (fr[i].type == "text") {
                        card = fr[i].getAttribute("VCard");
                        if (card != null) {
                                navigator.userProfile.addReadRequest("VCard." + card);
                        }
                }
        }
        navigator.userProfile.doReadRequest(8, document.title)
        for (i = 0; i < fr.length; i++) {
                if (fr[i].type == "text") {
                        card = fr[i].getAttribute("VCard");
                        if (card != null) {
                                fr[i].value = navigator.userProfile.getAttribute("VCard." + card);
                        }
                }
        }
}
function styleo(sel, style, val){
        for (i=0; i<document.styleSheets.length; i++)   {
                thisSheet = document.styleSheets[i];
                for (j=0; j<thisSheet.rules.length; j++) {
                        thisRule = thisSheet.rules[j];
                        if (thisRule.selectorText == sel) {
                                rule = thisRule;
                                break;
                        }
                }
        }     
        if (rule == null) return;      
        style = style.toUpperCase();
        isAt = document.body.createTextRange();
        isAt.moveToPoint(0,0);
        isAt.expand("character");   
	theStyle = rule.style.cssText + ";";
        p = theStyle.indexOf(style);
        s = theStyle.indexOf(";", p);
        beforeRule = theStyle.substring(0, p);
        afterRule = theStyle.substring(s+1, theStyle.length);
        if (val == null) {
                c = theStyle.indexOf(":", p);
                theRule = theStyle.substring(c+2, s);
                return theRule;
        }
        newRule = style + ": " + val + ";";
        rule.style.cssText = beforeRule + newRule + afterRule;
        isAt.scrollIntoView(true);
}
function isie4(pg) {
        isat = navigator.userAgent.indexOf("MSIE ") + 5;
        if(isat != 4 && navigator.userAgent.substring(isat, (isat + 1)) >= "4") {
                if (typeof(pg) == "function") {
                        pg();
                } else {
                        document.location = pg;
                }
        }
}

document.onmouseover=makeCool;
document.onmouseout=makeNormal;
function makeCool() {
        src = event.srcElement;
        if (src.tip != null) {
                        tttext = src.tip
                        theY = src.offsetTop + src.offsetHeight;
                        nextSrc = src.offsetParent;
                        for (i=0; nextSrc.tagName!="BODY"; i++) {                               
                                theY = theY + nextSrc.offsetTop;
                                nextSrc = nextSrc.offsetParent;
                        }
                        document.ttip = window.setTimeout("Tool(" + window.event.x + "," + theY + ",'" + tttext + "');", 750);
        }
        if (src.tagName == "A") {
                src.oldColor = src.style.color;
                src.style.color = "red";
                if (src.mousetext != null) {
                        intext = src.mousetext;
                } else {
                        intext = src.innerText;
                }
                window.status = intext;
                document.scrollOld = document.scrollGo;
                document.scrollGo = 0;
        } else if (src.tagName == "IMG") {
                onImg = src;
                if (onImg.newimg != null) {
                        onImg.oldSrc = onImg.src;
                        onImg.src = onImg.newimg;
                }
        }
}
function makeNormal() {
        src = event.srcElement;
                if (src.tip != null) {
                        window.clearTimeout(document.ttip);
			if (document.all.ToolTip == null) {
                                document.body.insertAdjacentHTML('beforeEnd', '<span id=ToolTip style="visibility: hidden; z-index: 300; background-color: #FFFF44; position: absolute; font-size: 10pt; width: 0; height: 0; border: 1 solid black"></span>');
		        }
                        ToolTip.style.visibility = "hidden";
                }
        if (src.tagName == "A") {
                src.style.color = src.oldColor;
                window.status = "";
                document.scrollGo = document.scrollOld;
        } else if (src.tagName == "IMG") {
                onImg = src;
                if (onImg.newimg != null) {
                        onImg.src = onImg.oldSrc;
                }
        }
}
function Tool(x, y, t) {
        if (document.all.ToolTip == null) {
                document.body.insertAdjacentHTML('beforeEnd', '<span id=ToolTip style="visibility: hidden; z-index: 300; background-color: #FFFF44; position: absolute; font-size: 10pt; width: 0; height: 0; border: 1 solid black"></span>');
        }
        ToolTip.style.width = 200;
        ToolTip.style.posTop = y;
        ToolTip.style.posLeft = x + 10;
        ToolTip.innerHTML = "<nobr>" + t + "<nobr>";
        if (ToolTip.scrollWidth < 200) {
                ToolTip.style.width = ToolTip.scrollWidth;
        } else {
                ToolTip.innerHTML = t;
                ToolTip.style.width = 200;                  
        }           
        ToolTip.style.visibility = "visible";
}

function path(id) {
        this.moved = id;
        this.curr = 0;
        this.ArrayX = new Array();
        this.ArrayY = new Array();
        this.ArrayS = new Array();
}
path.prototype.addPoint = addPoint;
path.prototype.Circle = Circle;
path.prototype.runMe = runMe;
function addPoint(x, y, s) {
        Alen = this.ArrayX.length;
        this.ArrayX[Alen] = x;
        this.ArrayY[Alen] = y;
        this.ArrayS[Alen] = s;
}
function Circle(r, s) {
        upr = 2 * Math.PI;
        inc = Math.PI / r;      
        move = this.moved;
        lx = move.style.posLeft - r;
        ly = move.style.posTop;
        d = this.ArrayX.length - 1;
        if (this.ArrayX[d] != null) {
                lx = this.ArrayX[d] - r;
                ly = this.ArrayY[d];
        }
        for (i=upr; i>=0; i=i-inc) {
                x = Math.ceil(Math.cos(i) * r) + lx;
                y = Math.ceil(Math.sin(i) * r) + ly;
                this.addPoint(x, y, s);
        }
}    
function runMe() {
        move = this.moved;
        if (move.style.posLeft == null) {
                move.style.posLeft = 0;
        }
        if (move.style.top == null) {
                move.style.posTop = 0;
        }
        move.ArrayX = this.ArrayX;
        move.ArrayY = this.ArrayY;
        move.ArrayS = this.ArrayS;
        runGo(move, -1);
}
function runGo(i, c) {
        if (c == -1) {
                c = 0;
                x = i.ArrayX[c];
                y = i.ArrayY[c];
                s = i.ArrayS[c];
                moveo(i, x, y, s);
        }
        if (i.style.posLeft == i.ArrayX[c] && i.style.posTop == i.ArrayY[c]) {
                if (c < (i.ArrayX.length - 1)) {
                        c = c + 1;
                        x = i.ArrayX[c];
                        y = i.ArrayY[c];
                        s = i.ArrayS[c];
                        moveo(i, x, y, s);
                } else {
                        if (i.onPath != null) {
                                i.onPath();
                        }
                        return;
                }
        }
        ab9 = window.setTimeout("runGo("+i.id+","+c+")", 1);
}
