function ShowFaqCol(){
  $('#help-page-content').fadeOut('fast');
  $('#selected-content').html($('#faq-help-col').html());
  $('.faq-section').fadeIn('slow');
  $('.faq-section').animate({opacity:1}, 500);
  return false;
}

function ShowKbCol(){
  $('#help-page-content').fadeOut('fast');
  $('#selected-content').html($('#kb-help-col').html());
  $('.faq-section').fadeIn('slow');
  $('.faq-section').animate({opacity:1}, 500);
  return false;
}

function ShowAccCol(){
  $('#help-page-content').fadeOut('fast');
  $('#selected-content').html($('#my-account-col').html());
  return false;
}

function ShowServiceCol(){
  $('#help-page-content').fadeOut('fast');
  $('#selected-content').html($('#service-col').html());
  return false;
}

function ShowTestimonialsCol(){
  $('#help-page-content').fadeOut('fast');
  $('#selected-content').html($('#sitetools-col').html());

  return false;
}

function ShowAllCol(){
  $('#help-page-content').fadeIn('fast');
  $('#selected-content').html("");
  $('#faq-help-col .faq-section').hide();
  return false;
}
function ScrollToElement(theElement){
  var selectedPosX = 0;
  var selectedPosY = 0;
  while(theElement != null){
    selectedPosX += theElement.offsetLeft;
    selectedPosY += theElement.offsetTop;
    theElement = theElement.offsetParent;
  }
 window.scrollTo(selectedPosX,selectedPosY);
}
$(function(){
    $('.faq-container').corner("round 8px").parent().css('padding', '2px').corner("round 9px");
    $('.faq_answer').corner("round 8px");
    $('.feedbacks').corner("round 8px");
    $('.testimonials_table').corner("round 8px");
    $('.addTestimonialsForm').corner("round 8px");
    $('.faq-section').corner('5px');

    $('table.feedbacks tr:gt(10)').hide();

    $('#submitTestimonialLink').toggle(
        function(){
            $('.submitTestimonialBody').fadeIn(500,function(){
                ScrollToElement($('.addTestimonialsForm')[0]);
            });
            $('.feedbacks').fadeOut();
            return false;
        },
        function(){
            $('.submitTestimonialBody').fadeOut(500,function(){
                ScrollToElement($('.feedbacks')[0]);
            });
            $('.feedbacks').fadeIn();
            return false;
        }
      //$('.feedbacks').animate({height:"toggle"});
      //return false;
    );

    //$('.submitTestimonialBody').animate({height:"toggle"});


    $(".faq_question").click(function(){
        $(".faq_question").removeClass("gray_container_faq");
        $(".faq_answer").slideUp("slow").removeClass("blue_container");
        $(this).next().addClass("blue_container").slideToggle("slow");
        $(this).addClass("gray_container_faq");
        return false;
    });

    $('#help-page-content #faq-help-col .section-header a').click(ShowFaqCol);
    $('#help-page-content #kb-help-col .section-header a').click(ShowKbCol);

    $(".faq_question").live('click', function(){
        $(".faq_question").removeClass("gray_container_faq");
        $(".faq_answer").slideUp("slow").removeClass("blue_container");
        $(this).next().addClass("blue_container").slideToggle("slow");
        $(this).addClass("gray_container_faq");
        return false;
    });
 
    ShowAllCol();
});
