function changeCssClass( oElement, sClass )
{
    if( isCssClassExists( oElement, sClass ) )
    {
        deleteCssClass( oElement, sClass );
    }
    else
    {
        addCssClass( oElement, sClass );
    }
}

function deleteCssClass( oElement, sClass )
{
    if( isCssClassExists(oElement, sClass) )
    {
        var sClassNames = getCssClass(oElement);
        var aClassNames = sClassNames.split(' ');
        aClassNames.splice( aClassNames.indexOf(sClass), 1 );
        setCssClass(oElement, aClassNames.join(' '));
    }
}

function addCssClass( oElement, sClass )
{
    if( !isCssClassExists( oElement, sClass ) )
    {
        var aClassNames = getCssClass(oElement).split(' ');
        aClassNames.push(sClass);
        setCssClass(oElement, aClassNames.join(' '));
    }
    
}


function isCssClassExists( oElement, sClass )
{
    var sClassNames = getCssClass(oElement);
    return (sClassNames.indexOf(sClass) != -1)
}

function setCssClass( oElement, sClass )
{
    oElement.className = sClass;
}

function getCssClass( oElement )
{
    return oElement.className;
}
