                                                                                                                                                                                                                                                                                                                                $(function(){

 $('.divisionLinks', $('#divisions').parent().siblings('#leftLoginSub')).show();
 $('.box dd:last').addClass('bottom');
$('.box dd a:contains("Home")').parent().hide();

});



$(document).ready(function() {
   



$('#category ul').hide();
$('#catLink').click(function() {
$('#category ul').slideToggle();
});


$('.send iframe').hide();
//$('.send a.sendLink').click(function(){
//$(this).next().slideToggle();
//});




$('.send a.sendLink').click(function(){
  $(this).next().slideToggle();
  var id = $(this).attr('rel');
  var sendvar ="#send"+id;
var title = $(sendvar).parent().siblings("strong").html();
var link =$(sendvar).parent().siblings("a").attr('href');
  var currentIFrame = "#testiframe"+id;

 $(currentIFrame ).contents().find("body #TBTitle").val(title);
 $(currentIFrame ).contents().find("body #TBLink").val(link);
});

//datepicker
$('#datepicker').datepicker({
     maxDate: "+0M +0D",
     dateformat: 'yyyy-mm-d',
     //showOtherMonths: true,
     //selectOtherMonths: true,
     beforeShowDay: $.datepicker.noWeekends,
     onSelect: function(day){
       //alert('selected');
       pickDate(day);
     }
});

jQuery('.ui-datepicker-week-end a').each(function(){
    var $link = jQuery(this);
    $link.after($link.text());
    $link.remove();
});

function pickDate(obj){
//var testDate = $('#datepicker').datepicker('getDate');
//alert(obj);

var m_names = new Array("January", "February", "March", 
"April", "May", "June", "July", "August", "September", 
"October", "November", "December");

var newMonth = obj.substr(0,2);
var newDay = obj.substr(3,2);
var newYear = obj.substr(6,4);

//var clickDate = $.datepicker.formatDate('yy-MM-d', new Date(newYear, newMonth - 1, newDay));

var clickDate = new Date(newYear,newMonth,newDay);

var m = m_names[clickDate.getMonth() - 1];
var y = clickDate.getFullYear();
var d = clickDate.getDate();

//alert(m + '/' + d + '/' + y);

if(newDay.indexOf("0")==0){
  newDay = newDay.substring(1);
}
var textMonth = m_names[newMonth-1];

//window.location = "/Paperclips/Blog+Date?month="+m+"&day="+d+"&year="+y;
window.location = "/Paperclips/Blog+Date?month="+textMonth+"&day="+newDay+"&year="+newYear;


}

/*$("#datepicker a").click(function(){
//var testDay = $(this).datepicker.getDate();
//alert(testDay);
var day = $(this).text();
var month = $('.ui-datepicker-month').text(); 
var year = $('.ui-datepicker-year').text(); 
alert(month + '/' + day + '/' + year);
window.location = "/Paperclips/Blog+Date?month="+month+"&day="+day+"&year="+year;
});*/




//unsubscribe user email
$('#unsub').click(function(){
var useremail = $('.lbemailaddress').text();
window.location = "/unsubscribe.aspx?email="+useremail;

});

//send to a friend toggle border class
$('.sendLink').click(function(){
$('.send').toggleClass('send-active');
});




// Hides Title on the right hand side of attorney's info if no content is found 
 
$(".clearArticle").each(function(){ 
var alphaExp = new RegExp(/[A-Za-z0-9_]/); 
var txt = $(this).text(); 
if(alphaExp.test(txt) == false){ 
$(this).siblings(".category").hide(); 
} 
}); 





});
