/* --------------------------------- */
/*          SOPHIAKNOWS v3.0         */
/* --------------------------------- */
/*           INTRO PAGES             */
/* --------------------------------- */
/*  Created:  2001-01-01             */
/*  Issued:   2001-01-01             */
/*  Modified: 2004-03-07             */
/*  Component: RSS INTRO PAGES       */
/*  Copyright (c) 2001-2004          */
/*  Tony Pisarra, SophiaKnows        */
/* --------------------------------- */
/* --------------------------------- */
/*         RELATED FILES             */
/*---------------------------------- */
/*      1. rss.4.php                 */
/*---------------------------------- */
/*---------------------------------- */



// A1. ITEM

function Item(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.xhtmlshow=xhtmlshow(this.title,this.pubDate,this.author,this.description,this.category,this.link,this.source,this.guid,this.enclosure);
	}


function xhtmlshow(itemTitle,itemPubDate,itemAuthor,itemDescription,itemCategory,itemLink,itemSource,itemGuid,itemEnclosure) {
	itemHtml="<div class=item>\n";
	itemHtml+=((itemTitle)?"<div class=title><a href="+itemLink+" target=newsWindow class=charcoal>"+itemTitle+"<\/a><\/div>\n":"");
	itemHtml+=((itemPubDate)?"<div class=pubDate>"+itemPubDate+"<\/div>\n":"");
	itemHtml+=((itemAuthor)?"<div class=author>"+itemAuthor+"<\/div>\n":"");	
	itemHtml+=((itemDescription)?"<div class=description>"+itemDescription+"<\/div>\n":"<div class=description>Sorry. No Description Available<\/div>\n");
	itemHtml+="<\/div>\n";
	return itemHtml;
	}



// AUTO-TOC: SET BASE DATES
today=new Date();
thisMonth=today.getMonth()
thisMonth++;
thisYear = today.getYear()
thisYear+=((thisYear < 2000)?1900:0);
startYear=((thisMonth>5)?thisYear:(thisYear-1));

// AUTO-TOC: VJEL VOLUMES
VolumeLabels=new Array();
VolumeLabels["1998-1999"]="Volume 1";
VolumeLabels["2000-2001"]="Volume 2";
VolumeLabels["2001-2002"]="Volume 3";
VolumeLabels["2002-2003"]="Volume 4";
VolumeLabels["2003-2004"]="Volume 5";
VolumeLabels["2004-2005"]="Volume 6";
VolumeLabels["2005-2006"]="Volume 7";
VolumeLabels["2006-2007"]="Volume 8";
VolumeLabels["2007-2008"]="Volume 9";
VolumeLabels["2008-2009"]="Volume 10";
VolumeLabels["2009-2010"]="Volume 11";
VolumeLabels["2010-2011"]="Volume 12";
VolumeLabels["2011-2012"]="Volume 13";

// AUTO-TOC: RETURN ARTICLE VOLUMES
function ReturnArticleVols() {
//	startYear=((thisMonth>5)?startYear:(startYear-1));
	YearLinks="<tr><td width=\"100\"><p class=\"small\" align=\"right\"><a href=http://www.vjel.org/articles.php?vols="+startYear+"-"+(startYear+1)+">Current<br />Volume<\/a><\/td><\/tr>\n";
	for(y=startYear-1;y>1997;y--) {
		if(y!=1999) {YearLinks+="<tr><td width=\"100\"><p class=\"small\" align=\"right\"><a href=http://www.vjel.org/articles.php?vols="+y+"-"+(y+1)+">"+VolumeLabels[y+"-"+(y+1)]+"<\/a><\/td><\/tr>\n";}
		}
//	YearLinks+="<tr><td width=\"100\"><p class=\"small\" align=\"right\">"+maillink()+"E-mail Link<br />to Friend<\/a><\/td><\/tr>\n"
	return YearLinks;
	}

// AUTO-TOC: RETURN EDITORIAL VOLUMES
function ReturnEditorialVols() {
	YearLinks="<tr><td width=\"100\"><p class=\"small\" align=\"right\"><a href=http://www.vjel.org/editorials.php?vols="+startYear+"-"+(startYear+1)+">Current<br />Editorials<\/a><\/td><\/tr>\n";
	for(y=startYear-1;y>1999;y--) {
		YearLinks+="<tr><td width=\"100\"><p class=\"small\" align=\"right\"><a href=http://www.vjel.org/editorials.php?vols="+y+"-"+(y+1)+">"+y+"-"+(y+1)+"<\/a><\/td><\/tr>\n";
		}
	return YearLinks;
	}

// AUTO-TOC: RETURN ESSAY VOLUMES
function ReturnEssayVols() {
	YearLinks="";
	for(y=startYear;y>1997;y--) {
		YearLinks+="<tr><td width=\"100\"><p class=\"small\" align=\"right\"><a href=http://www.vjel.org/roscoe/roscoehogan.php?vols="+y+">"+y+" Contest<\/a><\/td><\/tr>\n";
		}
	return YearLinks;
	}





// A4a. SK1-4.0: GENERIC: TOGGLE CHECKBOX
function ToggleCheckbox(what) {
	what.checked=((what.checked)?0:1);
	}

// A4b. SK1-4.0: GENERIC: TOGGLE RADIO
function ToggleRadio(what) {
	what.checked=1;
	}


// A. VCR RETURN(S):

// A1. VCR RETURN FIRST	
function ReturnFirst(c,m) {
	c=0;
	return c;
	}
// A2. VCR RETURN BACK
function ReturnBack(c,m) {
	c=((c>0)?f-1:m-1);
	return c;
	}
// A3. VCR RETURN NEXT	
function ReturnNext(c,m) {
	counter=((c<m-1)?c+1:0);
	return c;
	}
