var timerMenuSlider = 0;
var timerTourSlider = 0;
var timerTopSlider = 0;
var timerDownSlider = 0;
var timerHideDownSlider = 0;
var intCurrentMenuHeight = 0;
var intCurrentTourHeight = 0;
var intCurrentHeight = 0;
var intCurrentOtherHeight;
var intCurrentWidth = 0;
var blnSliding;
var blnSlidingDown;
var intMaxMenuHeight = 100;
var intMaxTourHeight;
var intMaxHeight = 100;
var intMaxWidth = 100;


function slideMenu(strDivID)
{
hideSubMenus(strDivID);

switch(strDivID)
    {
    case "subMenu1":
    intMaxMenuHeight = 130;
    break;

    case "subMenu2":
    intMaxMenuHeight = 320;
    break;

    case "subMenu3":
    intMaxMenuHeight = 160;
    break;

    case "subMenu4":
    intMaxMenuHeight = 40;
    break;
    }

var objCurrentDiv = document.getElementById(strDivID);
objCurrentDiv.style.height = "0px";
objCurrentDiv.style.display = "block";

timerMenuSlider = setInterval("makeMoreVisible(1,'" + strDivID + "')", 10);
}


function hideSubMenus(strDivID)
{
clearInterval(timerMenuSlider);
intCurrentMenuHeight = 0;

for (var intLoopSubMenus = 1; intLoopSubMenus <= intSubMenuCount; intLoopSubMenus++)
    {
    //if (strDivID != "subMenu" + intLoopSubMenus)
        {
        document.getElementById("subMenu" + intLoopSubMenus).style.display = "none";
        }
    }
}


function slideTourMenu(intMaxHeightDropDown)
{
var objCurrentDiv = document.getElementById("tourMenu");
objCurrentDiv.style.height = "0px";
objCurrentDiv.style.display = "block";

intMaxTourHeight = intMaxHeightDropDown;
intCurrentTourHeight = 0;

timerTourSlider = setInterval("makeMoreVisible(4,'tourMenu')", 10);
}


function slideTopSlider(strDivID)
{
if (!blnSliding)
    {
    var objCurrentDiv = document.getElementById(strDivID);

    switch(strDivID)
        {
        case "eegTopSlider":
        hideSliders(4);
        intMaxWidth = 80;
        break;

        case "dbcTopSlider":
        hideSliders(3);
        intMaxWidth = 127;
        break;

        case "ecdTopSlider":
        hideSliders(2);
        intMaxWidth = 130
        break;

        case "legTopSlider":
        hideSliders(5);
        intMaxWidth = 140;
        break;
        }

    if (objCurrentDiv.style.width == "")
        {
        intCurrentWidth = 10;
        }
    else
        {
        var strCurrentWidth = objCurrentDiv.style.width;
        intCurrentWidth = strCurrentWidth.substring(0, strCurrentWidth.indexOf("px"));
        }

    blnSliding = true;
    timerTopSlider = setInterval("makeMoreVisible(2,'" + strDivID + "')", 10);
    }
}



function getExpandedSlideDown(strCurrentDivID)
{
var strOtherSlideDownDivPrefix = "";
var arrAllDivs = document.getElementsByTagName("div");
var strSlideDownDivID;
var intCountSlideDownDiv = 1;
var objSlideDownDiv;
var intSlideUpHeight;

for (var intLoopDivs = 0; intLoopDivs < arrAllDivs.length; intLoopDivs++)
    {
    strSlideDownDivID = 'slideDownLink' + intCountSlideDownDiv + 'Content';
    
    if (arrAllDivs[intLoopDivs].id == strSlideDownDivID)
        {
        if (strSlideDownDivID != strCurrentDivID + 'Content')
            {
            objSlideDownDiv = document.getElementById(strSlideDownDivID);

            if (objSlideDownDiv.style.height.indexOf("px") != -1)
                {
                intSlideUpHeight = objSlideDownDiv.style.height.substring(0, objSlideDownDiv.style.height.indexOf("px"));

                if (intSlideUpHeight > 0)
                    {
                    strOtherSlideDownDivPrefix = 'slideDownLink' + intCountSlideDownDiv;
                    break;
                    }
                }
            }

        intCountSlideDownDiv++;
        }
    }

return strOtherSlideDownDivPrefix;
}


