﻿// JScript File


//************************************************
//
//Application Specific Functions
//
//************************************************    


//************************************************
//History navigator variables
//************************************************    
    var HistMax = 0;
    var HistIndex = 0;
    var HistLink = "Body_Intro.aspx";

    var t;
    var rightbound = 0;
    var leftbound = 0;
    var textwidth;

   
    function BackButton_onclick() 
    {
        var PageX = new Array();
        var SendPage = "";
        
        document.getElementById("BackButton").src = "images/ARW01LT.bmp";

        if (HistIndex > 0) 
        {
            document.getElementById("BackButton").src = "images/ARW02LT.bmp";
            document.getElementById("FwdButton").src = "images/ARW02RT.bmp";
            HistIndex--;
            PageX = HistLink.split("|");
            SendPage = PageX[HistIndex];
            CallServer(SendPage,"");
        }
        
    }

    function FwdButton_onclick() 
    {
        var PageX = new Array();
        var SendPage = "";

        document.getElementById("FwdButton").src = "images/ARW01RT.bmp";
        
        if (HistIndex < HistMax) 
        {
            document.getElementById("BackButton").src = "images/ARW02LT.bmp";
            document.getElementById("FwdButton").src = "images/ARW02RT.bmp";
 
            HistIndex++;
            PageX = HistLink.split("|");
            SendPage = PageX[HistIndex];
            CallServer(SendPage,"");
        }
     }

//************************************************
//Gallery Controls
//************************************************    
    
    var GalleryIndex = 0;
    var Gallery = new Array();
    Gallery[0] = "images/smile_08.jpg";
    Gallery[1] = "images/smile_09.jpg";
    Gallery[2] = "images/smile_10.jpg";
    Gallery[3] = "images/smile_11.jpg";
    Gallery[4] = "images/smile_12.jpg";
    Gallery[5] = "images/smile_13.jpg";
    Gallery[6] = "images/smile_14.jpg";
    Gallery[7] = "images/smile_15.jpg";

    function GalleryNext() 
    {
        GalleryIndex++ ;
        if (GalleryIndex > Gallery.length - 1)
        {
        GalleryIndex = 0;
        }
        
        document.getElementById("Gallery1").src = Gallery[GalleryIndex];
    }

    function GalleryPrev() 
    {
 
        GalleryIndex-- ;
        if (GalleryIndex < 0)
        {
        GalleryIndex = Gallery.length - 1;
        }

        document.getElementById("Gallery1").src = Gallery[GalleryIndex];
    }


//************************************************
//
//Client Callback functions
//
//************************************************    


    function menuclick(Page1,elm)
    {
        var td = elm;
        
        HistMax++;
        HistIndex++;
        HistLink = HistLink + "|" + Page1;
        document.getElementById("BackButton").src = "images/ARW02LT.bmp";

        if (elm != null) {
        td.style.visibility="hidden";
        }
       
        CallServer(Page1,"");
    }

    function ReceiveServerData(rValue)
    {
        document.getElementById("BodyCode").innerHTML = rValue;

    }

   
    
    
//************************************************
//
//Menu/Drop Menu Functions
//
//************************************************    

    function winload()
    {
        L3 = document.getElementById("tabl1").offsetLeft;
        try {
        document.getElementById("NavButtons").style.left = L3 + 1;
        document.getElementById("menu1").style.left = L3 + 300;
        document.getElementById("menu2").style.left = L3 + 1;
        document.getElementById("menu1").style.visibility = "visible";
        document.getElementById("menu2").style.visibility = "visible";
        document.getElementById("scroller").style.visibility = "visible";
        document.getElementById("NavButtons").style.visibility = "visible";
        document.getElementById("scroller").style.left = L3 + 65;
        setscroll();
        }
        catch(error)  {}
    }

    function winresize()
    {
        L3 = document.getElementById("tabl1").offsetLeft;

        try {
        document.getElementById("NavButtons").style.left = L3 + 1;
        document.getElementById("menu1").style.left = L3 + 300;
        document.getElementById("menu2").style.left = L3 + 1;
        document.getElementById("scroller").style.left = L3 + 65;
        }
        catch(error) {}
    }


    function menu_mouseover(p,m,oc,ofc,hc,img)
    {
        var td = m;
        var parent = p;
        var oc1 = oc;
        var ofc1 = ofc;
        var cid = hc;
        
        var iOffsetLeft = td.offsetLeft;

        T1 = Number(parent.style.top.replace("px",""));
        H1 = Number(parent.style.height.replace("px",""));
        L1 = Number(parent.style.left.replace("px",""));
        OL1 = iOffsetLeft;
        
        if (img != "") {
        td.style.backgroundImage=img;
        }
        else
        {
        td.style.backgroundImage="none";
        td.style.backgroundColor=oc1;
        }

        td.style.color=ofc1;
        td.style.cursor = "hand";

        if (cid != "") {
        cid.style.visibility="visible"
        cid.style.left = L1 + OL1
        cid.style.top = T1 + H1 + 0;}
    }


    function menu_mouseout(p,m,oc,ofc,hc,img)
    {
        var td = m;
        var parent = p;
        var oc1 = oc;
        var ofc1 = ofc;
        var cid = hc;
       
        if (img != "") {
        td.style.backgroundImage=img;
        }
        else
        {
        td.style.backgroundColor=oc1;
        }
        
        td.style.color=ofc1;

        if (cid != "") {
        cid.style.visibility="hidden";}
    }

    function dropmenu_onmouseover(m,oc,ofc,p)
    {
        var td = m;
        td.style.visibility="visible";
        td.style.cursor = "hand";
    }

    function dropmenu_onmouseout(m,oc,ofc,p)
    {
        var td = m;
        td.style.visibility="hidden";
    }

    function dropitem_onmouseover(m,oc,ofc,p)
    {
        var td = m;
        var parent = p;
        td.style.backgroundColor=oc;
        td.style.color=ofc;
    }

    function dropitem_onmouseout(m,oc,ofc,p)
    {
        var td = m;
        var parent = p;
        td.style.backgroundColor=oc;
        td.style.color=ofc;
    }

    //**********************************************************************
    //*  text crawler functions
    //*
    //*
    //*
    //**********************************************************************

    function setscroll()
    {

        leftbound = document.getElementById("scroller").style.left.replace("px","");
        rightbound = Number(document.getElementById("scroller").style.width.replace("px",""));
        document.getElementById("scrollertext").style.left = rightbound;  
    
        t=setTimeout("scroll1()",20);

    }
    
    function scroll1()
    {

        t=setTimeout("scroll1()",20);
        left1 = document.getElementById("scrollertext").style.left;
        width1 = document.getElementById("scrollertext").style.width;
        L1 = Number(left1.replace("px",""));
        W1 = Number(width1.replace("px",""));
        LB1 = Number(leftbound);    

        document.getElementById("scrollertext").style.left = L1 - 2;

        if (W1+L1+LB1 <= LB1)  
        { 
            document.getElementById("scrollertext").style.left = rightbound;
        }
    
    }

    function stopscroll()
    {
        clearTimeout(t);
    }

    function resumescroll()
    {
        t=setTimeout("scroll1()",20);
    }
    

    //**********************************************************************
    //*  Launch Videos
    //*
    //*
    //*
    //**********************************************************************

    function play1()
    {

        document.getElementById("WMP1").style.visibility = "visible";

    }
    
    function playfb(url1) {
        window.open(url1);
    }