// A4. VCR RETURN LAST
function ReturnLast(c,m) {
	c=m-1;
	return c;
	}

// B. COOKIES //

var today = new Date();
var cookiePath = ReturnPath(self.location.href);
var cookieDomain = ReturnDomain(self.location.href);


// B1. COOKIES: UPDATE COOKIE //
function UpdateCookie(listin) {
	feedlist=listin;
	Reset_Cookie("feeds",feedlist,"/sk30/","www.sophiaknows.com");
	}

// B1A. COOKIES: UPDATE COOKIE //
function SetFeedListCookie(listin) {
	feedlist=listin;
	Reset_Cookie("myfeeds",feedlist,"/sk30/","www.sophiaknows.com");
	}

// B2. COOKIES: RETURN PATH //
function ReturnPath(where) {
	urlString=where.replace(/\/[^\/]+$/,"");
	urlString=urlString.replace(/http:\/\/[^\/]+\//,"/");
	urlString=urlString.replace(/file:\/\/\//,"/");
	return urlString;
	}
// B3. COOKIES: RETURN DOMAIN //
function ReturnDomain(where) {
	domainString=where.replace(/\/[^\/]+$/,"");
	domainString=domainString.replace(/http:\/\/([^\/]+)\/.+$/,"$1");
	return domainString;
	}
// B4. COOKIES: SET COOKIE //
function Set_Cookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
	}
// B5. COOKIES: RESET COOKIE //	
function Reset_Cookie(nameIn,valueIn,pathIn,domainIn) {
	theName=nameIn;
	tgeValue=valueIn;
	theExpiration=new Date(today.getTime() + (1 * 86400000));
	thePath=pathIn;
	theDomain=domainIn;
	Set_Cookie(theName,valueIn,theExpiration,thePath,theDomain)
	}
// B6. COOKIES: GET COOKIEs //
function Get_Cookie(name) {
	var start = document.cookie.indexOf(name+"=");
	var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
	}

// B7. COOKIES: RESET COOKIE //	
function Kill_Cookie(nameIn,pathIn,domainIn) {
	theName=nameIn;
	theValue="";
	theExpiration=new Date(today.getTime() - (1 * 86400000));
	thePath=pathIn;
	theDomain=domainIn;
	Set_Cookie(theName,theValue,theExpiration,thePath,theDomain);
	}

//	C1A1. RETURN CURRENT FILE

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

//	C1A2. RETURN CURRENT URL

function ReturnCurrentUrl() {
	currentLocation=document.location.href.replace(/\?.*$/,"");
	return currentLocation;
	}

//	C1B1. SK1.0-4.0: GENERIC: PARSE FORM 
function ParseForm() {
	if(document.location.search.indexOf('=')>-1) {
		formvalsues=document.location.search.substring('1').split('&');
		for(v=0;v<formvalsues.length;v++) {
			tempEq=formvalsues[v].replace(/=/,"='");
			eval(tempEq+"'");
			}
		}
	}

//	C1C. SK1.0-4.0: GENERIC: POP TOOLS
function PopToolParams(url,w,h) {
	w=((w)?w:550);
	h=((h)?h:450);
	targetWindow = url;
	eval("helpWindow=window.open(targetWindow,\"\",\"width="+w+",height="+h+",scrollbars=yes,resizable=yes\")");
	}

//	C1C1. SK1.0-4.0: GENERIC: GO TO
function GoTo(url) {
	document.location.href=url;
	}


function maillink() {
	return "<a class=\"gr\" href=\"http://www.vjel.org/mailto.php?link="+document.location.href+"\">";
	}


//	C1D. SK1-4: GENERIC: ENTITIES: NUMERATE ENTITIES

LatinEntities=new Array("&nbsp;","&iexcl;","&cent;","&pound;","&curren;","&yen;","&brvbar;","&sect;","&uml;","&copy;","&ordf;","&laquo;","&not;","&shy;","&reg;","&macr;","&deg;","&plusmn;","&sup2;","&sup3;","&acute;","&micro;","&para;","&middot;","&cedil;","&sup1;","&ordm;","&raquo;","&frac14;","&frac12;","&frac34;","&iquest;","&Agrave;","&Aacute;","&Acirc;","&Atilde;","&Auml;","&Aring;","&AElig;","&Ccedil;","&Egrave;","&Eacute;","&Ecirc;","&Euml;","&Igrave;","&Iacute;","&Icirc;","&Iuml;","&ETH;","&Ntilde;","&Ograve;","&Oacute;","&Ocirc;","&Otilde;","&Ouml;","&times;","&Oslash;","&Ugrave;","&Uacute;","&Ucirc;","&Uuml;","&Yacute;","&THORN;","&szlig;","&agrave;","&aacute;","&acirc;","&atilde;","&auml;","&aring;","&aelig;","&ccedil;","&egrave;","&eacute;","&ecirc;","&euml;","&igrave;","&iacute;","&icirc;","&iuml;","&eth;","&ntilde;","&ograve;","&oacute;","&ocirc;","&otilde;","&ouml;","&divide;","&oslash;","&ugrave;","&uacute;","&ucirc;","&uuml;","&yacute;","&thorn;","&yuml;");
function NumerateEntities(latinated) {
	numerated=latinated;
	for(i=0;i<96;i++) {
		stringIn=LatinEntities[i];
		stringInUpper=LatinEntities[i].toUpperCase();
		stringOut="&#"+(parseInt(i)+160)+";";
		eval("numerated=numerated.replace(/"+stringIn+"/g,stringOut)");
		eval("numerated=numerated.replace(/"+stringInUpper+"/g,stringOut)");
		}
	return numerated;
	}


