/*

	AppWare.Web.Marketing Core JavaScript library
	Copyright (c) 2010 AppWare, LLC. All rights reserved.
	File: core.js
	Modified: 4-Feb-2010
	Created: 10-Jun-2009
	Developed by AppWare, LLC. [www.appware.biz]
	
*/


/* HOME PAGE FEATURE */
var homePageFeatureActiveItemIndex = 0;
var homePageFeatureCount = 6;

function indexHomePageFeature()
{
    var idPrefix = 'homePageFeature';
    var feature = document.getElementById(idPrefix + homePageFeatureActiveItemIndex);
	feature.style.visibility = 'hidden';
	if ( homePageFeatureActiveItemIndex++ == homePageFeatureCount - 1 )
	{
	    homePageFeatureActiveItemIndex = 0;
    }
    feature = document.getElementById(idPrefix + homePageFeatureActiveItemIndex);
	feature.style.visibility = 'visible';
}


/* OUR WORK CONTROL */
var ourWorkActiveItemIndex = -1;

function setOurWorkItemLink(index, action)
{
    var link = document.getElementById('OurWorkLink' + index);
    if ( link !== null )
    {
        if ( action == 'collapse' )
        {
            link.title = 'Read More';
            link.style.backgroundPosition = '6px -4px';
        }
        else if ( action == 'expand' )
        {
            link.title = 'Collapse';
            link.style.backgroundPosition = '6px -30px';
        }
    }
}

function setOurWorkItemContent(index, action)
{
    var content = document.getElementById('OurWorkContent' + index);
    if ( content !== null )
    {
        if ( action == 'collapse' )
        {
            content.style.display = 'none';
        }
        else if ( action == 'expand' )
        {
            content.style.display = 'block';
        }
    }
}

function collapseOurWorkItem(index)
{
    setOurWorkItemContent(index, 'collapse');
    setOurWorkItemLink(index, 'collapse');
    ourWorkActiveItemIndex = -1;
}

function expandOurWorkItem(index)
{
    setOurWorkItemLink(index, 'expand');
    setOurWorkItemContent(index, 'expand');
    ourWorkActiveItemIndex = index;
}

function toggleOurWorkItem(index)
{
    if ( index == ourWorkActiveItemIndex )
    {
        collapseOurWorkItem(index);
    }
    else
    {
        if ( ourWorkActiveItemIndex != -1 )
        {
            collapseOurWorkItem(ourWorkActiveItemIndex);
        }
        expandOurWorkItem(index);
    }
}