// -----------------------------------------------------
// -- Blog ---------------------------------------------
// -----------------------------------------------------
jQuery(document).ready(function() {
							
	jQuery('.typography').prepend('<span></span>');
	jQuery('.typography .WidgetHolder h3:first').css({'border-top':'1px solid #cccccc'});
	jQuery('.typography .WidgetHolder h3').next().hide();
	jQuery('.typography .WidgetHolder h3').next().css({'background':'transparent url(themes/horngroup/images/blog_accordion_selected.png) 0px 0px no-repeat'});
	//jQuery('.typography .WidgetHolder:has(h3.open)').children().hide();
	
	jQuery('.typography:not(:first)').children('span').css({'background':'transparent url(themes/horngroup/images/blog_accordion_top2.png) 0px 0px no-repeat'});

	jQuery('.typography .WidgetHolder h3').click(function(){
		if(jQuery(this).hasClass('open')){
			jQuery(this).next().slideUp(250);
			jQuery(this).removeClass();
		} else {
			jQuery('.open').removeClass();
			jQuery(this).addClass('open').next().slideDown(250);
			jQuery('.typography .WidgetHolder h3:not(.open)').next().slideUp(250);
			if (jQuery(window).scrollTop() > jQuery('#Sidebar').offset().top){
				jQuery('html,body').animate({scrollTop: (jQuery('#Sidebar').offset().top - 20)}, 500);
			}
		}
	});
	
	//setTimeout("jQuery('.typography .WidgetHolder:first h3').removeClass().addClass('open').next().slideDown(500);", 500);
	setTimeout("jQuery('.typography .WidgetHolder h3.open').next().slideDown(500);", 500);
	
	// js for the Blog Comments
	jQuery('ul#PageComments li p.comment').before('<span></span>');
	
	// js for the Blog Chiclets
	jQuery('p#chiclets').after('<p id="chiclets2"></p>')
	jQuery('p#chiclets a').each(function(i){
		var varA = jQuery(this);
		var varB = jQuery(this).children('img').attr('id');
		var varC = varA.attr({id:varB, alt:varB, title:varB});
		jQuery('p#chiclets2').append(varC);
		//jQuery(this).attr({id:getAttr});
		//jQuery(this).children('img').remove();
	});
	jQuery('p#chiclets').remove();
	jQuery('p#chiclets2').removeAttr('id').attr({id:'chiclets'});
	jQuery('p#chiclets a').each(function(i){
		jQuery(this).children('img').remove();
	});
	jQuery('p#chiclets').after('<div class="clear"></div>');
});

