//--------------------------------------------------------//
// This is the javascript file used on the master page    //
// Author: L Wittman                                      //
// Date: 1/24/08                                          //
//--------------------------------------------------------//

// Global variables
var i = 0;
var URL = window.location;
var navselected = null;
var pagecheck = null;

//window.onload = function() {
//    try {
//        document.getElementById('slideLoading').style.display = 'none'; 
//    }
//    catch(e){}
//}

// On page load, fade in the logo in the header
//pagecheck = setTimeout("PageLoadCheck()", 100);

function PageLoadCheck()
{
    if(document.getElementById('header_logo_td') != null)
    {
        document.getElementById('header_logo_img').style.display = 'none';
        pagecheck = setTimeout("FadeInLogo(true)",400);
    }
}

// This function will fade in the logo in the header
function FadeInLogo(x)
{
    // Set the transition and duration (Fade, 3 seconds)
    var filterstringlogo = "progid:DXImageTransform.Microsoft.Fade(Duration=3.0)";   
    var imgobjlogo=document.getElementById('header_logo_td');

    // Set the image source code
    if(x && i < 5)
    {
        var imgsrclogo = "<img id='header_logo_img' src='images/Logo.jpg' alt='The Pentecostals of Billings' />";
        if (document.getElementById)
        {
            if (imgobjlogo.filters && window.createPopup)
            {
                imgobjlogo.style.filter=filterstringlogo;
                imgobjlogo.filters[0].Apply();
            }
            if (imgobjlogo.filters && window.createPopup)
            {
                imgobjlogo.filters[0].Play();
                imgobjlogo.innerHTML = imgsrclogo;
            }
            pagecheck = setTimeout("FadeInLogo(false)",3000);
        }
    }
    else if(i < 5)
    {
        var imgsrclogo = "<img id='header_logo_img' src='images/LogoFade.jpg' alt='The Pentecostals of Billings' />";
        if (document.getElementById)
        {
            if (imgobjlogo.filters && window.createPopup)
            {
                imgobjlogo.style.filter=filterstringlogo;
                imgobjlogo.filters[0].Apply();
            }
            if (imgobjlogo.filters && window.createPopup)
            {
                imgobjlogo.filters[0].Play();
                imgobjlogo.innerHTML = imgsrclogo;
            }
            pagecheck = setTimeout("FadeInLogo(true)",4000);
        }
    }
    i++;
}

function mouseovernav(obj)
{
        obj.className='mouseover_leftnav';
        obj.style.cursor='pointer';
}
function mouseoutnav(obj)
{
    if(navselected != obj.id)
    {
        obj.className='leftnav';
    }
}

//// =======================================
//// set the following variables
//// =======================================

//// Set slideShowSpeed (milliseconds)
//var slideShowSpeed = 3000

//// Duration of crossfade (seconds)
//var crossFadeDuration = 3

//// Specify the image files
//var Pic = new Array() // don't touch this
//// to add more images, just continue
//// the pattern, adding to the array below

//Pic[0] = 'images/Logo.jpg'
//Pic[1] = 'images/LogoFade.jpg'

//// =======================================
//// do not edit anything below this line
//// =======================================

//var t
//var j = 0
//var p = Pic.length

//var preLoad = new Array()
//for (i = 0; i < p; i++)
//{
//   preLoad[i] = new Image()
//   preLoad[i].src = Pic[i]
//}

//function runSlideShow()
//{
//   if (document.all)
//   {
//      document.images.masterLogo.style.filter="blendTrans(duration=" + crossFadeDuration + ")"
//      document.images.masterLogo.filters.blendTrans.Apply()      
//   }
//   document.images.masterLogo.src = preLoad[j].src
//   if (document.all)
//   {
//      document.images.masterLogo.filters.blendTrans.Play()
//   }
//   j = j + 1
//   if (j > (p-1)) j=0
//   t = setTimeout('runSlideShow()', slideShowSpeed)
//}
