$(document).ready(function() {
	//articleEnd();
	flashReplace();
	loginMeIn();
	archiveDetail();
	archiveFindFarRight();
	moreArticleDetail();
});

function articleEnd(){
	//Find the end
	var paras = $('#theguts p').length;
	var lastPara = paras - 2;
	var img = 
	
	$('#theguts p').eq(lastPara).append("<img src=\"/images/v8/ico/ico_flame.gif\" class=\"articleEnd\"/>");
}

function flashReplace(){
	if ($("#theguts #flashvid").length > 0){
	var flash = $("div#flashvid").html();
	$("#content img.titleimg").after(flash).remove();
	}
}

function loginMeIn(){
	$('#loginLink').click(function(){
		if ($("#loginThing").is(":hidden")) {
        $("div").slideDown("slow");
      } else {
        $("#loginThing").slideUp();
      }
		return false;	
	});
	
}

function archiveDetail(){
	
	$(".oa").hover(
		function () {
				nextUL = $(this).next();
				
				//$(".oa").parent().siblings().find('ul:visible').slideUp(300);
				nextUL.slideDown(500);
			},
			function() {
				// Anything open? Close it.
					
				nextUL.slideUp(150);
			}
		);
}

function archiveFindFarRight(){
	$(".archivedArticle li:nth-child(7n)").addClass("last");
	$(".moreArticles li:nth-child(2n)").addClass("last");
}


function moreArticleDetail(){
	
	$(".ma").hover(
		function () {
				nextUL = $(this).next();
				nextUL.slideDown(500);
			},
			function() {
				// Anything open? Close it.
				nextUL.slideUp(150);
			}
		);
}