/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

jQuery(document).ready(function($) {
    //alert('here');
    var loop=true;
    var $current_menu_item=$("#menu-jdouglas .current-menu-item");
    if ($current_menu_item.parent().prev('a').text().indexOf('Sales Professionals')==0) {

        var $map_container=$("#content_nosidebar .page");
        $map_container.css({
            position: 'relative',
            top:0,
            left:0
        })
        .find(".alignleft").css({
            'float':'none',
            margin:0
        });
        if (loop) {
            if ($current_menu_item.next().length) {

                $("<a>").appendTo($map_container).addClass('next').attr({
                    href:$current_menu_item.next().children('a').attr('href')
                });

            }
            else {
                 $("<a>").appendTo($map_container).addClass('next').attr({
                    href:$($current_menu_item.siblings(":first")).children('a').attr('href')
                });

            }
            if ($current_menu_item.prev().length) {
                $("<a>").appendTo($map_container).addClass('prev').attr({
                    href:$current_menu_item.prev().children('a').attr('href')
                });

            }
            else {
                 $("<a>").appendTo($map_container).addClass('prev').attr({
                    href:$current_menu_item.siblings(":last").children('a').attr('href')
                });
            }
        }else {
            if ($current_menu_item.next().length) {

                $("<a>").appendTo($map_container).addClass('next').attr({
                    href:$current_menu_item.next().children('a').attr('href')
                });

            }
            if ($current_menu_item.prev().length) {
                $("<a>").appendTo($map_container).addClass('prev').attr({
                    href:$current_menu_item.prev().children('a').attr('href')
                });

            }
        }
      
    }

})

