/********************************************************************
    File:   
        index.js
    Brief:  
        Implementation of JavaScript functionality 
        for the index.php page
    Dependencies:
        jquery-1.3.2.min.js     (jQuery library)
        jquery.easing.1.2.js    (jQuery library plugin)
        cufon-yui.js            (font replacement tool)         
    Author:
        DigitalCavalry
    Author URI:
        http://graphicriver.net/user/DigitalCavalry
*********************************************************************/
// alias to jQuery library, function noConflict release control of the $ variable 
// to whichever library first implemented it
var $j = jQuery.noConflict();
/**************************
    NEWS BAR CODE
**************************/
// time interval between news text change
var g_newsBarInterval = 8000;
// number of news determined dynamically
var g_newsCount = 0
// current number of displayed news, start index from one
var g_actualNews = 1;
// handle to displayed news
var g_newsThis = null;
// Auto play function for news bar, is calling itself in some period time

/***************************************

    CODE FOR TABS

****************************************/

// handle to selected tab

var g_selectedTab = null;

var g_tabsBtnColor = "#3399CC";



function setupTabs()

{

    // selecting all tab switch on

    var tabs = $j(".tabsBtn");



    // for every tab we doing the same things

    for(var i = 0; i < tabs.length; i++)

    {

        // veriable for object with class tabsDefaultTab

        var defaultTab = null;

        // lets find default tab element

        defaultTab = $j(tabs[i]).find(".tabsDefaultTab");

        // if currently analysed tab contains the default tab element 

        if(0 != defaultTab.length)

        {

            var tabSource = $j(tabs[i]).find(".tabsSource").text();

            $j(tabSource).css("display", "block").css("top", 0);

            $j(tabs[i]).each(function(){g_selectedTab = this;});

            $j(tabs[i]).css("background-color", g_tabsBtnColor);

            break;

        }

    } // for





    $j(".tabsBtn").click(

        function()

        {

             if(g_selectedTab == this)

             {

                return;

             } 

             if(g_selectedTab != null)

             {

                $j(g_selectedTab).css("background-color", "#b5b29e");

             }

             var oldSource = $j(g_selectedTab).find(".tabsSource").text();

             g_selectedTab = this;

             $j(this).css("background-color", g_tabsBtnColor);

             

             $j(oldSource).animate({opacity: 0.0}, 200, 

                function()

                {

                    $j(this).css("display", "none");

                    var tabSource = $j(g_selectedTab).find(".tabsSource").text();

                    $j(tabSource)

                        .css("opacity", 0.0)

                        .css("top", 0)

                        .css("display", "block")

                        .animate({opacity: 1.0}, 400); 

                }

             );

        }

    );



    $j(".tabsBtn").hover(

        function()

        {

            if(this != g_selectedTab)

            {

                $j(this).css("background-color", g_tabsBtnColor);

            }

        },

        function()

        {

            if(this != g_selectedTab)

            {

                $j(this).css("background-color", "#b5b29e");

            }

        }

    );

} // end of function setupTabs  

       



       

/***************************************

    MAIN CODE - CALL THEN PAGE LOADED

****************************************/

       

// binding action to event onload page

$j(document).ready(

    function()

    {

        // common.js

        /*setupGlobal();

        setupCommunityButtons();            

        setupToolTipText();

        setupSearchBox();

        setupCufonFontReplacement();

        setupSideBarMiniSlider();

        setupLinkLightBox();

        setupSidebarTabsPanel();

        setupLoadingAsynchronousImages();

        setupToolTipImagePreview();*/

        //setupTextLabelImagePreview();

        //setupFaderMoverSlider();   

        // this file

        //setupAdditionalCufonFontReplacement();

        //setupLoadingAsynchronousImagesForAccordion();

        //setupLoadingAsyncSlideStripImages();

       // setupNewsBar();

        setupTabs();

		try{

        //setupAccordionImageSlider();

      //  setupAccordionControlPanel();        

        //setupAccordionAutoPlay();

		}catch(e){}

        //setupLatestNews();

    }

);


