/* --------------------------------- */
/*          SOPHIAKNOWS v3.0         */
/* --------------------------------- */
/*           RSS OBJECTS             */
/* --------------------------------- */
/*  Created:  2001-01-01             */
/*  Issued:   2001-01-01             */
/*  Modified: 2004-09-13             */
/*  Component: SKv3.0 RSS OBJECTS    */
/*  Copyright (c) 2001-2004          */
/*  Tony Pisarra, SophiaKnows        */
/* --------------------------------- */
/* --------------------------------- */
/*         RELATED FILES             */
/*---------------------------------- */
/*      1. rss.obj.php               */
/*---------------------------------- */
/*---------------------------------- */

/*---------------------------------- *\


\*---------------------------------- */

var LocalFile=document.location.href.replace(/\?.*$/,"");
LocalFile=LocalFile.replace(/http:\/\/[\w-\.\/]+\/([^\/]+\.\w\w\w)/,"$1");


///////////////////////////////////////
// RSS Channel Constructor:
///////////////////////////////////////
function ChannelObject(n,title,description,link,pubDate,lastBuildDate,language,image,copyright,managingEditor,webMaster,rating,skipHours,skipDays,textinput,docs) {
	this.size=n;
	this.title=title;
	this.description=description;
	this.link=link;
	this.pubDate=pubDate;
	this.lastBuildDate=lastBuildDate;
	this.language=language;
	this.image=image;
	this.copyright=copyright;
	this.managingEditor=managingEditor;
	this.webMaster=webMaster;
	this.rating=rating;
	this.skipHours=skipHours;
	this.skipDays=skipDays;
	this.textinput=textinput;
	this.docs=docs;
	this.item=new InitArray(n);
	}
///////////////////////////////////////
// RSS Item Constructor:
///////////////////////////////////////
function ItemObject(title,pubDate,author,description,category,link,source,guid,enclosure) {
	this.title=title;
	this.pubDate=pubDate;
	this.author=author;
	this.description=description;
	this.category=category;
	this.link=link;
	this.source=source;
	this.guid=guid;
	this.enclosure=enclosure;
	this.xhtml=ReturnXhtmlItem(this.title,this.pubDate,this.author,this.description,this.category,this.link,this.source,this.guid,this.enclosure);
	}


///////////////////////////////////////
// Build 0 Array:
///////////////////////////////////////
function InitArray(n){
   this.size = n;
   for(i=0; i<=n; i++){
      this[i] = 0;
      }
   return(this);
   }


///////////////////////////////////////
// Return XHTML Item:
///////////////////////////////////////
function ReturnXhtmlItem(x_title,x_pubDate,x_author,x_description,x_category,x_link,x_source,x_guid,x_enclosure) {
	var xhtmlItem="";
	xhtmlItem+="<div class=item>";
	xhtmlItem+=((x_title)?"<div class=title><a href="+x_link+" target=new class=blu>"+x_title+"<\/a><\/div>":"");
	xhtmlItem+=((x_author)?"<div class=author>By "+x_author+"<\/div>":"");
	xhtmlItem+=((x_pubDate)?"<div class=pubDate>"+x_pubDate+"<\/div>":"");
	xhtmlItem+=((x_description)?"<div class=description>"+ReturnDisplayHtml(x_description)+"<\/div>":"");
	xhtmlItem+="<\/div>";
	return xhtmlItem;
	}

///////////////////////////////////////
// Return XHTML Headline:
///////////////////////////////////////
function ReturnXhtmlHeadline(x_title,x_pubDate,x_author,x_description,x_category,x_link,x_source,x_guid,x_enclosure) {
	var xhtmlHeadline="";
	xhtmlHeadline+=((x_title)?"<div class=title><a href="+x_link+" target=new>"+x_title+"<\/a><\/div>":"");
	xhtmlHeadline+=((x_pubDate)?"<div class=pubDate>"+x_pubDate+"<\/div>":"");
	return xhtmlHeadline;
	}

///////////////////////////////////////
// Return Channel Items:
///////////////////////////////////////
function ReturnChannelItems(c) {
	var channelHash="";
	channelHash+="<div class=channel>";
	channelHash+="<div id=title><div style=float:right;>("+channel[c].size+" Items)</div><b>"+channel[c].title+"</b></div><br />";
	
		for(i=0;i<channel[c].size;i++) {
			channelHash+=channel[c].item[i].xhtml;
			}

	channelHash+="<\/div>";
	return channelHash;
	}

///////////////////////////////////////
// Return All Channel Items:
///////////////////////////////////////

function ReturnAllChannels() {
	var allChannelHash="";
	for(c=0;c<channel.length;c++) {
		maxno=((channel[c].size>4 && channel.length>1)? 5 : channel[c].size);
		allChannelHash+="<div class=channel>";
		allChannelHash+="<div id=title><div style=float:right><a href=?feeds="+ChannelIds[c]+" class=blu>"+maxno+" of "+channel[c].size+" Items</a></div><b>"+ChannelTitles[c]+"</b></div>";
		for(i=0;i<maxno;i++) {
			allChannelHash+=channel[c].item[i].xhtml;
			}
		}
	return allChannelHash;
	}

function ReturnSidebarHash() {
	sidebarhash="";
	for(l=0;l<ChannelIds.length;l++) {
		sidebarhash+="<p><a href=?feeds="+ChannelIds[l]+" class=blu>"+ChannelTitles[l]+"</a>";
		}
	return sidebarhash;
	}

function make_active_channel_dds() {
	var active_channel_dds="";
	for(l=0;l<ChannelIds.length;l++) {
		active_channel_dds+="<dd><a href=?feeds="+ChannelIds[l]+" class=blu>"+ChannelTitles[l]+"</a></dd>";
		}
	return active_channel_dds;
	}

function ReturnSidebarHash2() {
	sidebarhash="";
	for(l=0;l<ChannelIds.length;l++) {
		sidebarhash+="<div style='padding:4px 0px 4px 0px;'><a href=?feeds="+ChannelIds[l]+" class=blu>"+ChannelTitles[l]+"</a></div>";
		}
	return sidebarhash;
	}


function ReturnDisplayHtml(strIn) {
	strOut=strIn.replace(/&gt;/g,">");
	strOut=strOut.replace(/&amp;/g,"&");	
	strOut=strOut.replace(/&lt;[^>]+>/g,"");
	strOut=strOut.replace(/&quot;/g,"\"");
	return strOut;
	}
