
// 'stacks' is the Stacks global object.
// All of the other Stacks related Javascript will 
// be attatched to it.
var stacks = {};


// this call to jQuery gives us access to the globaal
// jQuery object. 
// 'noConflict' removes the '$' variable.
// 'true' removes the 'jQuery' variable.
// removing these globals reduces conflicts with other 
// jQuery versions that might be running on this page.
stacks.jQuery = jQuery.noConflict(true);

// Javascript for stacks_in_1_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_1_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_1_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/*!
 * jQuery Countdown plugin v1.0
 * http://www.littlewebthings.com/projects/countdown/
 *
 * Copyright 2010, Vassilis Dourdounis
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
/*!
 * jQuery Countdown plugin v1.0
 * http://www.littlewebthings.com/projects/countdown/
 *
 * Copyright 2010, Vassilis Dourdounis
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
(function($){

	$.fn.countDown = function (options) {

		config = {};

		$.extend(config, options);

		diffSecs = this.setCountDown(config);
	
		if (config.onComplete)
		{
			$.data($(this)[0], 'callback', config.onComplete);
		}
		if (config.omitWeeks)
		{
			$.data($(this)[0], 'omitWeeks', config.omitWeeks);
		}

		$('#' + $(this).attr('id') + ' .digit').html('<div class="top"></div><div class="bottom"></div>');
		$(this).doCountDown($(this).attr('id'), diffSecs, 500);

		return this;

	};

	$.fn.stopCountDown = function () {
		clearTimeout($.data(this[0], 'timer'));
	};

	$.fn.startCountDown = function () {
		this.doCountDown($(this).attr('id'),$.data(this[0], 'diffSecs'), 500);
	};

	$.fn.setCountDown = function (options) {
		var targetTime = new Date();

		if (options.targetDate)
		{
			targetTime = new Date(options.targetDate.month + '/' + options.targetDate.day + '/' + options.targetDate.year + ' ' + options.targetDate.hour + ':' + options.targetDate.min + ':' + options.targetDate.sec + (options.targetDate.utc ? ' UTC' : ''));
		}
		else if (options.targetOffset)
		{
			targetTime.setFullYear(options.targetOffset.year + targetTime.getFullYear());
			targetTime.setMonth(options.targetOffset.month + targetTime.getMonth());
			targetTime.setDate(options.targetOffset.day + targetTime.getDate());
			targetTime.setHours(options.targetOffset.hour + targetTime.getHours());
			targetTime.setMinutes(options.targetOffset.min + targetTime.getMinutes());
			targetTime.setSeconds(options.targetOffset.sec + targetTime.getSeconds());
		}

		var nowTime = new Date();

		diffSecs = Math.floor((targetTime.valueOf()-nowTime.valueOf())/1000);

		$.data(this[0], 'diffSecs', diffSecs);

		return diffSecs;
	};

	$.fn.doCountDown = function (id, diffSecs, duration) {
		$this = $('#' + id);
		if (diffSecs <= 0)
		{
			diffSecs = 0;
			if ($.data($this[0], 'timer'))
			{
				clearTimeout($.data($this[0], 'timer'));
			}
		}

		secs = diffSecs % 60;
		mins = Math.floor(diffSecs/60)%60;
		hours = Math.floor(diffSecs/60/60)%24;
		if ($.data($this[0], 'omitWeeks') == true)
		{
			days = Math.floor(diffSecs/60/60/24);
			weeks = Math.floor(diffSecs/60/60/24/7);
		}
		else 
		{
			days = Math.floor(diffSecs/60/60/24)%7;
			weeks = Math.floor(diffSecs/60/60/24/7);
		}

		$this.dashChangeTo(id, 'seconds_dash', secs, duration ? duration : 800);
		$this.dashChangeTo(id, 'minutes_dash', mins, duration ? duration : 1200);
		$this.dashChangeTo(id, 'hours_dash', hours, duration ? duration : 1200);
		$this.dashChangeTo(id, 'days_dash', days, duration ? duration : 1200);
		$this.dashChangeTo(id, 'weeks_dash', weeks, duration ? duration : 1200);

		$.data($this[0], 'diffSecs', diffSecs);
		if (diffSecs > 0)
		{
			e = $this;
			t = setTimeout(function() { e.doCountDown(id, diffSecs-1) } , 1000);
			$.data(e[0], 'timer', t);
		} 
		else if (cb = $.data($this[0], 'callback')) 
		{
			$.data($this[0], 'callback')();
		}

	};

	$.fn.dashChangeTo = function(id, dash, n, duration) {
		  $this = $('#' + id);
		 
		  for (var i=($this.find('.' + dash + ' .digit').length-1); i>=0; i--)
		  {
				var d = n%10;
				n = (n - d) / 10;
				$this.digitChangeTo('#' + $this.attr('id') + ' .' + dash + ' .digit:eq('+i+')', d, duration);
		  }
	};

	$.fn.digitChangeTo = function (digit, n, duration) {
		if (!duration)
		{
			duration = 800;
		}
		if ($(digit + ' div.top').html() != n + '')
		{

			$(digit + ' div.top').css({'display': 'none'});
			$(digit + ' div.top').html((n ? n : '0')).slideDown(duration);

			$(digit + ' div.bottom').animate({'height': ''}, duration, function() {
				$(digit + ' div.bottom').html($(digit + ' div.top').html());
				$(digit + ' div.bottom').css({'display': 'block', 'height': ''});
				$(digit + ' div.top').hide().slideUp(10);

			
			});
		}
	};

})(jQuery);


jQuery(document).ready(function() {
	
});

function dateFromString(dateString) {
	var str=dateString;
	var dateTimeSplit=str.split(" ");
	var dateSplit=dateTimeSplit[0].split("-");
	var timeSplit=dateTimeSplit[1].split(":");


	var theYear=dateSplit[0];
	var theMonth=dateSplit[1];
	var theDay=dateSplit[2];

	var theHour=parseInt(timeSplit[0]);
	var theMinute=parseInt(timeSplit[1]);
	var theSecond=parseInt(timeSplit[2]);
	
	theMonth-=1;
	
	var theDate=new Date(theYear, theMonth, theDay, theHour, theMinute, theSecond);
	return theDate;
}
function dateToUTC(theDate) {
	var UTCOffsetMilli=theDate.getTimezoneOffset()*60*1000;
	theDate=theDate.getTime()+UTCOffsetMilli;
	var theUTCDate=new Date(theDate);
	return theUTCDate;
}

function toUTC(theDate) {
	var UTCOffsetMilli=theDate.getTimezoneOffset()*60*1000;
	theDate=theDate.getTime()+UTCOffsetMilli;
	return theDate;
}
function dateShow() {
	var today=new Date();
	var startDate=dateFromString("2011-12-24 00:00:00");
	var endDate=dateFromString("2012-03-14 15:09:26");
	if(0) {
		today=toUTC(today);
	}
	
	if((today>startDate) && (today<endDate)){
	
		if('showContent'=='showContent') {
			document.getElementById('onTimestacks_in_1_page0').style.display="block";
			}
		else if('showContent'=='javascript') {
			eval("");
			}
		else if('showContent'=='redirect') {
			var theURL="http://www.rapid-ideas.com";
			document.location.href=theURL;
		}
		
		else if('showContent'=='loadScript') {
			jQuery.getScript("", function() {
				
			});
		}
		
	}
	
	
}

function showCountDown() {
	var str="2012-03-14 15:09:26";
	var dateTimeSplit=str.split(" ");
	var dateSplit=dateTimeSplit[0].split("-");
	var timeSplit=dateTimeSplit[1].split(":");


	var theYear=dateSplit[0];
	var theMonth=dateSplit[1];
	var theDay=dateSplit[2];

	var theHour=parseInt(timeSplit[0]);
	var theMinute=parseInt(timeSplit[1]);
	var theSecond=parseInt(timeSplit[2]);
	
	//theMonth-=1;
	
	
	$('#onTimestacks_in_1_page0 #stacks_in_1_page0countdown_dashboard').countDown({
					targetDate: {
						'day': 		theDay,
						'month': 	theMonth,
						'year': 	theYear,
						'hour': 	theHour,
						'min': 		theMinute,
						'sec': 		theSecond
					}
				});
		
		jQuery('#onTimestacks_in_1_page0 div.dash').css({
			'margin-left': jQuery('#onTimestacks_in_1_page0 div.digit').width()/4,
			'padding-left': jQuery('#onTimestacks_in_1_page0 div.digit').width()/5,
			'padding-right': jQuery('#onTimestacks_in_1_page0 div.digit').width()/5
			});
		jQuery('#onTimestacks_in_1_page0 #stacks_in_1_page0countdown_dashboard').css('width', ((jQuery('#onTimestacks_in_1_page0 div.dash').outerWidth())*5)+(jQuery('#onTimestacks_in_1_page0 div.digit').width()+6));
}

 
jQuery(function() {
	dateShow();
	if ('True'=='True') {
		showCountDown();
	}
});
	return stack;
})(stacks.stacks_in_1_page0);


// Javascript for stacks_in_15_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_15_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_15_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

//-- RSS Typewriter Stack v1.5 by Joe Workman --//

/****** Start liScroll JQuery plugin
 * News ticker plugin (BBC news style)
 * Bryan Gullan,2007-2010
 * version 2.2
 * updated 2010-04-04
 * Documentation at http://www.makemineatriple.com/news-ticker-documentation/
 * Demo at http://www.makemineatriple.com/jquery/?newsTicker
 * Use and distrubute freely with this header intact.
 *
 * I have modified this plugin slightly to support TipTip Integration and a few other things.*/
