﻿//* *************************************************************************************************************
//* Global variable
var state = true;
var ns4 = (document.layers) ? true : false;
var ie6 = (navigator.appVersion.indexOf("MSIE 6.") == -1) ? false : true;
var ie7 = (navigator.appVersion.indexOf("MSIE 7.") == -1) ? false : true;
var ns6 = (!document.layers) && (navigator.userAgent.indexOf("Netscape") == -1) ? false : true;

//* *************************************************************************************************************
function Accordion(parent,object) {
    if(state){
        showDiv(object);
        updateClassName(parent, "serviceDepartmentExpanded")
        state = false;
    }
    else {
        hideDiv(object);
        updateClassName(parent, "serviceDepartment")
        state = true;
    }
} 

//* *************************************************************************************************************
function updateClassName(object, NameOfTheClass) {
    if (document.getElementById && document.getElementById(object) != null)
        document.getElementById(object).className = NameOfTheClass;
    else if (document.layers && document.layers[object] != null)
        document.layers[object].className = NameOfTheClass;
//    else if (document.all)
//        document.all[object].style.className = NameOfTheClass;
}



//* *************************************************************************************************************
function showDiv(object) {
	var display = 'block';
    if (document.getElementById && document.getElementById(object) != null)
        document.getElementById(object).style.display = display;
    else if (document.layers && document.layers[object] != null)
        document.layers[object].display = display;
    else if (document.all)
        document.all[object].style.display = display;
}

//************************************************************************************************
function hideDiv(object) {
    var display = 'none';
	if (document.getElementById && document.getElementById(object) != null)
        document.getElementById(object).style.display = display;
    else if (document.layers && document.layers[object] != null)
        document.layers[object].display = display;
    else if (document.all)
        document.all[object].style.display = display;
}

// *************************************************************************************************
function hide(object) {
    if (document.getElementById && document.getElementById(object) != null)
         node = document.getElementById(object).style.display='none';
    else if (document.layers && document.layers[object] != null)
        document.layers[object].display = 'none';
    else if (document.all)
         document.all[object].style.display = 'none';
}

// *************************************************************************************************
// Credit to 
// Capturing The Mouse Position in IE4-6 & NS4-6
// (C) 2000 www.CodeLifter.com
// *************************************************************************************************
var IE = document.all?true:false

if (!IE) document.captureEvents(Event.MOUSEMOVE)

document.onmousemove = getMouseCurPosition;

var mousePositionX = 0;
var mousePositionY = 0;

function getMouseCurPosition(e) 
{
    if (IE) 
    { 
        mousePositionX = event.clientX + document.documentElement.scrollLeft
        mousePositionY = event.clientY + document.documentElement.scrollTop
    } 
    else 
    { 
        mousePositionX = e.pageX
        mousePositionY = e.pageY
    }  
    if (mousePositionX < 0){mousePositionX = 0}
    if (mousePositionY < 0){mousePositionY = 0}  
    
    return true;
}

// *************************************************************************************************
function createDiv(title, content)
{
    var newDiv = document.createElement("div");
    newDiv.setAttribute("class","clsFloatingDiv");
    newDiv.setAttribute("id","idFloatingDiv");
    newDiv.innerHTML = "<b>" + title + "</b><br /><br />" + content;
    document.body.appendChild(newDiv);
    document.getElementById("idFloatingDiv").style.position = "absolute";
    document.getElementById("idFloatingDiv").style.top = (mousePositionY) + "px";
    document.getElementById("idFloatingDiv").style.left = (mousePositionX + 30) + "px";
}

// *************************************************************************************************
function removeDiv()
{
    var container = document.body
    
    for (i=container.childNodes.length - 1; i>=0; i--)
    {
        if(container.childNodes[i].id == "idFloatingDiv")
        {
            container.removeChild(container.childNodes[i]);
        }
    }
}

// *************************************************************************************************
NewImg = new Array (
"1.jpg",
"2.jpg",
"3.jpg",
"4.jpg",
"5.jpg",
"6.jpg",
"7.jpg",
"8.jpg",
"9.jpg",
"10.jpg"
);
var ImgNum = 0;
var ImgLength = NewImg.length - 1;

//Time delay between Slides in milliseconds
var delay = 4000;

var lock = false;
var run;
function chgImg(direction) {
if (document.images) {
ImgNum = ImgNum + direction;
if (ImgNum > ImgLength) {
ImgNum = 0;
}
if (ImgNum < 0) {
ImgNum = ImgLength;
}
document.slideshow.src = '../objects/img/openingslideshow/' + NewImg[ImgNum];
   }
}
function auto() {
if (lock == true) {
lock = false;
window.clearInterval(run);
}
else if (lock == false) {
lock = true;
run = setInterval("chgImg(1)", delay);
   }
}

<!-- Original:  Mike Canonigo (mike@canonigo.com) -->
<!-- Web Site:  http://www.munkeehead.com -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->