﻿/// <reference path="jquery.intellisense.js"/>
var keyStatus = 0;
var bodyTag;

$(document).ready(function () {

    //Mark first paragraph in a row with class first
    //Mark last paragraph in a row with class last
    $("p + p")
	    .not(":last").addClass("middle").end()
	    .filter(":last").addClass("last").end()
	;

    //Mark first list item in a row with class first
    //Mark last list item in a row with class last
    //$("li:last-child").addClass("last").end()
    //;

    //Prevent IE dotted line around focused links
    //Highlight links when focussed through tab key (or any other key): 
    //		css class "tabbed" assigned to body tag when link focused by key
    bodyTag = $("body");
    $(document)
		.bind("keydown", function () { keyStatus = 1; })
		.bind("keyup", function () { keyStatus = 0; })
		.bind("mousedown", function (e) { keyStatus = 0; bodyTag.filter(".tabbed").removeClass("tabbed"); })
	;
    $("a")
		.each(function () { this.hideFocus = true; })
		.bind("mouseover", function (e) { keyStatus = 0; bodyTag.filter(".tabbed").removeClass("tabbed"); })
		.bind("focus", function (e) {
		    if (keyStatus == 1) bodyTag.filter(":not(.tabbed)").addClass("tabbed");
		    keyStatus = 0;
		})
	;

	// Replace "full story"
	$('p.sf_readMore a').text("...");

}
);




