/* --------------------------------- */
/*          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;
	}

titleMonths = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
weekDays = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
today = new Date()
this_year = today.getYear()

if (this_year < 2000) { this_year += 1900 }
now=today.getSeconds();

function ReturnTextDate() {
	textDateString=weekDays[today.getDay()]+", "+ today.getDate() +" "+titleMonths[today.getMonth()]+" "+this_year;
	return textDateString;
	}	


// 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\")");
	return false;
	}
//	C1C. SK1.0-4.0: GENERIC: POP TOOLS
function PopTool(url) {
	w=550;
	h=450;
	targetWindow = url;
	eval("helpWindow=window.open(targetWindow,\"\",\"width="+w+",height="+h+",scrollbars=yes,resizable=yes\")");
	return false;
	}

//	C1C. SK1.0-4.0: GENERIC: ALT POP
function AltPop(whichlink,w,h) {
	targetWindow = whichlink.href;
	eval("helpWindow=window.open(targetWindow,\"_pop\",\"width="+w+",height="+h+",scrollbars=yes,resizable=yes\")");	
	return false;
	}



//	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;
	}
	
// D MENUS


startList = function() {
	if (document.all&&document.getElementById && document.getElementById("nav")) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
				this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	}

window.onload=startList;


// E. FORMS

function Reset(what,whattext) {
	what.value=((what.value==whattext)?"":what.value);
	}


// F. STYLES

function setActiveStyleSheet(title) {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
	 if(a.getAttribute("rel").indexOf("style") != -1
		&& a.getAttribute("title")) {
	   a.disabled = true;
	   if(a.getAttribute("title") == title) a.disabled = false;
	}
	}
	}



//	G.	MAIL ENCODING

//	MAIL ENCODING

function Escapeit(charsin) {
	rechars="";
	for(c=0;c<charsin.length;c++) {
		rechars+=chars[charsin.charAt(c)];
		}
	document.forms[0].words.value=unescape("copyrights"+"%"+"40sophiaknows"+"%"+"2E"+"com");
	escapewin=window.open("","","width=700,height=200,resizable=yes");
	escapewin.document.write(rechars);
	escapewin.document.close();
	}

function MakeLink(ID) {
	ID=ID.replace(/(\w\w)/g,"%$1");
	return "<a class=blu href=\"mailto:"+unescape(ID)+"\">"+unescape(ID)+"<\/a>";
	}

chars=new Array()
chars["."]="2E";
chars["@"]="40";
chars["A"]="41";
chars["B"]="42";
chars["C"]="43";
chars["D"]="44";
chars["E"]="45";
chars["F"]="46";
chars["G"]="47";
chars["H"]="48";
chars["I"]="49";
chars["J"]="4A";
chars["K"]="4B";
chars["L"]="4C";
chars["M"]="4D";
chars["N"]="4E";
chars["O"]="4F";
chars["P"]="50";
chars["Q"]="51";
chars["R"]="52";
chars["S"]="53";
chars["T"]="54";
chars["U"]="55";
chars["V"]="56";
chars["W"]="57";
chars["X"]="58";
chars["Y"]="59";
chars["Z"]="5A";
chars["a"]="61";
chars["b"]="62";
chars["c"]="63";
chars["d"]="64";
chars["e"]="65";
chars["f"]="66";
chars["g"]="67";
chars["h"]="68";
chars["i"]="69";
chars["j"]="6A";
chars["k"]="6B";
chars["l"]="6C";
chars["m"]="6D";
chars["n"]="6E";
chars["o"]="6F";
chars["p"]="70";
chars["q"]="71";
chars["r"]="72";
chars["s"]="73";
chars["t"]="74";
chars["u"]="75";
chars["v"]="76";
chars["w"]="77";
chars["x"]="78";
chars["y"]="79";
chars["z"]="7A";