(function($) {var name='newsTicker';function runTicker(settings) {tickerData = $(settings.newsList).data('newsTicker');if(tickerData.currentItem > tickerData.newsItemCounter){ tickerData.currentItem = 0; } else if (tickerData.currentItem < 0) { tickerData.currentItem = tickerData.newsItemCounter; }if(tickerData.currentPosition == 0) { if(tickerData.newsLinks[tickerData.currentItem].length > 0) { $(tickerData.newsList).empty().append('<li><a class="'+tickerData.linkClass+'" title="'+ tickerData.newsTitles[tickerData.currentItem] +'" href="'+ tickerData.newsLinks[tickerData.currentItem] +'" target="'+tickerData.linkTarget+'"></a></li>'); } else { $(tickerData.newsList).empty().append('<li></li>'); } }if (tickerData.animating) {if( tickerData.currentPosition % 2 == 0) { var placeHolder = tickerData.placeHolder1; } else { var placeHolder = tickerData.placeHolder2; }if( tickerData.currentPosition < tickerData.newsItems[tickerData.currentItem].length) {var tickerText = tickerData.newsItems[tickerData.currentItem].substring(0,tickerData.currentPosition); if(tickerData.newsLinks[tickerData.currentItem].length > 0) { $(tickerData.newsList + ' li a').text(tickerText + placeHolder); } else { $(tickerData.newsList + ' li').text(tickerText + placeHolder); } tickerData.currentPosition ++; setTimeout(function(){runTicker(settings); settings = null;},tickerData.tickerRate); }else {if(tickerData.newsLinks[tickerData.currentItem].length > 0) { $(tickerData.newsList + ' li a').text(tickerData.newsItems[tickerData.currentItem]); } else { $(tickerData.newsList + ' li').text(tickerData.newsItems[tickerData.currentItem]); }setTimeout(function(){ if (tickerData.animating) { tickerData.currentPosition = 0; tickerData.currentItem ++; runTicker(settings); settings = null; } },tickerData.loopDelay);} }else {var tickerText = tickerData.newsItems[tickerData.currentItem];if(tickerData.newsLinks[tickerData.currentItem].length > 0) { $(tickerData.newsList + ' li a').text(tickerText); } else { $(tickerData.newsList + ' li').text(tickerText); }}}$.fn[name] = function(options) {var settings = $.extend({}, $.fn.newsTicker.defaults, options);var newsItems = new Array(); var newsLinks = new Array(); var newsTitles = new Array(); var newsItemCounter = 0;
$(settings.newsList + ' li').hide();$(settings.newsList + ' li').each(function(){ if($(this).children('a').length) { newsItems[newsItemCounter] = $(this).children('a').text(); newsLinks[newsItemCounter] = $(this).children('a').attr('href'); newsTitles[newsItemCounter] = $(this).children('a').attr('title'); } else { newsItems[newsItemCounter] = $(this).text(); newsLinks[newsItemCounter] = ''; newsTitles[newsItemCounter] = ''; } newsItemCounter ++; });var tickerElement = $(settings.newsList);tickerElement.data(name, { newsList: settings.newsList, tickerRate: settings.tickerRate, startDelay: settings.startDelay, loopDelay: settings.loopDelay, placeHolder1: settings.placeHolder1, placeHolder2: settings.placeHolder2, controls: settings.controls, ownControls: settings.ownControls, stopOnHover: settings.stopOnHover, linkClass: settings.linkClass, linkTarget: settings.linkTarget, newsItems: newsItems, newsLinks: newsLinks, newsTitles: newsTitles, newsItemCounter: newsItemCounter - 1, currentItem: 0, currentPosition: 0, firstRun:1 }) .bind({ stop: function(event) { tickerData = tickerElement.data(name); if (tickerData.animating) { tickerData.animating = false; } }, play: function(event) { tickerData = tickerElement.data(name); if (!tickerData.animating) { tickerData.animating = true; setTimeout(function(){runTicker(tickerData); tickerData = null;},tickerData.startDelay); } }, resume: function(event) { tickerData = tickerElement.data(name); if (!tickerData.animating) { tickerData.animating = true; tickerData.currentPosition = 0; tickerData.currentItem ++; runTicker(tickerData); } }, next: function(event) { tickerData = tickerElement.data(name); $(tickerData.newsList).trigger("stop"); tickerData.currentPosition = 0; tickerData.currentItem ++; runTicker(tickerData); }, previous: function(event) { tickerData = tickerElement.data(name); $(tickerData.newsList).trigger("stop"); tickerData.currentPosition = 0; tickerData.currentItem --; runTicker(tickerData); } }); if (settings.stopOnHover) { tickerElement.bind({ mouseenter: function(event) { tickerData = tickerElement.data(name); if (tickerData.animating) { $(tickerData.newsList).trigger("stop"); if (tickerData.controls) { $('.stop').hide(); $('.resume').show(); } } if ($().tipTip) { $('.'+tickerData.linkClass).tipTip(); } }, mouseleave: function(event) { tickerData = tickerElement.data(name); if (!tickerData.animating) { $(tickerData.newsList).trigger("resume"); if (tickerData.controls) { $('.stop').show(); $('.resume').hide(); } } } }); }tickerData = tickerElement.data(name);if (tickerData.controls || tickerData.ownControls) { if (!tickerData.ownControls) { $('<ul class="ticker-controls"><li class="play"><a href="#play">Play</a></li><li class="resume"><a href="#resume">Resume</a></li><li class="stop"><a href="#stop">Stop</a></li><li class="previous"><a href="#previous">Previous</a></li><li class="next"><a href="#next">Next</a></li></ul>').insertAfter($(tickerData.newsList)); } $('.play').hide(); $('.resume').hide();$('.play').click(function(event){ $(tickerData.newsList).trigger("play"); $('.play').hide(); $('.resume').hide(); $('.stop').show(); event.preventDefault(); }); $('.resume').click(function(event){ $(tickerData.newsList).trigger("resume"); $('.play').hide(); $('.resume').hide(); $('.stop').show(); event.preventDefault(); }); $('.stop').click(function(event){ $(tickerData.newsList).trigger("stop"); $('.stop').hide(); $('.resume').show(); event.preventDefault(); }); $('.previous').click(function(event){ $(tickerData.newsList).trigger("previous"); $('.stop').hide(); $('.resume').show(); event.preventDefault(); }); $('.next').click(function(event){ $(tickerData.newsList).trigger("next"); $('.stop').hide(); $('.resume').show(); event.preventDefault(); });};$(tickerData.newsList).trigger("play"); };$.fn[name].defaults = { newsList: "#news", tickerRate: 80, startDelay: 100, loopDelay: 3000, placeHolder1: " |", placeHolder2: "_", controls: true, ownControls: false, stopOnHover: true, linkClass: "newsTicker", linkTarget: "_blank" }})(jQuery);

