
// '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_10_page2
// ---------------------------------------------------------------------

// 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_10_page2 = {};

// 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_10_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
// Background Stack by http://www.doobox.co.uk
// Copyright@2010 Mr JG Simpson, trading as Doobox.
// all rights reserved.


$(document).ready(function() {
jQuery.url = function()
{
	var segments = {};
	
	var parsed = {};
	
	/**
    * Options object. Only the URI and strictMode values can be changed via the setters below.
    */
  	var options = {
	
		url : window.location, // default URI is the page in which the script is running
		
		strictMode: false, // 'loose' parsing by default
	
		key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], // keys available to query 
		
		q: {
			name: "queryKey",
			parser: /(?:^|&)([^&=]*)=?([^&]*)/g
		},
		
		parser: {
			strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,  //less intuitive, more accurate to the specs
			loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs
		}
		
	};
	
    /**
     * Deals with the parsing of the URI according to the regex above.
 	 * Written by Steven Levithan - see credits at top.
     */		
	var parseUri = function()
	{
		str = decodeURI( options.url );
		
		var m = options.parser[ options.strictMode ? "strict" : "loose" ].exec( str );
		var uri = {};
		var i = 14;

		while ( i-- ) {
			uri[ options.key[i] ] = m[i] || "";
		}

		uri[ options.q.name ] = {};
		uri[ options.key[12] ].replace( options.q.parser, function ( $0, $1, $2 ) {
			if ($1) {
				uri[options.q.name][$1] = $2;
			}
		});

		return uri;
	};

    /**
     * Returns the value of the passed in key from the parsed URI.
  	 * 
	 * @param string key The key whose value is required
     */		
	var key = function( key )
	{
		if ( ! parsed.length )
		{
			setUp(); // if the URI has not been parsed yet then do this first...	
		} 
		if ( key == "base" )
		{
			if ( parsed.port !== null && parsed.port !== "" )
			{
				return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/";	
			}
			else
			{
				return parsed.protocol+"://"+parsed.host+"/";
			}
		}
	
		return ( parsed[key] === "" ) ? null : parsed[key];
	};
	
	/**
     * Returns the value of the required query string parameter.
  	 * 
	 * @param string item The parameter whose value is required
     */		
	var param = function( item )
	{
		if ( ! parsed.length )
		{
			setUp(); // if the URI has not been parsed yet then do this first...	
		}
		return ( parsed.queryKey[item] === null ) ? null : parsed.queryKey[item];
	};

    /**
     * 'Constructor' (not really!) function.
     *  Called whenever the URI changes to kick off re-parsing of the URI and splitting it up into segments. 
     */	
	var setUp = function()
	{
		parsed = parseUri();
		
		getSegments();	
	};
	
    /**
     * Splits up the body of the URI into segments (i.e. sections delimited by '/')
     */
	var getSegments = function()
	{
		var p = parsed.path;
		segments = []; // clear out segments array
		segments = parsed.path.length == 1 ? {} : ( p.charAt( p.length - 1 ) == "/" ? p.substring( 1, p.length - 1 ) : path = p.substring( 1 ) ).split("/");
	};
	
	return {
		
	    /**
	     * Sets the parsing mode - either strict or loose. Set to loose by default.
	     *
	     * @param string mode The mode to set the parser to. Anything apart from a value of 'strict' will set it to loose!
	     */
		setMode : function( mode )
		{
			strictMode = mode == "strict" ? true : false;
			return this;
		},
		
		/**
	     * Sets URI to parse if you don't want to to parse the current page's URI.
		 * Calling the function with no value for newUri resets it to the current page's URI.
	     *
	     * @param string newUri The URI to parse.
	     */		
		setUrl : function( newUri )
		{
			options.url = newUri === undefined ? window.location : newUri;
			setUp();
			return this;
		},		
		
		/**
	     * Returns the value of the specified URI segment. Segments are numbered from 1 to the number of segments.
		 * For example the URI http://test.com/about/company/ segment(1) would return 'about'.
		 *
		 * If no integer is passed into the function it returns the number of segments in the URI.
	     *
	     * @param int pos The position of the segment to return. Can be empty.
	     */	
		segment : function( pos )
		{
			if ( ! parsed.length )
			{
				setUp(); // if the URI has not been parsed yet then do this first...	
			} 
			if ( pos === undefined )
			{
				return segments.length;
			}
			return ( segments[pos] === "" || segments[pos] === undefined ) ? null : segments[pos];
		},
		
		attr : key, // provides public access to private 'key' function - see above
		
		param : param // provides public access to private 'param' function - see above
		
	};
	
}();


var yourfolder = jQuery.url.attr("directory");
if(yourfolder == "/"){yourfolder = ""};




var rpt = "2";
var posy = "50";
var posx = "50";

if (rpt == 1) {var userpt = "repeat";}
if (rpt == 2) {var userpt = "no-repeat";}


var bgimage = $("#stacks_in_10_page2 .bgimage img").attr("src");

var bgcolor = "";
if (bgcolor == "") {var bgcolor = "#F3F3F3";}
else {
	var bgcolor = "";
}



    $("#stacks_in_10_page2 .bgimagestack").css({
    "background":"url(" + bgimage + ") " + userpt + " " + bgcolor,
    "background-position": posx + "%" + " " + posy + "%",
    "-webkit-border-radius" : "8px",
    "-moz-border-radius" : "8px",
    "border-radius" : "8px",
    "behavior":"url(" + yourfolder + "/files/PIE.htc)"
    });

          
});
	return stack;
})(stacks.stacks_in_10_page2);


// Javascript for stacks_in_13_page2
// ---------------------------------------------------------------------

// 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_13_page2 = {};

// 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_13_page2 = (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.2 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)) {
        return obj.link[0].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 = "http://yoga-ireland.com/Iyengar/page0/files/blogRSS.php";
	feed = feed.replace(/feed:\/\//,'http://'); // Replace feed:// with http://
	var query = 'select * from feed where url="' + feed + '" LIMIT 3';

	/* 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_13_page2",
		tickerRate: 80,
		startDelay: 100,
		loopDelay: 3000,
		placeHolder1: " |",
		placeHolder2: "_",
		controls: false,
		ownControls: false,
		stopOnHover: true,	  
		linkClass: "tiptip",
		linkTarget: "_self"
    };

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

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


	return stack;
})(stacks.stacks_in_13_page2);



