$(document).ready(function(){



function getvariable(variable, whatstring) {
            if(whatstring==null){var whatstring = window.location.search.substring(1);}
            var vars = whatstring.split("&");
            for (var i=0;i<vars.length;i++) {
              var pair = vars[i].split("=");
              if (pair[0] == variable) {
              return pair[1];
            }
            }
}

			
$("div.postholder div:gt(0)").each(function(){
	m=$(this).html();
	r="<div class=\"postdetails\"><a href=\"#\" class=\"close\">Close</a>"+m+"</div>";
	$(this).find("p").hide();
	$(this).find("p").eq(0).show();
	$(this).find("p").eq(0).append("<p><a href=\"#\" class=\"expand\">More Details</a></p>");
	o=$(this).html();
	x="<div class=\"original\">"+o+"</div>";
	$(this).html(r+x);
		
});

$("a.close").click(function(){
	$("div.postdetails").css("display","none");
	$("div.original").show();
	return false;
});
	
$("a.expand").click(function(){
expand($("a.expand").index(this));
	return false;
});

if(getvariable("news")!=null){
	anchor=getvariable("news");
	m=$(document).find("a[name="+anchor+"]");
	m.parent().parent().find("div.postdetails").show();
	m.parent().parent().find("div.original").hide();	
};



expand(0);

});

function expand(z){
	$("div.postdetails").hide();
	$("div.original").show();
	$("a.expand").eq(z).parent().parent().parent().find("div.postdetails").show();
	$("a.expand").eq(z).parent().parent().parent().find("div.original").hide();
}

if($.browser.msie && $.browser.version <= 8) {
	$("ul.slider").css("width", "950px");
	$("p.rotatorheader").css("padding-right", "42px");
};

