function myRSS(URI) {
// properties
this.URI = URI;
this.offset = 0;
this.maxItems = 20;
this.itemsPerPage = 3;
this.credits = "CR News Headlines Reader\nby Sean Groundwater (c) BiP Solutions 2006";
this.title = new Array();
this.link = new Array();
this.opacitySetting = 0;
this.fadeTimer1 = 0;
if (window.getComputedStyle) {//detect if moz-opacity is defined in external CSS for specified class
this.mozopacityisdefined=
(window.getComputedStyle(document.getElementById("rss"), "").getPropertyValue("-moz-opacity")==1)? 0 : 1
}
// methods
this.getContent = getContent;
this.formatRSS = formatRSS;
this.prev = prev;
this.next = next;
this.formatLinks = formatLinks;
this.transition = transition;
// let's do stuff...
this.getContent();
this.formatRSS(0);
}
function next () {
// display next items
if (this.offset < this.maxItems - this.itemsPerPage) {
this.offset += this.itemsPerPage;
this.formatRSS(this.offset);
}
}
function prev () {
// display previous items
if (this.offset > 0) {
this.offset -= this.itemsPerPage;
this.formatRSS(this.offset);
}
}
function formatRSS ( offset) {
var mydiv = document.getElementById("rss");
mydiv.innerHTML = ""; // clear the previous list
var items_count=this.title.length;
ul = document.createElement("ul");
ul.setAttribute("class","external-links");
mydiv.appendChild(ul);
var displayItemCount = 0;
if (items_count < this.itemsPerPage) {
displayItemCount = items_count;
} else {
displayItemCount = this.itemsPerPage;
}
if (offset > 0) { }
this.transition("reset");
var limit = displayItemCount + offset < this.maxItems ? displayItemCount + offset : this.maxItems;
for(var i=offset; i" + title_w + "
";
ul.appendChild(litag);
}
this.formatLinks();
myInstance = this;
this.fadetimer1=setInterval(function(){myInstance.transition('up', 'fadetimer1')}, 100) //FADE EFFECT- PLAY IT
}
function formatLinks () {
/* decide to hide the 'previous' link (if we are at the beginning
* of the list) or hide the 'next' link (if we are at the end of
* the list
*/
var newLinks = document.getElementById("newsLinks");
// clumsy way of doing it to get around IE javascript/stylesheet bug (as opposed
// to using setAttribute()...
title = "";
var hidStyle = "style=\"font-size:smaller;text-decoration:none;color:#9999CC;margin-left:25px;margin-bottom:50px\"";
var visStyle = "style=\"font-size:smaller;text-decoration:underline;cursor:pointer;margin-left:25px;margin-bottom:50px\"";
// alert(this.offset + " " + this.maxItems + " " + this.itemsPerPage);
if (this.offset == 0) {
newLinks.innerHTML = title +
"< Previous " +
"Next >";
} else if (this.offset >= this.maxItems - this.itemsPerPage) {
newLinks.innerHTML = title +
"< Previous " +
"Next >";
} else {
newLinks.innerHTML = title +
"< Previous " +
"Next >";
}
}
function transition(fadetype, timerid){
var myDiv=document.getElementById("rss");
if (fadetype=="reset") this.opacitysetting=0.2;
if (myDiv.filters && myDiv.filters[0]) {
if (typeof myDiv.filters[0].opacity=="number") { //IE6+
myDiv.filters[0].opacity=this.opacitysetting*100;
} else { //IE 5.5
myDiv.style.filter="alpha(opacity="+this.opacitysetting*100+")";
}
} else if (typeof myDiv.style.MozOpacity!="undefined" && this.mozopacityisdefined) {
myDiv.style.MozOpacity=this.opacitysetting;
}
if (fadetype=="up")
this.opacitysetting+=0.2;
if (fadetype=="up" && this.opacitysetting>=1)
clearInterval(this[timerid]);
}
function getContent () {
this.link[0] = "http://press.homeoffice.gov.uk/press-releases/local-crime-figures";
this.title[0] = "LOCAL CRIME FIGURES AND NEIGHBOURHOOD POLICE DETAILS AT THE TOUCH OF A BUTTON";
this.link[1] = "http://http://press.homeoffice.gov.uk/press-releases/more-victim-support";
this.title[1] = "MORE SUPPORT FOR VICTIMS AS HOME SECRETARY DEMANDS TOUGH LOCAL ACTION AGAINST ANTI-SOCIAL BEHAVIOUR";
this.link[2] = "http://www.justice.gov.uk/news/newsrelease290909a.htm";
this.title[2] = "JACK STRAW ANNOUNCES PLANS FOR NATIONAL VICTIMS' SERVICE";
this.link[3] = "http://press.homeoffice.gov.uk/press-releases/tough-new-powers";
this.title[3] = "TOUGH NEW POWERS TO HELP VICTIMS BREAK CYCLE OF DOMESTIC VIOLENCE";
this.link[4] = "http://nds.coi.gov.uk/content/detail.aspx?NewsAreaId=2&ReleaseID=407036&SubjectId=2";
this.title[4] = "SCHOOLBOY'S DANCING WINS NATIONWIDE 'GOOD 4 THE HOOD' COMPETITION TO HELP TACKLE YOUTH CRIME";
this.link[5] = "http://nds.coi.gov.uk/content/detail.aspx?NewsAreaId=2&ReleaseID=407032&SubjectId=2";
this.title[5] = "HELPING VULNERABLE WOMEN OFFENDERS";
this.link[6] = "http://nds.coi.gov.uk/content/detail.aspx?NewsAreaId=2&ReleaseID=407019&SubjectId=2";
this.title[6] = "DESIGNERS TO FIND NEW WAYS OF PROTECTING SHOPKEEPERS FROM CRIME";
this.link[7] = "http://press.homeoffice.gov.uk/press-releases/plans-tackle-youth-violence";
this.title[7] = "EXPANDED PLANS TO TACKLE SERIOUS YOUTH VIOLENCE UNVEILED";
this.link[8] = "http://www.justice.gov.uk/news/newsrelease110609a.htm";
this.title[8] = "MORE KNIFE CRIME OFFENDERS JAILED";
this.link[9] = "http://press.homeoffice.gov.uk/press-releases/tack-irresponsible-alcohol-sales";
this.title[9] = "TOUGH NEW POWERS AND MANDATORY CODE TO TACKLE IRRESPONSIBLE ALCOHOL SALES";
this.link[10] = "http://press.homeoffice.gov.uk/press-releases/health-taskforce-violence-women";
this.title[10] = "NEW HEALTH TASKFORCE TO SPOT SIGNS OF VIOLENCE AGAINST WOMEN";
this.link[11] = "http://press.homeoffice.gov.uk/press-releases/new-crime-strategy-published";
this.title[11] = "PUBLIC GIVEN GREATER SAY AS NEW CRIME STRATEGY PUBLISHED";
this.link[12] = "http://nds.coi.gov.uk/Content/Detail.asp?ReleaseID=399422&NewsAreaID=2";
this.title[12] = "CRIME IN ENGLAND AND WALES QUARTERLY UPDATE YEAR ENDING DECEMBER 2008";
this.link[13] = "http://nds.coi.gov.uk/Content/Detail.asp?ReleaseID=398734&NewsAreaID=2";
this.title[13] = "NEW GUIDANCE TO CRACK DOWN ON DANGEROUS DOGS";
this.link[14] = "http://nds.coi.gov.uk/Content/Detail.asp?ReleaseID=398627&NewsAreaID=2";
this.title[14] = "NEW MEASURES TO SUPPORT VICTIMS OF SEXUAL ASSAULT";
this.link[15] = "http://nds.coi.gov.uk/Content/Detail.asp?ReleaseID=398011&NewsAreaID=2";
this.title[15] = "CRAKCING DOWN ON BURGLARY";
this.link[16] = "http://www.justice.gov.uk/news/11770.htm";
this.title[16] = "£3.7m FOR VICTIMS OF HUMAN TRAFFICKING";
this.link[17] = "http://press.homeoffice.gov.uk/press-releases/Tough-measure-protect-vulnerable";
this.title[17] = "TOUGH NEW MEASURES TO PROTECT THE VULNERABLE";
this.link[18] = "http://www.defra.gov.uk/news/latest/2009/localenv-0317.htm";
this.title[18] = "STEPPING UP THE FIGHT AGAINST LITTER";
this.link[19] = "http://press.homeoffice.gov.uk/press-releases/Funding-to-tackle-mobphone-crime";
this.title[19] = "NEW FUNDING TO TACKLE MOBILE PHONE CRIME";
}