/*

About Us javascript

*/

var auState = 'aboutUs';

function rolloverAboutUsOn(auItem)
{
    if(auItem=='aboutUs')
    {
        $(auItem).addClass('aboutUsOn'); 
        $(auItem).removeClass('aboutUs'); 
    }
    else
    {
        $(auItem).addClass('subAboutUsOn'); 
        $(auItem).removeClass('subAboutUs'); 
    }

}

function rolloverAboutUsOff(auItem, isClick)
{
    if(auState!=auItem||isClick)
    {
        if(auItem=='aboutUs')
        {
            $(auItem).addClass('aboutUs'); 
            $(auItem).removeClass('aboutUsOn');
        }
        else
        {
            $(auItem).addClass('subAboutUs'); 
            $(auItem).removeClass('subAboutUsOn'); 
        }
    }
}

function aboutUsMenuClick(auItem)
{
        rolloverAboutUsOff(auState, true);
        rolloverAboutUsOn(auItem);
}

function initAboutUs()
{
    //Initialize menu
    //About Us (home) content
    $('aboutUs').addEvent('click', function(e) {
	e = new Event(e).stop();
	window.open('about.aspx', '_self');
    });

    //Contact Us content
    $('contact').addEvent('click', function(e) {
	e = new Event(e).stop();
	window.open('contact.aspx', '_self');
    });

    //Team content
    $('team').addEvent('click', function(e) {
	e = new Event(e).stop();
	window.open('team.aspx', '_self');
    });

    //Careers content
    $('careers').addEvent('click', function(e) {
	e = new Event(e).stop();
	window.open('careers.aspx', '_self');
    });

    //History content
    $('history').addEvent('click', function(e) {
    	e = new Event(e).stop();
	window.open('history.aspx', '_self');
    });

    //auState  = window.location.href.substring(window.location.href.lastIndexOf('/') + 1, window.location.href.length - 1);
    if(window.location.href.toLowerCase().indexOf('aboutUs') != -1)
       auState  = 'aboutUs';
    if(window.location.href.toLowerCase().indexOf('history') != -1)
       auState  = 'history';
    if(window.location.href.toLowerCase().indexOf('contact') != -1)
       auState  = 'contact';
    if(window.location.href.toLowerCase().indexOf('careers') != -1)
       auState  = 'careers';
    if(window.location.href.toLowerCase().indexOf('team') != -1)
       auState  = 'team';

    if(auState!='aboutUs'&&auState!='history'&&auState!='team'&&auState!='contact'&&auState!='careers')
        auState = 'aboutUs';
    rolloverAboutUsOn(auState);
}

window.addEvent('domready', initAboutUs);
