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

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

// A closure is defined and assined to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for refering
// to this object from elsewhere.
stacks.stacks_in_329_page3 = (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 rptx = "0";
var rpty = "0";
var axisrepeat = "repeat";
var positionlmr = "2";
var positiontmb = "2";




if(rptx == 0 && rpty == 0){
    axisrepeat = "no-repeat";
}
else if(rptx == 0 && rpty == 1){
    axisrepeat = "repeat-y";
}
else if(rptx == 1 && rpty == 0){
    axisrepeat = "repeat-x";
}
else{
    axisrepeat = "repeat";
}



                switch (positiontmb) {
                	case "1":
                        positiontmb = "top";
                        break;
                    case "2":
                        positiontmb = "center";
                        break;
                    case "3":
                        positiontmb = "bottom";
                        break;  
                    default:
                        positiontmb = "center";
                };
                
                switch (positionlmr) {
                	case "1":
                        positionlmr = "left";
                        break;
                    case "2":
                        positionlmr = "center";
                        break;
                    case "3":
                        positionlmr = "right";
                        break;  
                    default:
                        positionlmr = "center";
                };




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

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



    $("#stacks_in_329_page3 .stacks_in_329_page3bgimagestack").css({
    "background":"url("+bgimage+") " + axisrepeat + " " + bgcolor,
    "background-position": positionlmr + " " + positiontmb,
    "-webkit-border-radius" : "8px",
    "-moz-border-radius" : "8px",
    "border-radius" : "8px",
    "behavior":"url(" + yourfolder + "/files/RBPIE.htc)"
    });

          
});

	return stack;
})(stacks.stacks_in_329_page3);


// Javascript for stacks_in_332_page3
// ---------------------------------------------------------------------

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

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

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/* Copyright 2010-2011 NimbleHost. All rights reserved. */

var $hijax = jQuery.noConflict(); 

function activateHijax(fileExtension, fileLink) {
	/* Global default ajax settings for Hijax. */
	var hijaxErrorCode = "There was a problem loading the content. Please try again, or contact the webmaster.<br/><p><strong>Error details:</strong> <span class='hijaxErrorDetails'>";
	$hijax.ajaxSetup({
		url: fileLink,
		beforeSend: function() {
			$hijax('#nimblehost_hijaxContentDetails_stacks_in_332_page3').empty();
			},
		timeout: 30000,
		error: function(xhr, error) {
			var generalError;
			if ( xhr.statusText == '' ) { generalError = "Specific details are not available. This usually means: <ul><li>The file is missing, <strong>or</strong></li><li>The file is located on a different domain/sub-domain from the website you are viewing - for security reasons, such files cannot be displayed via ajax.</li></ul>"; } else { generalError = ''; }
			if ( error == "timeout" ) { generalError = "The request to load the content has timed out. This could mean the server is not responding, or that the file size is too large to be loaded in the allotted time." }
			$hijax("#nimblehost_hijaxContentDetails_stacks_in_332_page3").html(hijaxErrorCode + xhr.statusText + " " + generalError + "</span></p>");
			}
	});
	switch(fileExtension) {
		case 'jpg':
		case 'jpeg':
		case 'jif':
		case 'jfif':
		case 'png':
		case 'gif':
		case 'psd':
		case 'tif':
		case 'tiff':
		case 'bmp':
		case 'svg':
			var imageEmbed = '<div class="hijaxMedia"><img class="hijaxImage" src="' + fileLink + '"/></div>';
			$hijax.ajax({
				url: '/',
				success: function() {
						$hijax('#nimblehost_hijaxContentDetails_stacks_in_332_page3').html(imageEmbed);
					}
			});
		break;
		case 'txt':
		case 'php':
		case 'rb':
		case 'py':
		case 'pl':
		case 'htm':
		case 'html':
		case 'shtml':
		case 'phtml':
		case 'xht':
		case 'xhtml':
		case 'stm':
		case 'xml':
		case 'jsp':
		case 'asp':
		case 'aspx':
		case 'cfm':
		case 'cgi':
			$hijax.ajax({
				success: function(data) {
						$hijax('#nimblehost_hijaxContentDetails_stacks_in_332_page3').html(data);
					}
				
			});
		break;
		case 'mp3':
		case 'aac':
		case 'aif':
		case 'aiff':
		case 'mid':
		case 'midi':
		case 'wav':
		case 'wma':
		case 'mpga':
		case 'au':
		case 'oga':
			var html5AudioEmbed = '<div class="hijaxMedia"><div id="hijaxMediaFlashFallback_stacks_in_332_page3"><audio src="' + fileLink + '" controls></audio></div></div>';
			$hijax.ajax({
				success: function() {
						var a = document.createElement("audio");
						if ( !a.play ) {
							$hijax('#nimblehost_hijaxContentDetails_stacks_in_332_page3').text("Your browser does not support HTML5 audio/video. Please go back and download the media file directly.");
						} else {
							$hijax('#nimblehost_hijaxContentDetails_stacks_in_332_page3').html(html5AudioEmbed);
						}
					}
			});
		break;
		case 'qt':
		case 'mpg':
		case 'mpeg':
		case 'mov':
		case 'mp4':
		case 'm4v':
		case 'avi':
		case 'wmv':
		case 'ogg':
		case 'webm':
		case 'ogv':
			var html5VideoEmbed = '<div class="hijaxMedia"><div id="hijaxMediaFlashFallback_stacks_in_332_page3"><video src="' + fileLink + '" controls></video></div></div>';
			$hijax.ajax({
				success: function() {
						var v = document.createElement("video");
						if ( !v.play ) {
							$hijax('#nimblehost_hijaxContentDetails_stacks_in_332_page3').text("Your browser does not support HTML5 audio/video. Please go back and download the media file directly.");
						} else {
							$hijax('#nimblehost_hijaxContentDetails_stacks_in_332_page3').html(html5VideoEmbed);
						}
					}
			});
		break;
		default:
			$hijax('#nimblehost_hijaxContentDetails_stacks_in_332_page3').load($hijax(this).attr('href'));
	}
}