function makeMoreVisible(intSlideType, strDivID)
{
var objCurrentDiv = document.getElementById(strDivID);

if (intSlideType == 1)
    {
    if (parseInt(intCurrentMenuHeight) < intMaxMenuHeight)
        {
        intCurrentMenuHeight = parseInt(intCurrentMenuHeight) + 20;
        objCurrentDiv.style.height = intCurrentMenuHeight + "px";
        }
    else
        {
        clearInterval(timerMenuSlider);
        }
    }
else if (intSlideType == 2)
    {
    if (parseInt(intCurrentWidth) < intMaxWidth)
        {
        intCurrentWidth = parseInt(intCurrentWidth) + 10;
        objCurrentDiv.style.width = intCurrentWidth + "px";
        }
    else
        {
        clearInterval(timerTopSlider);
        blnSliding = false;
        }
    }
else if (intSlideType == 4)
    {
    if (parseInt(intCurrentTourHeight) < intMaxTourHeight)
        {
        intCurrentTourHeight = parseInt(intCurrentTourHeight) + 20;
        objCurrentDiv.style.height = intCurrentTourHeight + "px";
        }
    else
        {
        clearInterval(timerTourSlider);
        }
    }
}


function makeLessVisible(strDivIDHead, strDivIDContent, blnOtherSlider)
{
var objHeadDiv = document.getElementById(strDivIDHead);
var objContentDiv = document.getElementById(strDivIDContent);
var intHeightToUse = (blnOtherSlider) ? intCurrentOtherHeight : intCurrentHeight;

if (parseInt(intHeightToUse) > 0)
    {
    intHeightToUse = (blnOtherSlider) ? parseInt(intHeightToUse) - 6 : parseInt(intHeightToUse) - 12;
    objContentDiv.style.height = intHeightToUse + "px";
    
    var intOpacityLevel = (100 - (100 / (intMaxHeight / (intMaxHeight - intHeightToUse))))
    objContentDiv.style.filter = "alpha(opacity=" + intOpacityLevel + ")";
    objContentDiv.style.opacity = intOpacityLevel / 100;

    if (blnOtherSlider)
        {
        intCurrentOtherHeight = intHeightToUse;
        }
    else
        {
        intCurrentHeight = intHeightToUse;
        }
    }
else
    {
    objHeadDiv.className = "slideDownHead";

    objContentDiv.style.display = "none";
    objContentDiv.style.filter = "0";
    objContentDiv.style.opacity = "0.0";

    if (blnOtherSlider)
        {
        clearInterval(timerHideDownSlider);
        intCurrentOtherHeight = 0;
        }
    else
        {
        clearInterval(timerDownSlider);
        blnSlidingDown = false;
        intCurrentHeight = 0;
        }
    }
}


function hideSliders(intCurrentSlider)
{
switch(intCurrentSlider)
    {
    case 1:
    document.getElementById("ecdTopSlider").style.width = "10px";
    document.getElementById("dbcTopSlider").style.width = "10px";
    document.getElementById("legTopSlider").style.width = "10px";
    break;

    case 2:
    document.getElementById("dbcTopSlider").style.width = "10px";
    document.getElementById("eegTopSlider").style.width = "10px";
    document.getElementById("legTopSlider").style.width = "10px";
    break;

    case 3:
    document.getElementById("ecdTopSlider").style.width = "10px";
    document.getElementById("eegTopSlider").style.width = "10px";
    document.getElementById("legTopSlider").style.width = "10px";
    break;

    case 5:
    document.getElementById("ecdTopSlider").style.width = "10px";
    document.getElementById("dbcTopSlider").style.width = "10px";
    document.getElementById("eegTopSlider").style.width = "10px";
    break;

    case 10:
    document.getElementById("ecdTopSlider").style.width = "10px";
    document.getElementById("dbcTopSlider").style.width = "10px";
    document.getElementById("eegTopSlider").style.width = "10px";
    document.getElementById("legTopSlider").style.width = "10px";
    break;

    case 30:
    if(document.getElementById("tourMenu"))
    {
    document.getElementById("tourMenu").style.display = "none";
    }
    break;
    }
}


function showDemonDesign(blnOnOff)
{
var objDemonDesign = document.getElementById("demonDesignText");
objDemonDesign.className = (blnOnOff == 0) ? "notVisible" : "";
}


