$(function(){
/********************/
//quickly hide everything before we manipulate it to death
$("body").hide();

// handle css by stripping all styles and then attaching our own
$("[type*=css], style").remove();
$("head").append('<link href="http://allartlicensing.com/css/allartlicensing.css" rel="stylesheet" type="text/css" /><link href="http://allartlicensing.com/css/blog.css" rel="stylesheet" type="text/css" />');

// rename and edit parts of the blog code to coincide with actual site code
$("#page").attr("id","container");
$("#banner").attr("id","title").children().wrap("<p/>");
$("#content").wrap("<div id='body'/>");
$("#menu").attr("id","sidebar").appendTo("#body");
$(".footerHeader").attr("id","footer").insertAfter("#container");;
$("#blogText .entryLast").addClass("entry");
$("#blogText .entry>:nth-child(4)").attr("class","links");
$(".byline,.links").wrapInner("<p/>");
$(".menuTitle").wrapInner("<h2/>");
$.getScript("http://chcs.com/js/blurFocus.js");

// find the NAVIGATION box and turn it into an actual menu

$("<div id='nav'/>").append("<ul class='main'></ul>").appendTo("#container");
$(".rightMenu:contains(NAVIGATION)").find("a").each(function(){
    $(this).appendTo("#nav ul.main").wrap("<li>");
}).end().remove();
$("#nav li:contains(Home)").addClass("home");

$("a[href=http://blog.allartlicensing.com]").attr("href","http://allartlicensing.com");

// add a proper h1 and turn the blog entries into h2's
$("h1").each(function(){
	$(this).replaceWith("<h2>"+ $(this).html() +"</h2>")
});
$("#content").prepend("<h1>"+ $("#title a").text() +"</h1>");


// all manipulations complete, and page loaded, open the curtain
$(window).load(function(){
	$("body").show();
});
/********************/
});