$hijax(document).ready(function() {
	/* Create/remove loading animation and some written feedback for visitors to see during the ajax request, as they're waiting for content to load. */
	$hijax('#nimblehost_hijaxContentDetails_stacks_in_332_page3').ajaxStart(function() {
		$hijax("<div id='hijaxInProgress'><div id='hijaxLoadingFeedback'><p class='loadingMessage1'>Please wait as the content is loaded.</p><p class='loadingMessage2'>Thanks for your patience.</p></div></div>").insertBefore('#stacks_in_332_page3');
		$hijax('#hijaxInProgress').animate({height: '120px'}, 400, function() {
			$hijax('#hijaxInProgress .loadingMessage1').delay(3500).fadeTo(1000, 1, function(){
				$hijax('#hijaxInProgress .loadingMessage2').delay(4500).slideDown().fadeIn(1000);	
			});
		});
	}).ajaxStop(function() {
		$hijax('#hijaxInProgress').fadeTo(300, 0, function(){
			$hijax(this).slideUp(300, function(){
				$hijax(this).remove();
				$hijax('.nimblehost_viewHijaxContent_stacks_in_332_page3').slideDown(500, function(){
					$hijax(this).fadeTo(300, 1);
					/* Resize images that are too large for the area they are being displayed in. */
					if ( $hijax('#nimblehost_hijaxContentDetails_stacks_in_332_page3').width() < $hijax('.hijaxMedia img.hijaxImage').width() ) {
						$hijax('.hijaxMedia img.hijaxImage').delay(400).animate({width: '100%', filter: 'progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)'}, 500);
					} else {
						/* Check for png files in IE, to fix the jagged black edges that appear when such images with transparency are loaded via ajax. */
						if ($hijax('.hijaxMedia img.hijaxImage').is(':visible')) {
							var fileExtension = $hijax('.hijaxMedia img.hijaxImage').attr('src').split('.').pop().toLowerCase();
							if ( !($hijax.support.opacity) && (fileExtension == 'png') ) {
								$hijax('.hijaxMedia img.hijaxImage').css({filter: 'progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)'});
							}
						}
					}
				});
			});
		});
	});

	$hijax('a.hijax').live('click', function(e) {
		var fileLink = $hijax(this).attr('href');
		var fileExtension = $hijax(this).attr('href').split('.').pop().toLowerCase();

		if ( fileExtension == 'pdf' || fileExtension == 'rtf' ) { 
			return;
		} else {
			/* Check if other Hijax content is already being displayed. */
			if ( $hijax('.nimblehost_viewHijaxContent_stacks_in_332_page3').is(':visible') ) {
				$hijax('.nimblehost_viewHijaxContent_stacks_in_332_page3').fadeTo(300, 0).slideUp(500, function(){
					activateHijax(fileExtension, fileLink);
				});
			} else {
				$hijax('.nimblehost_hijaxContent_stacks_in_332_page3').fadeTo(300, 0).slideUp(500);
				activateHijax(fileExtension, fileLink);
				$hijax("<p><a class='hideHijaxedContent' href='#'>Back</a></p>").insertBefore('.nimblehost_viewHijaxContent_stacks_in_332_page3');
				$hijax('a.hideHijaxedContent').fadeIn(800);
			}
			e.preventDefault();
		}
	});
	
	$hijax('a.hideHijaxedContent').live('click', function(e){
		if ( $hijax('#hijaxInProgress').is(':visible') ){
			$hijax('#hijaxInProgress').fadeTo(300, 0, function(){
				$hijax(this).slideUp(300, function(){
					$hijax(this).remove();
				});
			});
		}
		$hijax('.nimblehost_viewHijaxContent_stacks_in_332_page3').fadeTo(300, 0, function(){ $hijax('a.hideHijaxedContent').parent().fadeOut().remove(); }).slideUp(500);
		$hijax('.nimblehost_hijaxContent_stacks_in_332_page3').slideDown(800).fadeTo('normal', 1);
		e.preventDefault();
	});
});
	return stack;
})(stacks.stacks_in_332_page3);