//---------------------------
// Start Common RSS Code
//---------------------------
formatString = function(str) {
	str = str.replace(/<[^>]+>/ig,'');
	str=' '+str;
	return $.trim(str);
}

enrichString = function(str) {
	str = str.replace(/((ftp|https?):\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?)/gm,'<a href="$1" target="_blank">$1</a>');
	str = str.replace(/([^\w])\@([\w\-]+)/gm,'$1@<a href="http://twitter.com/$2" target="_blank">$2</a>');
	str = str.replace(/([^\w])\#([\w\-]+)/gm,'$1<a href="http://twitter.com/search?q=%23$2" target="_blank">#$2</a>');
	return $.trim(str);
}

parse_date = function(str) {
    if (str.match(/^\d+\-\d+\-\d+T/)) {
        str = str.replace(/T.+$/,'');
    }
	var d = new Date(str);
	var m = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'];
	if (d.getUTCDate()) {
		return d.getUTCDate() + ' ' + m[d.getUTCMonth()] + ' ' + d.getFullYear();
    }
    return str;
};

find_link = function(obj) {
    var default_string = '#';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.origLink == 'string') {
        return obj.origLink;
    }
    else if ($.isArray(obj.link)) {
        var mylink = obj.link[0].href;
        $.each(obj.link,function(index, value){
            if (value.rel === 'alternate') {
                mylink = value.href;
            }
		})
        return mylink;
    }
    else if (typeof obj.link == 'object') {
        return obj.link.href;
    }
    else if (typeof obj.link == 'string') {
        return obj.link;
    }
    else if (typeof obj.enclosure == 'object' && typeof obj.enclosure.url == 'string') {
        return obj.enclosure.url;
    }
    return default_string;
};

