function submenu(theid) {
	$(theid).corner('10px');
	$(theid+' li').last().css('border-bottom', 'solid 1px #fff');
}



function random_header_image() {
	var header_images = new Array(
		"header1.jpg",
		"header2.jpg",
		"header3.jpg",
		"header4.jpg",
		"header5.jpg",
		"header6.jpg",
		"header7.jpg"
	);
	var random_image = Math.floor(Math.random()*header_images.length);
	$('#header-image').css('background-image', 'url(//blog.cycleconfident.com/wp-content/themes/cycleconfident/header_images/'+header_images[random_image]+')');
}



$(document).ready(function(){
	
	random_header_image();
	
	submenu('#submenu');
	submenu('#categories');
	submenu('#archives');
	submenu('#links');

	// Selected menu items.
	// -----------------------------------------------------------------------------
	$('#submenu').children('.current_page_ancestor').children('a:eq(0)').attr('class', 'selected');
	
	
	
	

	// Set the height of the sidebar if less than 193px high.
	// -----------------------------------------------------------------------------
	// if ( $('#blob2').height() < 193 ) {
	// 	$('#blob2').css('padding-bottom', 193-$('#blob2').height()+'px')
	// }
	
	
	
	
	
	// Image formatting.
	// Adjust formatting if there is more than 1 image.
	// -----------------------------------------------------------------------------
	// function image_reformat() {
	// 	var image_count = $('.page-images > .page-image').size();
	// 	if (image_count > 1) {
	// 		$('.page-images').attr('class', 'page-images-wide');
	// 		setHeight(".page-images-wide", 2, 0);
	// 	}
	// }
	// 
	// function setHeight(theClass, cols, item_height) {
	// 	
	// 	$('body').append('<div id="debug"></div>');
	// 	
	// 	$(theClass).wrapInner('<div class="inner"></div>');			// Wrap div around content of outer div.
	// 	var block_count = $(theClass+' .inner').children().size();	// Count number of blocks.
	// 	var block_item = '.'+$(theClass+' .inner').children('div:eq(0)').attr("class");	// Get the class name of repeating blocks.
	// 	
	// 	var looper = 0;												// Initialise variable.
	// 	while (looper < block_count) {								// Loop for number of blocks...
	// 		$(theClass).children('.inner').children(block_item).slice(0,cols).wrapAll('<div class="block-row"></div>');
	// 		looper = looper+cols;	// Set for next row group.
	// 	}
	// 	
	// 	if (item_height == 1) {											// Use if each block has background.
	// 		var largestHeight = 1;										// Initialise variable.
	// 		$(theClass+' .inner .block-row>div').each(function (i) {	// Loop through each block...
	// 			if (parseInt($(this).height()) > largestHeight) {		// If current block is the tallest block yet...
	// 				largestHeight = parseInt($(this).height());			// Set height placeholder to current block height.
	// 			}
	// 		});
	// 		$(theClass+' .inner .block-row>div').css("height", largestHeight);	// Set all blocks to tallest value.
	// 	}
	// }
	// 
	// image_reformat();
	
	
	
	
	
	// Fix PNGs for IE6.
	// -----------------------------------------------------------------------------
	// $(document).pngFix();
	
});





// Fix blog button highlight when on search page.
// -----------------------------------------------------------------------------
function fix_blog_button() {
	$('.current_page_parent').removeAttr('class');
}
