//Goals: don't display milestones on top of each other
//	 highlight sections when hovering over their side labels

//  Add to Results_Header: 
//	<script src="/philologic/milestones.js"></script>
// 	$(document).ready(function(){
//      	killOverlap();       
//        	highlight(); 
//	});
//AND 
//	window.onresize = resize;


function trimKwicLines(){
	var contentwidth = $(".content").width();
        $(".left").each(function (i) {
                var width = $(this).width();
		var leftoffset = contentwidth*.4 - width*1 - 2;
		$(this).css("left", leftoffset);
	});

	$("#message").css("visibility", "hidden");
	$("#hits").css("visibility", "visible");
}

function killOverlap (){
$lastOffset = 0;

$(".mstonecustom").each(function (i) {
	if (this.offsetTop == $lastOffset){
		this.className = "mstonen2";	
	}
	else {
		$lastOffset = this.offsetTop;
	}
});

}

function resize(){
	$(".mstonen2").each(function (i){
		this.className = "mstonecustom";
	});
	killOverlap();
	trimKwicLines();
}

function jq(myid) { //colons can't be in jquery's ids! 
   return '#' + myid.replace(/(:|\.)/g,'\\$1');
}

function highlight(){
        $(".mstonecustom").hover(
                function () {
                        myid = jq("text" + $(this).attr('id'));
			$(myid).css({"font-weight" : "bolder"});
                },
                function () {
			myid = jq("text" + $(this).attr('id'));
                        $(myid).css({"font-weight" : "normal"});                                  
		}
			)
}