find_title = function(obj) {
    var default_string = 'No Items in RSS Feed';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.title.content == 'string') {
        return formatString(obj.title.content);
    }
    else if (typeof obj.title == 'string') {
        return formatString(obj.title);
    }
    return default_string;
};

find_date = function(obj) {
    var default_string = 'Date Unknown';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.pubDate == 'string') {
		return parse_date(obj.pubDate);
    }
    else if (typeof obj.date == 'string') {
		return parse_date(obj.date);
    }
    else if (typeof obj.published == 'string') {
		return parse_date(obj.published);
    }
    else if (typeof obj.updated == 'string') {
		return parse_date(obj.updated);
    }
    return default_string;
};

find_descr = function(obj) {
    var default_string = 'RSS Feed Invalid. No Description Found.';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.description == 'string') {
		return formatString(obj.description);
    }
    else if (typeof obj.encoded == 'string') {
		return formatString(obj.encoded);
    }
    else if (typeof obj.content == 'object' && typeof obj.content.content == 'string') {
		return formatString(obj.content.content);
    }
    return default_string;
};

find_author = function(obj) {
    var default_string = 'Unknown Author';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.creator == 'string') {
		return obj.creator;
    }
    else if ($.isArray(obj.author)) {
        return obj.author[0];
    }
    else if (typeof obj.author == 'object' && typeof obj.author.email == 'string') {
		return obj.author.email;
    }
    else if (typeof obj.author == 'string') {
		return obj.author;
    }
    return default_string;
};

