var root
if (location.protocol == "file:") root = "sierraclub/"
else if (location.protocol == "http:") root = "http://houston.sierraclub.org/"

var feednum = 0

function feeds(name) {
	this.name = name
	this.feeds = new Array()
	}

function feed(url,title) {
	this.url = url
	this.title = title
	}

myfeeds = new feeds("myfeeds")

//feeds page 1
myfeeds.feeds[0] = new feed('x.xml','')
myfeeds.feeds[1] = new feed('actionrss.xml','Take Action')
myfeeds.feeds[2] = new feed('progrss.xml','Programs')
myfeeds.feeds[3] = new feed('daytriprss.xml','Outings, Day Trips and More')
myfeeds.feeds[4] = new feed('bannerrss.xml','Bayou Banner')
// end of feeds

// strip html
function stripHTML(myString) {
	var re = /<\S[^><]*>/g
	myString = myString.replace(/<br>/g,"\n")
	return myString.replace(re, "")
	}

// initiate single feed display
function display_window(feednum) {
	var url = myfeeds.feeds[feednum].url
	var title = myfeeds.feeds[feednum].title
	display_feed_window(url,title)
	}

// display a single picture window
function display_feed_window(url,title) {

	var window_width = Math.round(screen.width * 0.5)
	var window_height = Math.round(screen.height * 0.5)

	window_properties = 'resizable=yes,width=' + window_width + ',height=' + window_height + ',scrollbars=yes'

	var x = Math.floor(Math.random() * 10000)
	var address = x.toString()
	window3=window.open('about:blank',address,window_properties)
	window3.document.writeln('<html>')
	window3.document.writeln('<head>')
	window3.document.writeln('<title>Houston Sierra Club RSS Feed</title>')
	window3.document.writeln('<link href="' + root + 'sierraclub_style.css" type="text/css" rel="stylesheet">')
	window3.document.writeln('<link rel="shortcut icon" href="' + root + 'favicon.ico" type="image/x-icon">')
	window3.document.writeln('<link rel="icon" href="' + root + 'favicon.ico" type="image/x-icon">')
	window3.document.writeln('<!-- START -->')
	window3.document.writeln('<script language="JavaScript1.2" type="text/javascript">')
	window3.document.writeln('<!-- //')
	window3.document.writeln('function open_parent(x) {opener.open(x)}')
	window3.document.writeln('// -->')
	window3.document.writeln('</script>')
	window3.document.writeln('<!-- END -->')
	window3.document.writeln('</head>')
	window3.document.writeln('<body>')
	window3.document.writeln('<form ID="actionForm" name="actionForm"><input type="button" value="Close Window" title="Close window" name="B1" onClick="self.close()"></form>')
	window3.document.writeln('<div style="margin: 5px">')
	window3.document.writeln('<p>Subscribing to:</br><span class="graphicheader">Houston Sierra Club - ' + title + '</span></p>')
	window3.document.writeln('<p><strong>So what do I actually do to subscribe?</strong> It\'s easy. All newsreaders are a little bit different; once you\'ve set up a newsreader or other tool for receiving syndicated content, just copy the URL below and paste it into the "Add" feature of your newsreader. Your newsreader does the rest.</p>')
	window3.document.writeln('<p><strong>http://houston.sierraclub.org/rss/' + url + '</strong></p>')
	window3.document.writeln('<p>These links will help with some of the more popular readers:</p>')
	window3.document.writeln('<p>IE7 or Firefox: <a href="javascript: void(open_parent(\'' + root + 'rss/' + url + '\'));self.close()"><img src="' + root + 'images/xml.gif" border="0"></a></p>')
	window3.document.writeln('<p>Google: <a href="javascript: void(open_parent(\''+ 'http://fusion.google.com/add?feedurl=http%3A//houston.sierraclub.org/rss/' + url + '\'));self.close()"><img src="' + root + 'images/google-icon.gif" border="0"></a></p>')
	window3.document.writeln('<p>My Yahoo: <a href="javascript: void(open_parent(\''+ 'http://add.my.yahoo.com/content?.intl=us&url=http%3A//houston.sierraclub.org/rss/' + url + '\'));self.close()"><img src="' + root + 'images/yahoo-icon.gif" border="0"></a></p>')
	window3.document.writeln('<p>Bloglines: <a href="javascript: void(open_parent(\''+ 'http://www.bloglines.com/sub/http%3A//houston.sierraclub.org/rss/' + url + '\'));self.close()"><img src="' + root + 'images/bloglines-icon.gif" border="0"></a></p>')
	window3.document.writeln('<p>My AOL: <a href="javascript: void(open_parent(\''+ 'http://feeds.my.aol.com/add.jsp?url=http%3A//houston.sierraclub.org/rss/' + url + '\'));self.close()"><img src="' + root + 'images/aol-icon.gif" border="0"></a></p>')
	window3.document.writeln('</div>')
	window3.document.writeln('</body>')
	window3.document.writeln('</html>')
	window3.document.close()
	}