﻿window.addEvent('domready', function()
{
    var pPosts = $$('.homePosts li');
    pPosts[0].set({ 'styles': { 'padding-left': '0'} });
    pPosts[4].set({ 'styles': { 'padding-left': '0'} });
    pPosts[7].set({ 'styles': { 'background-image': 'none'} });
    var sl = new Fx.Scroll('homeSlider');
    var isInitial = true;
    var btnOldNew = $('btnOldNew');
    $$('#nav-challenges a')[0].addEvent('click', function(e) { e.stop(); });
    btnOldNew.addEvent('click', function(e)
    {
        e.stop();
        if (isInitial)
        {
            sl.toElement(pPosts[4]);
            btnOldNew.set({ 'text': 'Previous Posts', 'styles': { 'width': '100px', 'background-image': 'url(/_images/bg_whichDeviceB.gif)'} });
            isInitial = false;
        }
        else
        {
            sl.toLeft();
            btnOldNew.set({ 'text': 'More Posts', 'styles': { 'width': '75px', 'background-image': 'url(/_images/bg_whichDevice.gif)'} });
            isInitial = true;
        }
    });
});
window.addEvent('domready', function()
{
    Register_TopNav();
    $$('#nav-challenges a')[0].addEvent('click', function(e) { e.stop(); });
});
function Register_TopNav()
{
    $$("#nav ul").getParent().addEvents(
    {
        mouseover: function()
        {
            this.getElements('ul').each(function(el) { el.addClass('hoverUL'); });
            this.getElements('div').each(function(el) { el.addClass('hoverDIV'); });
        },
        mouseout: function()
        {
            this.getElements('ul').each(function(el) { el.removeClass('hoverUL'); });
            this.getElements('div').each(function(el) { el.removeClass('hoverDIV'); });
        }
    });
}