$(document).ready(function() {
	/* Forming the query: */
	var feed = "feed://rss.slashdot.org/Slashdot/slashdot";
	feed = feed.replace(/feed:\/\//,'http://'); // Replace feed:// with http://
	var query = 'select * from feed where url="' + feed + '" LIMIT 10';

	/* Forming the URL to YQL: */
	var url = "http://query.yahooapis.com/v1/public/yql?q="+encodeURIComponent(query)+"&format=json&callback=?";

	$.getJSON(url,function(data){
		if (data.query == null || data.query == undefined || data.query.results == null || data.query.results == undefined) {
			// Invalid or Empty RSS Feed - Add Blank/Default Entries
			add_feed_item();
	 	}
	 	else if ($.isArray(data.query.results.item || data.query.results.entry) ) {  //item exists in RSS and entry in ATOM feeds
			$.each(data.query.results.item || data.query.results.entry,function(){
	       		//Normal RSS Feed
	       		add_feed_item(this);
			})
		}
		else {
		    // RSS Feed with only one item in it
			add_feed_item(data.query.results.item || data.query.results.entry || null);
		}
		post_process_feed(this);
	});
});
//---------------------------
// End Common RSS Code
//---------------------------

function add_feed_item(obj) {
    var maxLength = 150;
    var ticker_options = {
        newsList: "#rss-typewriter-list-stacks_in_15_page0",
		tickerRate: 80,
		startDelay: 100,
		loopDelay: 3000,
		placeHolder1: " |",
		placeHolder2: "_",
		controls: false,
		ownControls: false,
		stopOnHover: true,	  
		linkClass: "tiptip",
		linkTarget: "_blank"
    };

	$('#rss-typewriter-list-stacks_in_15_page0').append('<li><a class="tiptip" title="' + find_date(obj) + 
	  	' - ' + find_descr(obj).substring(0, maxLength) +
		'" href="' + find_link(obj) +
		'" target="_blank">' + find_title(obj) + '</a></li>'
	);
    $().newsTicker(ticker_options);

	return;    	        
};
function post_process_feed(obj) {
	return;    	        
};
//-- End RSS Typewriter Stack --//


	return stack;
})(stacks.stacks_in_15_page0);


