$jQ(function(){

	$jQ('#living .heritage img').show();

	// My Heritage Place cleanup 
	$jQ('.sidebar').each(function(){
		var sideimage = $jQ(this).children('img').attr('src');
		if (!sideimage=="") {
			$jQ(this).show();
		}
	});

	// Slideshow
	$jQ('#slide').cycle({ 
		fx: 'fade', 
		timeout: 5000
 	});

	// Carousel
	window.list = $jQ('.new_register ul');
	window.parentlength = list.parent().width();
	
	children = list.children().length;
	childrenwidth = list.children().outerWidth(true);
	window.childrentotal = children * childrenwidth;

	window.list.css('width', childrentotal);

	$jQ('#prev').click(function(){
		if (!list.is(':animated')) {
			newmargin = list.margin().left+150;
			if(newmargin <= 0) {
				list.animate({marginLeft: newmargin}, 550);
				}
		}
	});

	$jQ("#next").click(function(){
		if (!list.is(':animated')) {
			newmargin = list.margin().left-150;
			if(newmargin + list.width() >= parentlength) {
				list.animate({marginLeft: newmargin}, 550);	
				}
		}
	});

	// Accordian
	$jQ('.item dd').eq(2).show();	
	$jQ('.item dt').click(function() {
		$jQ('.item').children('dd:visible').slideUp("slow");
		$jQ(this).next().slideToggle('slow')
	});

	// Drop-down menu
	$jQ('li ul li:not(:last-child)').css({backgroundColor : '#dbdbdb'});
	$jQ('li ul li:last-child').css('background', 'url(_master/images/li_last.png)');
//	$jQ('li ul li:last-child').hide();
	$jQ('li').hover(function(){
		$jQ(this).children('ul').show();
	}, function(){
		$jQ(this).children('ul').hide();	
	});

});