/* navrally.com Global Javascript file */

function over(id){
opacity(id, 100, 50, 400);
}

function out(id){
opacity(id, 50, 100, 800);
}

function down(id){
opacity(id, 50, 0, 250);
}


// function to fade navbar links
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function load(id){
element = document.getElementById(id);
element.style.background = "#99FFCC";
}

function lastUpdate(){
document.write("<address>Last updated 15th February 06<br />by Phil");
}

function openWin(URL, ID){
aWindow = window.open(URL, ID, "toolbar=no, width=100, height=100, resizable=yes");
aWindow.focus();
}

function openRegsWin(URL, ID){
aWindow = window.open(URL, ID, "toolbar=no, width=800, height=700, resizable=yes, scrollbars=yes");
aWindow.focus();
}

function submitForm(URL, ID, WINID){
openWin(URL, WINID);
element = document.getElementById(ID);
element.submit();
}

function submitProfile(URL, ID, WINID){
openProfileWin(URL, WINID);
element = document.getElementById(ID);
element.submit();
}

function openProfileWin(URL, ID){
aWindow = window.open(URL, ID, "toolbar=no, width=700, height=600, resizable=yes");
aWindow.focus();
}

function submitEvent(URL, ID, WINID){
openEventWin(URL, WINID);
}

function openEventWin(URL, ID){
aWindow = window.open(URL, ID, "scrollbars=1,toolbar=no,width=500,height=550,resizable=yes");
aWindow.focus();
}

function openWheresWoods(URL, ID){
openWin(URL, ID);
}