// Javascript for stacks_in_62_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_62_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_62_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// TWEETS STACK BY http://www.doobox.co.uk XXXXXXX
// COPYRIGHT@2010 MR JG SIMPSON, TRADING AS DOOBOX
// ALL RIGHTS RESERVED XXXXXXXXXXXXXXXXXXXXXXXXXXX
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx




// DOCUMENT READY FUNCTIONS
$(document).ready(function() {

   switch ("simbo") { 
        case 'TimelessHotel': 

            break; //end case 

        case 'ParadiseInn': 
   
            break; //end case 

        case 'TetrisHotel': 
 
            break; //end case  

        case 'JamstoneInn': 
   
            break; //end case 
    }




(function($){
	
	$.fn.stacks_in_62_page0twitterfeed = function(username, options) {	
	
		// Set pluign defaults
		var defaults = {
			limit: 5,
			tweeticon: true,
			retweets: true,
			replies: true,
			ssl: false
		};  
		var options = $.extend(defaults, options); 
		
		// Functions
		return this.each(function(i, e) {
			var $e = $(e);
			var s = '';
			
			// Add feed class to user div
			if (!$e.hasClass('stacks_in_62_page0twitterFeed')) $e.addClass('stacks_in_62_page0twitterFeed');
			
			// Check for valid user name
			if (username == null) return false;

			// Check limit does not exceed max
			if (options.limit > 200) options.limit = 200;

			// Check for SSL protocol
			if (options.ssl) s = 's';

			// Reverse replies option
			if (options.replies == true) { options.replies = false; } else { options.replies = true; }

			// Define Twitter feed request
			var url = 'http'+ s +'://api.twitter.com/1/statuses/user_timeline.json?include_rts='+ options.retweets +'&exclude_replies='+ options.replies +'&screen_name='+ username +'&count='+ options.limit;
			var params = {};

			params.count = options.limit;

			// Send request
			jQuery.ajax({
				url: url,
				data: params,
				dataType: 'jsonp',
				success: function (o) {
					_callback(e, o, options);
				}
			});
				
		});
	};
	
	// Callback function to create HTML result
	var _callback = function(e, feeds, options) {
		if (!feeds) {
			return false;
		}
		var html = '';	
		

		// Add body
		html += '<ul>';
		
		// Add feeds
		for (var i=0; i<feeds.length; i++) {
			
			// Get individual feed
			if (feeds[i].retweeted_status) {
				var tweet= feeds[i].retweeted_status;
			} else {
				var tweet= feeds[i];
			}
			var link = '<a href="http://twitter.com/' + tweet.user.screen_name + '/" title="Visit '+ tweet.user.name +' on Twitter">';

			// Add feed row
			html += '<li class="stacks_in_62_page0twitterRow"><div class="stacks_in_62_page0rowinner">';

			// Add user icon if required
			if ("show" == "show") {
				var icon = tweet.user.profile_image_url;

				html += link + '<img src="'+ icon +'" alt="'+ name +'" /></a>';
			}
			
			if ("show" == "custom") {
				html += link + '<img src="files/testimagecontrol_62.png" alt="'+ name +'" /></a>';
			}
		
			
			// Add lapsed time if required
			if ("top" == "top") {
				var lapsedTime = getLapsedTime(tweet.created_at);
				html += '<div class="stacks_in_62_page0tweetTime">'+ lapsedTime +'</div>'
			}
			
			
			html += '<div class="stacks_in_62_page0bodycontainer">';
			
			

			// Add user if required
				var name = tweet.user.name;
				if ("username" == "username") {
				html += '<div class="stacks_in_62_page0tweetName">'+ link + name +'</a></div>'
				}else if("username" == "custom"){
				html += '<div class="stacks_in_62_page0tweetName">Recently Tweeted</div>'
				}else{
				html += ""
				}
			
			
			// Get tweet text and add links (by Yusuke Horie)
			var text = tweet.text
				.replace(/(https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/, function (u) {
					var shortUrl = (u.length > 30) ? u.substr(0, 30) + '…': u;
					return '<a href="' + u + '" title="Click to view this link">' + shortUrl + '</a>';
				})
				.replace(/@([a-zA-Z0-9_]+)/g, '@<a href="http://twitter.com/$1" title="Click to view $1 on Twitter">$1</a>')
				.replace(/(?:^|\s)#([^\s\.\+:!]+)/g, function (a, u) {
					return ' <a href="http://twitter.com/search?q=' + encodeURIComponent(u) + '" title="Click to view this on Twitter">#' + u + '</a>';
			});
			html += '<div class="stacks_in_62_page0tweetmessage">'+ text+'</div>'
			html += '</div>';
			
			// Add lapsed time if required
			if ("top" == "bottom") {
				var lapsedTime = getLapsedTime(tweet.created_at);
				html += '<div class="stacks_in_62_page0tweetTime">'+ lapsedTime +'</div>'
			}
			
			
			html += '<div style="clear:both;"></div></div></li>';
						
		}
		
		html += '</ul>' +
			'</div>'
		
		$(e).html(html);
	};

	function getLapsedTime(strDate) {
		
		// Reformat Twitter date so that IE can convert
		strDate = Date.parse(strDate.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i, '$1,$2$4$3'));

		// Define current time and format tweet date
		var todayDate = new Date();	
		var tweetDate = new Date(strDate)

		// Get lasped time in seconds
		var lapsedTime = Math.round((todayDate.getTime() - tweetDate.getTime())/1000)

		// Return lasped time in seconds, minutes, hours, days and weeks
		if (lapsedTime < 60) {
			return 'JP';
		} else if (lapsedTime < (60*60)) {
			return (Math.round(lapsedTime / 60)) + 'm';
		} else if (lapsedTime < (24*60*60)) {
			return (Math.round(lapsedTime / 3600)) + 'h';  //removed -1 from hour not so sure yet??
		} else if (lapsedTime < (7*24*60*60)) {
			return (Math.round(lapsedTime / 86400)) + 'd';  //removed -1 from day not so sure yet??
		} else {
			return (Math.round(lapsedTime / 604800)) + 'w'; //removed -1 from week not so sure yet??
		}
	};
})(jQuery);



$(document).ready(function () {

	$('.stacks_in_62_page0tweets').stacks_in_62_page0twitterfeed('mathematicatip', {
		limit: 5
	});
	
	var itsIEnine = navigator.userAgent.match(/MSIE 9/i) != null;

	if(itsIEnine){
	$(".stacks_in_62_page0rowinner").css({
    "background" : "#CCCCCC"
    });
	}
	
});


});





// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// END DOOBOX TWEETS STACK XXXXXXXXXXXXXXXXXXXX
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	return stack;
})(stacks.stacks_in_62_page0);


// Javascript for stacks_in_54_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_54_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_54_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

//-- RSS JS Stack v1.5 by Joe Workman --//

//---------------------------
// Start Common RSS Code
//---------------------------
formatString = function(str) {
	str = str.replace(/<[^>]+>/ig,'');
	str=' '+str;
	return $.trim(str);
}

enrichString = function(str) {
	str = str.replace(/((ftp|https?):\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?)/gm,'<a href="$1" target="_blank">$1</a>');
	str = str.replace(/([^\w])\@([\w\-]+)/gm,'$1@<a href="http://twitter.com/$2" target="_blank">$2</a>');
	str = str.replace(/([^\w])\#([\w\-]+)/gm,'$1<a href="http://twitter.com/search?q=%23$2" target="_blank">#$2</a>');
	return $.trim(str);
}

parse_date = function(str) {
    if (str.match(/^\d+\-\d+\-\d+T/)) {
        str = str.replace(/T.+$/,'');
    }
	var d = new Date(str);
	var m = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'];
	if (d.getUTCDate()) {
		return d.getUTCDate() + ' ' + m[d.getUTCMonth()] + ' ' + d.getFullYear();
    }
    return str;
};

find_link = function(obj) {
    var default_string = '#';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.origLink == 'string') {
        return obj.origLink;
    }
    else if ($.isArray(obj.link)) {
        var mylink = obj.link[0].href;
        $.each(obj.link,function(index, value){
            if (value.rel === 'alternate') {
                mylink = value.href;
            }
		})
        return mylink;
    }
    else if (typeof obj.link == 'object') {
        return obj.link.href;
    }
    else if (typeof obj.link == 'string') {
        return obj.link;
    }
    else if (typeof obj.enclosure == 'object' && typeof obj.enclosure.url == 'string') {
        return obj.enclosure.url;
    }
    return default_string;
};