function ReadMore(strDivID)
{
var intReadMoreNum = strDivID.substring(12);
var objReadMoreText = document.getElementById(strDivID);
var objReadMoreLink = document.getElementById("readMoreLink" + intReadMoreNum);
var objReadLessLink = document.getElementById("readLessLink" + intReadMoreNum);

switch(objReadMoreText.className)
    {
    case "showDiv":
    objReadMoreText.className = "hideDiv";
    objReadMoreLink.className = "showDiv";
    objReadLessLink.className = "hideDiv";
    break;
    
    case "hideDiv":
    objReadMoreText.className = "showDiv";
    objReadMoreLink.className = "hideDiv";
    objReadLessLink.className = "showDiv";
    break;
    }
}


function ReadTestimonial(strTestYear)
{
var arrYears = new Array("2008","2007","2006","2005");
var objYearButton;

for (var intLoopYears = 0; intLoopYears < arrYears.length; intLoopYears++)
    {
    objYearButton = document.getElementById("yearButton" + arrYears[intLoopYears]);

    if (strTestYear == arrYears[intLoopYears])
        {
        objYearButton.className = "yearOn";
        }
    else
        {
        objYearButton.className = "";
        }
    }

var arrAllDivs = document.getElementsByTagName("div");
var strShowTestDivID;

for (var intLoopDivs = 0; intLoopDivs < arrAllDivs.length; intLoopDivs++)
    {
    if (arrAllDivs[intLoopDivs].id.indexOf("testYear") != -1)
        {
        strShowTestDivID = 'testYear' + strTestYear;
    
        if ((arrAllDivs[intLoopDivs].id == strShowTestDivID))
            {
            arrAllDivs[intLoopDivs].className = "showDiv";
            }
        else
            {
            arrAllDivs[intLoopDivs].className = "hideDiv";
            }
        }
    }
}

var timerTestimonial = 0;

function changeTestimonial()
{
timerTestimonial = setInterval("changeTestimonial1()", 8000);
}


function changeTestimonial1()
{
var objCurrentTestimonial = document.getElementById("testimonial" + intCurrentTestimonial);
objCurrentTestimonial.className = "testimonial hideDiv";

intCurrentTestimonial++;
intCurrentTestimonial = (intCurrentTestimonial == (intLastTestimonial + 1)) ? 1 : intCurrentTestimonial;

objCurrentTestimonial = document.getElementById("testimonial" + intCurrentTestimonial);
objCurrentTestimonial.className = "testimonial showDiv";
}


function goURL(strURL)
{
window.location.href = strURL;
}


function popTestimonial(strDivID)
{
hideTestimonials(strDivID);

var objCurrentDiv = document.getElementById("Testimonial" + strDivID);
var objReadMoreLink = document.getElementById("readMoreTest" + strDivID);
var objCloseReadMoreLink = document.getElementById("closeReadMoreTest" + strDivID);

switch(objCurrentDiv.className)
    {
    case "showDiv":
    objCurrentDiv.className = "hideDiv";
    objReadMoreLink.className = "showDiv";
    objCloseReadMoreLink.className = "hideDiv";
    break;
    
    case "hideDiv":
    objCurrentDiv.className = "showDiv";
    objReadMoreLink.className = "hideDiv";
    objCloseReadMoreLink.className = "showDiv";
    break;
    }
}


function hideTestimonials(strCurrentDivID)
{
var arrAllDivs = document.getElementsByTagName("div");
var objDivID;
var objDiv;
var intCountDiv = 1;

for (var intLoopDivs = 0; intLoopDivs < arrAllDivs.length; intLoopDivs++)
    {
    objDivID = 'Testimonial' + intCountDiv;
    
    if ((arrAllDivs[intLoopDivs].id == objDivID))
        {
        if (objDivID != "Testimonial" + strCurrentDivID)
            {
            objDiv = document.getElementById(objDivID);
            objDiv.className = "hideDiv";
            }
        
        intCountDiv++;
        }
    }
}


function changeClass(strID, strClassNameOff, strClassNameOn)
{
var objObject = document.getElementById(strID);
objObject.className = (objObject.className == strClassNameOff) ? strClassNameOn : strClassNameOff;
}


