/***************************
 Reger Me Config
 Author: Matt Litherland
 Date: June 2010 
 **************************/


//Right Col Toggle Slide
var allowToogle = true;
$("a.expand").click(function () {
    if (allowToogle) {
        allowToogle = false;
        $("div.expand").slideToggle("slow", function () {
            allowToogle = true
        });
    }
});

//My Registrations
$("a.myregistrations").click(function () {
    $("div.myregistrations").slideToggle("slow");
});

//Notification
/*
  // OnFocus Display With Timeout
  $("input#text_001").focus(function () {
    $("div#ct_notification_001").css('display','block').delay(4800).fadeOut(800);
  });
  
  // OnMouseEnter/Leave Display
  $("input#text_001").mouseenter(function(){
    $("div#ct_notification_001").fadeIn(500);
  });

  $("input#text_001").mouseleave(function(){
    $("div#ct_notification_001").fadeOut(500);
  });
*/

//Footer Classes
$('div.footer_container ul:last-child').addClass('last-child');

//Breadcrumb
$('ul#bc li a').append('<span class="slash">/</span>');

//IE 6 Stuff
$('#searchbar input[type="text"]').addClass('iesearch');

//Textareas
$(document).ready(function () {
$('textarea.auto').elastic() ;
   
});

//Tables
$('ul.table li:nth-child(2n+3)').css('background', '#f9f9f9');
$('#compare_table .row:nth-child(even)').css('background', '#f3f3f3');

//Top Regers Configuration
$(function () {
   if ($(".top_regers > ul > li").length>0)
    $(".top_regers").jCarouselLite({
        vertical: true,
        hoverPause: true,
        visible: 3,
        auto: 4000,
        speed: 1000
    });
});

//Reger Form
$(document).ready(function () {
    $('.postselect:not(.postrefresh)').sSelect({ddMaxHeight:'230px'});
    var zIndexNumber=990;$('div').each(function(){
    if ($(this).attr('id')=="main_wrap") zIndexNumber=1000;    
        $(this).css('zIndex',zIndexNumber);zIndexNumber-=10;
    });
    $("#signin_menu").css('zIndex',1000);
    $("#signin_menu").css("left",($("#header").position().left==0?$("#header").get(0).offsetLeft:$("#header").position().left)+$("#header").width()-18-$("#signin_menu").width());
});
//Reverse z-Index
$(function(){
});



//Remaining Characters
$(document).ready(function () {
    $('.limit').NobleCount('#count_limit', {
        max_chars: 140,
        on_negative: 'go_red',
        on_positive: 'go_green',
        block_negative: true
    });
});

//DatePicker
$(function () {
    $("#datepicker").datepicker({onSelect:function(datetext,inst){
        $("#ctl00_ContentPlaceHolder1_pc_txtPostDate").val(datetext);
    }
    });
});



//Right Col Dropdown
$("a.expand").click(function () {
    $(this).toggleClass("collapse");
    return false;
});


//Terms Textarea
(function () {
    var oldHeight = $(".terms").css("height");
    $(".terms").click(function (e) {
        var $tos = $(e.target);
        $tos.animate({
            height: (($tos.css("height") == oldHeight) ? "12em" : oldHeight)
        }, "fast");
    });
})();