find_title = function(obj) {
    var default_string = 'No Items in RSS Feed';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.title.content == 'string') {
        return formatString(obj.title.content);
    }
    else if (typeof obj.title == 'string') {
        return formatString(obj.title);
    }
    return default_string;
};

find_date = function(obj) {
    var default_string = 'Date Unknown';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.pubDate == 'string') {
		return parse_date(obj.pubDate);
    }
    else if (typeof obj.date == 'string') {
		return parse_date(obj.date);
    }
    else if (typeof obj.published == 'string') {
		return parse_date(obj.published);
    }
    else if (typeof obj.updated == 'string') {
		return parse_date(obj.updated);
    }
    return default_string;
};

find_descr = function(obj) {
    var default_string = 'RSS Feed Invalid. No Description Found.';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.description == 'string') {
		return formatString(obj.description);
    }
    else if (typeof obj.encoded == 'string') {
		return formatString(obj.encoded);
    }
    else if (typeof obj.content == 'object' && typeof obj.content.content == 'string') {
		return formatString(obj.content.content);
    }
    return default_string;
};

find_author = function(obj) {
    var default_string = 'Unknown Author';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.creator == 'string') {
		return obj.creator;
    }
    else if ($.isArray(obj.author)) {
        return obj.author[0];
    }
    else if (typeof obj.author == 'object' && typeof obj.author.email == 'string') {
		return obj.author.email;
    }
    else if (typeof obj.author == 'string') {
		return obj.author;
    }
    return default_string;
};

$(document).ready(function() {
	/* Forming the query: */
	var feed = "feed://www.mathgeek.com/MathGeekBlog/files/blogRSS.php";
	feed = feed.replace(/feed:\/\//,'http://'); // Replace feed:// with http://
	var query = 'select * from feed where url="' + feed + '" LIMIT 5';

	/* Forming the URL to YQL: */
	var url = "http://query.yahooapis.com/v1/public/yql?q="+encodeURIComponent(query)+"&format=json&callback=?";

	$.getJSON(url,function(data){
		if (data.query == null || data.query == undefined || data.query.results == null || data.query.results == undefined) {
			// Invalid or Empty RSS Feed - Add Blank/Default Entries
			add_feed_item();
	 	}
	 	else if ($.isArray(data.query.results.item || data.query.results.entry) ) {  //item exists in RSS and entry in ATOM feeds
			$.each(data.query.results.item || data.query.results.entry,function(){
	       		//Normal RSS Feed
	       		add_feed_item(this);
			})
		}
		else {
		    // RSS Feed with only one item in it
			add_feed_item(data.query.results.item || data.query.results.entry || null);
		}
		post_process_feed(this);
	});
});
//---------------------------
// End Common RSS Code
//---------------------------

find_content = function(obj) {
    var default_string = 'RSS Feed Invalid. No Content Found.';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.encoded == 'string') {
		return obj.encoded;
    }
    else if (typeof obj.content == 'object' && typeof obj.content.content == 'string') {
		return obj.content.content;
    }
    else if (typeof obj.description == 'string') {
		return obj.description;
    }
    return default_string;
};
function add_feed_item(obj) {
	$('#rss-container-stacks_in_54_page0').append(
		'<div class="rss-fc-feed">' + 
			'<h3 class="rss-fc-title">'+ find_title(obj) + '</h3>' +
		  	'<p class="rss-fc-date">'+ find_date(obj) +  '</p>' +
		  	'<div class="rss-fc-content">' + find_content(obj) + '</div>' +
		'</div>'
	);
	return;    	        
};
function post_process_feed(obj) {
	return;    	        
};
//-- End RSS JS Stack --//

	return stack;
})(stacks.stacks_in_54_page0);



