window.addEvent('domready', function() {
    var scroller = new Fx.Scroll(window);
    var top = $('accordian').getPosition().y - 10;
    var scroll = idd = false;
    if (window.location.href.match(/aboutus/))
	scroll = true;

    if (window.location.href.match(/#what/)) {
        var idd = true;
       body_index = 0;
    } else if (window.location.href.match(/#why/)) {
        var idd = true;
        body_index = 1;
    } else {
		if (window.location.href.match(/#how/)) {
			var idd = true;
		}
        body_index = 0;
    }

    //create our Accordion instance
    var myAccordion = new Accordion($('accordian'), 'div.toggler', 'div.element', {
        display: body_index,
        opacity: false,
        onActive: function(toggler, element){
            toggler.setStyle('color', '#41464D');
            x = toggler.getElement('div.expander')
            x.setStyle('display', 'none');
            if (idd == true) {
                (function (){
                    scroller.start(0, top);
                }).delay(500);
            }
	    if (scroll == true)
              idd = true;
        },
        onBackground: function(toggler, element){
            toggler.setStyle('color', '#528CE0');
            x = toggler.getElement('div.expander')
            x.setStyle('display', '');
        }
    });

});