function showResource(intResource)
{
var arrAllDivs = document.getElementsByTagName("div");
var intCountDiv = 0;

for (var intLoopDivs = 0; intLoopDivs < arrAllDivs.length; intLoopDivs++)
    {
    if (arrAllDivs[intLoopDivs].id.indexOf("divResource") != -1)
        {
        intCountDiv++;

        if (arrAllDivs[intLoopDivs].id == "divResource" + intResource)
            {
            document.getElementById("divResource" + intCountDiv).className = "showDiv";
            document.getElementById("linkResource" + intCountDiv).className = "sideLinkOn";
            }
        else
            {
            document.getElementById("divResource" + intCountDiv).className = "hideDiv";
            document.getElementById("linkResource" + intCountDiv).className = "";
            }
        }
    }
}


function showFAQ(intFAQ)
{
var arrAllDivs = document.getElementsByTagName("div");
var intCountDiv = 0;
var objCurrentFAQ;

for (var intLoopDivs = 0; intLoopDivs < arrAllDivs.length; intLoopDivs++)
    {
    if (arrAllDivs[intLoopDivs].id.indexOf("divFAQ") != -1)
        {
        intCountDiv++;

        objCurrentFAQ = document.getElementById("divFAQ" + intCountDiv);

        if (arrAllDivs[intLoopDivs].id == "divFAQ" + intFAQ)
            {
            objCurrentFAQ.className = (objCurrentFAQ.className == "showDiv") ? "hideDiv" : "showDiv";
            }
        else
            {
            objCurrentFAQ.className = "hideDiv";
            }
        }
    }
}


function openPopup(intWidth, intHeight, strURL)
{
var intLeft = (screen.width) ? (screen.width - intWidth) / 2 : 0;
var intTop = (screen.height) ? (screen.height - intHeight) / 2 : 0;

var strSettings = "height=" + intHeight;
strSettings += ",left=" + intLeft;
strSettings += ",top=" + intTop;
strSettings += ",width=" + intWidth;
strSettings += ",location=0";
strSettings += ",toolbar=0";
strSettings += ",scrollbars=1";
strSettings += ",statusbar=0";
strSettings += ",menubar=0";
strSettings += ",resizable=0";

window.open(strURL, "popVirtualTour", strSettings);
}


function showRouteClubs(strClubID, blnOnOff)
{
document.getElementById(strClubID).className = (blnOnOff == 1) ? "route" + strClubID : "hideDiv";
}







function showContent(objLink, blnOpenAndClose, strPrefix, intSelectedNum)
{
if (objLink != 0)
    {
    var objList = objLink.parentNode.parentNode;
    var objListItems = objList.getElementsByTagName("a")

    for (var intLoopItems = 0; intLoopItems < objListItems.length; intLoopItems++)
        {
        objListItems[intLoopItems].className = (intLoopItems == intSelectedNum - 1) ? "sideLinkROn" : "";
        }
    }

var arrAllDivs = document.getElementsByTagName("div");
var intContentCount = 0;
var objCurrentDiv;

for (var intLoopDivs = 0; intLoopDivs < arrAllDivs.length; intLoopDivs++)
    {
    if (arrAllDivs[intLoopDivs].id.indexOf(strPrefix) != -1)
        {
        intContentCount++;

        objCurrentDiv = arrAllDivs[intLoopDivs];

        if (intContentCount == intSelectedNum)
            {
            if (blnOpenAndClose == 0)
                {
                objCurrentDiv.className = "showDiv";
                }
            else
                {
                objCurrentDiv.className = (objCurrentDiv.className == "showDiv") ? "hideDiv" : "showDiv";
                }
            }
        else
            {
            objCurrentDiv.className = "hideDiv";
            }
        }
    }
}











function doWebsiteBy(blnOnOff, strPath)
{
if (blnOnOff == 1)
    {
    document.getElementById("websiteByNames").className = "showDiv";
    
    document.getElementById("demonDesignImg").src = strPath + "images/demondesign1.jpg";
    }
else
    {
    document.getElementById("websiteByNames").className = "hideDiv";
    
    document.getElementById("demonDesignImg").src = strPath + "images/demondesign.jpg";
    }
}



function showOffer()
{
var offerText = document.getElementById("offerText");
offerText.style.display = (offerText.style.display == "block") ? "none" : "block";
}