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/neighbourhood-police-students";
this.title[0] = "NEIGHBOURHOOD POLICING TEAMS WORK WITH STUDENTS";
this.link[1] = "http://press.homeoffice.gov.uk/press-releases/Cutting-Red-Tape";
this.title[1] = "NEW MEASURES TO CUT RED TAPE IN THE FIGHT AGAINST KNIFE CRIME";
this.link[2] = "http://press.homeoffice.gov.uk/press-releases/millions-to-tackle-youth-crime";
this.title[2] = "£56.5M ALLOCATED TO TACKLE YOUTH CRIME";
this.link[3] = "http://nds.coi.gov.uk/Content/Detail.asp?ReleaseID=377945&NewsAreaID=2";
this.title[3] = "GANGS: YOU AND YOUR CHILD NEW ADVICE FOR PARENTS ON GANGS";
this.link[4] = "http://www.cjsonline.gov.uk/the_cjs/whats_new/news-3687.html";
this.title[4] = "SOLICITOR GENERAL LAUNCHES SCHEME TO KEEP WOMEN OUT OF PRISON";
this.link[5] = "http://www.communities.gov.uk/news/corporate/942845";
this.title[5] = "NEW LAWS PASSED TO COMMUNITIES AND COUCILS TO TACKLE PUBLIC SAFETY";
this.link[6] = "http://www.homeoffice.gov.uk/about-us/news/england-team";
this.title[6] = "ENGLAND TEAM BACKS ANTI-KNIFE CAMPAIGN";
this.link[7] = "http://press.homeoffice.gov.uk/press-releases/tackling-knives";
this.title[7] = "TACKLING KNIVES, SAVING LIVES - INCREASED ACTION TO TACKLE KNIFE CRIME";
this.link[8] = "http://press.homeoffice.gov.uk/press-releases/Crackdonw-On-Knife-Crime";
this.title[8] = "CRACKDOWN ON UNDERAGE SALE OF KNIVES";
this.link[9] = "http://press.homeoffice.gov.uk/press-releases/Crime-Maps";
this.title[9] = "NEW INTERACTIVE LOCAL CRIME MAPS IN EVERY AREA";
this.link[10] = "http://nds.coi.gov.uk/Content/Detail.asp?ReleaseID=374220&NewsAreaID=2";
this.title[10] = "DRAMATIC FALL IN CRIME IN ENGLAND AND WALES";
this.link[11] = "http://press.homeoffice.gov.uk/press-releases/New-Appraoch-To-Youth-Crime";
this.title[11] = "£100M TRIPLE TRACK APPROACH TO REDUCING YOUTH CRIME";
this.link[12] = "http://nds.coi.gov.uk/Content/Detail.asp?ReleaseID=373866&NewsAreaID=2";
this.title[12] = "£100 MILLION TRIPLE TRACK APPROACH TO TACKLING YOUTH CRIME";
this.link[13] = "http://nds.coi.gov.uk/Content/Detail.asp?ReleaseID=373564&NewsAreaID=2";
this.title[13] = "NEW POWERS TO STOP SEX OFFENDERS";
this.link[14] = "http://press.homeoffice.gov.uk/press-releases/Prostitution";
this.title[14] = "TACKLING DEMAND FOR PROSTITUTION - THE DUTCH MODEL";
this.link[15] = "http://press.homeoffice.gov.uk/press-releases/Asset-Recovery-Distributed";
this.title[15] = "POLICE AND KEY AGENCIES RECEIVE £18M CASH BOOST TO FIGHT CRIME";
this.link[16] = "http://press.homeoffice.gov.uk/press-releases/Crime-Communities";
this.title[16] = "THE WAY AHEAD FOR SAFER COMMUNITIES: GOVERNMENT RESPONSE TO THE CASEY REVIEW";
this.link[17] = "http://nds.coi.gov.uk/Content/Detail.asp?ReleaseID=371046&NewsAreaID=2";
this.title[17] = "ENGAGING COMMUNITIES IN FIGHTING CRIME";
this.link[18] = "http://press.homeoffice.gov.uk/press-releases/Neighbourhood-Watch-Website";
this.title[18] = "NEIGHBOURHOOD WATCH WEBSITE LAUNCHED DURING NEIGHBOURHOOD WATCH WEEK";
this.link[19] = "http://press.homeoffice.gov.uk/press-releases/Binge-Drinking-Campaign";
this.title[19] = "LAUNCH OF NEW MULTI-MILLION BINGE DRINKING CAMPAIGN";
}