
	





	
		
			
			






var debug = function(value) {
	// MAKE SURE CONSOLE EXISTS AND WRITE VALUE
	window.console && console.log("[KA_SSO] " + value);
}

var kickAppsUrl;	
var queryString = window.location.search.substr(1).split("&");
	debug("Query: " + queryString);
	debug(queryString.length);



for( i = 0; i < queryString.length; i++ ) {

	if( queryString[i].indexOf("redirectUrl") != -1 ) {
		var destination = queryString[i].replace("redirectUrl","destination");
		window.location = "/content/system/modules/com.dispatch.registration/pages/login.jsp?sendback=/system/shared/modules/kickApps-SSO.jsp&"+destination;
	}
	if ( queryString[i].indexOf("destination") != -1 ) {
		kickAppsUrl = queryString[i].split("=");
			kickAppsUrl = decodeURIComponent(kickAppsUrl[1]);
		createCookie("KA_SSO_Redirect", kickAppsUrl);
			debug("Cookie Created");
			debug("Cookie Content: " + kickAppsUrl);
	}		
}


		
			
			/*
* jQuery Templates Plugin 1.0.0pre
* http://github.com/jquery/jquery-tmpl
* Requires jQuery 1.4.2
*
* Copyright Software Freedom Conservancy, Inc.
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
(function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},i=0,c=0,l=[];function g(g,d,h,e){var c={data:e||(e===0||e===false)?e:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};g&&a.extend(c,g,{nodes:[],parent:d});if(h){c.tmpl=h;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++i;(l.length?f:b)[i]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h<m;h++){c=h;k=(h>0?this.clone(true):this).get();a(i[h])[d](k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,m,k){if(d[0]&&a.isArray(d[0])){var g=a.makeArray(arguments),h=d[0],j=h.length,i=0,f;while(i<j&&!(f=a.data(h[i++],"tmplItem")));if(f&&c)g[2]=function(b){a.tmpl.afterManip(this,b,k)};r.apply(this,g)}else r.apply(this,arguments);c=0;!e&&a.tmpl.complete(b);return this}});a.extend({tmpl:function(d,h,e,c){var i,k=!c;if(k){c=p;d=a.template[d]||a.template(null,d);f={}}else if(!d){d=c.tmpl;b[c.key]=c;c.nodes=[];c.wrapped&&n(c,c.wrapped);return a(j(c,null,c.tmpl(a,c)))}if(!d)return[];if(typeof h==="function")h=h.call(c||{});e&&e.wrapped&&n(e,e.wrapped);i=a.isArray(h)?a.map(h,function(a){return a?g(e,c,d,a):null}):[g(e,c,d,h)];return k?a(j(c,null,i)):i},tmplItem:function(b){var c;if(b instanceof a)b=b[0];while(b&&b.nodeType===1&&!(c=a.data(b,"tmplItem"))&&(b=b.parentNode));return c||p},template:function(c,b){if(b){if(typeof b==="string")b=o(b);else if(b instanceof a)b=b[0]||{};if(b.nodeType)b=a.data(b,"tmpl")||a.data(b,"tmpl",o(b.innerHTML));return typeof c==="string"?(a.template[c]=b):b}return c?typeof c!=="string"?a.template(null,c):a.template[c]||a.template(null,q.test(c)?c:a(c)):null},encode:function(a){return(""+a).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function j(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:j(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=k(c).concat(b);if(d)b=b.concat(k(d))});return b?b:k(c)}function k(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,k,g,b,c,d){var j=a.tmpl.tag[k],i,e,f;if(!j)throw"Unknown template tag: "+k;i=j._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=h(b);d=d?","+h(d)+")":c?")":"";e=c?b.indexOf(".")>-1?b+h(c):"("+b+").call($item"+d:b;f=c?e:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else f=e=i.$1||"null";g=h(g);return"');"+j[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(f).split("$1").join(e).split("$2").join(g||i.$2||"")+"__.push('"})+"');}return __;")}function n(c,b){c._wrap=j(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function h(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,h;for(e=0,p=o.length;e<p;e++){if((k=o[e]).nodeType!==1)continue;j=k.getElementsByTagName("*");for(h=j.length-1;h>=0;h--)m(j[h]);m(k)}function m(j){var p,h=j,k,e,m;if(m=j.getAttribute(d)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(p=h.getAttribute(d)));if(p!==m){h=h.parentNode?h.nodeType===11?0:h.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[h]||f[h]);e.key=++i;b[i]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;h=a.data(j.parentNode,"tmplItem");h=h?h.key:0}if(e){k=e;while(k&&k.key!=h){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}})(jQuery);
		
			
			



var dPoll = {
	 // Sends messages to console when true

	// Sends messages to console
	"debug" : function(str) {
		// if (window.console && console.log) { console.log(str); }
	},


	// Setup poll, stores in data() for cases of multiple polls per page
	"ini" : function(pollId, pollUri, multiVote, custom) {
		this.debug("--- dPoll:ini");

		// Create settings object from arguments
		var settings = {
			pollCssId : "#"+pollId,
			pollUri   : pollUri,
			multiVote : multiVote,
			pollId    : pollId
		}
		
		// Add in any custom settings
		$.extend(settings, custom);

		// Store settings unique to poll ID (unique per page load)	
		$("body").data(pollId, settings);


		// Check cookie for poll, unique to poll URI so it follows around the site
		var historyCookie = readCookie(pollUri);
		if (historyCookie && !multiVote) {
			this.debug("cookie for "+pollUri+" exists, just display results");
			this.getResults(settings);
		} else {
			// Display the form if not displaying graphcs on load. This avoid DOM flicker.
			$(settings.pollCssId+" .poll-options").show(); 
		}	
	},
	

	
	// Get results for selected poll
	"getResults": function(settings) {
		this.debug("--- getResults");

		// Call REST to get results for poll
		$.ajax({
			url: "/content/system/modules/com.dispatch.polling/rest/results?poll="+settings.pollUri,
			dataType: "json",
	  		success: function(data){
	  			dPoll.handleResults(data,settings.pollId);
			}
		});	
	},	
	
	
	// Handle poll vote submit
	"submitPoll": function(submit) {
		this.debug("--- submitPoll");
		
		var pollId    = $(submit).parents("form").attr("id");
		var settings  = $("body").data(pollId);
		var voteValue = $(settings.pollCssId+" .poll-options input:checked").val();
	
		this.debug(settings.pollCssId+" .poll-options input:checked");
		this.debug($(settings.pollCssId+" .poll-options input:checked"));
		this.debug("voting for "+voteValue);
	
		if (!settings.multiVote) {
			this.debug("setting cookie as "+settings.pollUri);
			createCookie(settings.pollUri,"voted",1);
		}
		
		
		$.ajax({
			url: "/content/system/modules/com.dispatch.polling/rest/vote?poll="+settings.pollUri+"&choice="+voteValue,
			dataType: "json",
	  		success: function(data){
	  			dPoll.handleResults(data,pollId);
			}
		});
		
	},
	
	
	// Success function for REST calls. Displays results or handles custom settings.
	"handleResults" : function(json, pollId) {
		this.debug("--- handleResults");
		
		var settings = $("body").data(pollId); // Get settings
		
		if (!settings.hideResults) {
    			this.displayResults(json, settings);
    		} else {
    			this.hiddenResults(settings);
    		}	
	},	
	
	
	// If custom hide is set, don't display graphs and show defined message
	"hiddenResults" : function(settings) {
		this.debug("--- hideResults");
		
		$(settings.pollCssId).find(".poll-detail").html('<div class="poll-message">'+settings.hideResults+'</div>');
	},
	
	
	// Display results, uses JSON load from submitPoll() or getResults()
	"displayResults" : function(json, settings) {
		this.debug("--- displayResults");
		
		var pollElement = $(settings.pollCssId);
			
		if (json["result"] == "error") {
			this.debug("ERROR");
			
			pollElement.find(".poll-detail").html('<div class="poll-error">'+json["message"]+'</div>');
		} else {
			this.debug("Displaying results graphs");
			
			
			
			// Go through data and round percentage. Look at custom settings for rounding rules.
			if (!settings.roundToDecimal) {	settings.roundToDecimal = 0; }

			$.each(json["choices"], function(k, pollData) { 
				//alert(index + ': ' + value); 
				pollData.percent = Math.round(pollData.percent*Math.pow(10,settings.roundToDecimal))/Math.pow(10,settings.roundToDecimal);
				  
				json["choices"][k] = pollData;  
			});
			
			this.debug(json);

			
			// Build template, apply template to poll data			
			var resultTmpl = '<li><div class="graph-container"><div class="graph"></div></div><div class="option-name">{{= text}}</div><div class="option-votes">{{= percent}}%</div></li>';
			$.template("pollResultRow", resultTmpl);		
		
			pollElement.find(".poll-detail").html('<ul class="poll-results"></ul>');
		
			$.tmpl("pollResultRow", json["choices"]).appendTo(pollElement.find("ul")); // Loops through JSON and out to template
			
			// If there is a 'withResults' string, append it to the container div here (inside of poll-message) MP 20111031
			if (settings.withResults) {
				$(settings.pollCssId).find(".poll-detail").append('<div class="poll-message">'+settings.withResults+'</div>');
			}
			
			// Animates graphcs from left to right
			var rows = pollElement.find(".graph");
			for (a=0; a < rows.length; a++) {
				var i_percent = json["choices"][a]["percent"];
				if (i_percent >= 100) { i_percent = 99; }
				
				var graph      = $(rows[a]);
				var graphWidth = i_percent+"%";
				
				graph.animate({paddingLeft:graphWidth},"slow"); 
			}
		}			
	}
		
	
} // END class
		
			
			











function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
		
			
			


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

(function( $ ){

	var methods = {
	
		// featureRotator Basic Functionality --------------------------------------------------------------
		init : function( options ) {
			
                        
			// Setting My Variables --------------------------------------------------------------------
			var settings = {
                            
		        }
			// -------------------------------------------------------------- END - Setting My Variables
			
			
			// Updating My Variables -------------------------------------------------------------------
			if ( options ) { 
                		$.extend( settings, options );
            		}
			
			// ------------------------------------------------------------- END - Updating My Variables
			
			
			// Each ------------------------------------------------------------------------------------
    			return this.each(function() {
                            
    				var $this = $(this);
                                
				// Fixes z-index woes in IE :)
				if ( $.browser.msie ) {
				var embedTag;
					$this.each(function(i) {
					embedTag = $(this).attr("outerHTML");
						if ((embedTag != null) && (embedTag.length > 0)) {
							embedTag = embedTag.replace(/embed /gi, "embed wmode=\"opaque\" ");
							$(this).attr("outerHTML", embedTag);
						}
					});
				}
				
				else { $this.prepend('<param name="wmode" value="transparent" />'); }
                                
    			});
    			
    			// ------------------------------------------------------------------------------ END - Each                
		}	// ------------------------------------------------------------------------------ END - init

                   
        };		// --------------------------------------------------------------------------- END - methods

	$.fn.fixFlash = function( method ) {

		if ( methods[method] ) {
			return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
		} else if ( typeof method === 'object' || ! method ) {
 			return methods.init.apply( this, arguments );
		} else {
			$.error( 'Method ' +  method + ' does not exist on jQuery.fixFlash' );
		}    
  
	};

})( jQuery );
		
			
			


(function( $ ){

	var methods = {	
    
		// dFav Basic Functionality --------------------------------------------------------------------
		init : function( options ) {
            
			// Setting My Variables ----------------------------------------------------------------
			var settings = {
				parent : $(this),				// Unchanging, not a 'real' parameter
				item : 'li',					// What would you like to rotate? More often than not, this will be a LI
				nav : true,					// You want the navigation? Options: True, False, Custom
					navID : '',				// Nav ID. Used with custom Nav
					navPosition : 'before',			// Where you want your navigation? Options: Before, After
					navPrev : '',
					navNext : '',
					count : true,
					countContainer : '',
					currentCountContainer : '',
					totalCountContainer : '',
					playPause : false,
					playPauseID : '',
					creditsToggleID : '',
					creditsToggleTarget : '',
				transitionMove : 'group',			// How do you want items to move? Options: Group, Single
				transitionStyle : 'fade',			// Options: Slide, Fade
				transitionStart : 'auto',			// Options: Click, Auto
				transitionTime : 'fast',			// How quickly you want things to move about
				transitionDelay	: '2000'			// Only used with tStart of Auto. Sets how long we pause at each item.
			}	
			
			// ---------------------------------------------------------------------- END - Settings
			
			var n = 0;						// Counter Variable, NBD
			var itemsHeight = 0;					// Overall Height Variable
			
			// --------------------------------------------------------- END - Updating My Variables
			
			// Updating My Variables ---------------------------------------------------------------
			if ( options ) { 
				$.extend( settings, options );
			}
			// --------------------------------------------------------- END - Updating My Variables
			 
			// Init Operations ---------------------------------------------------------------------
			settings.navID = $(this).attr('id');
				
			if (settings.navID) {}
			
			// If we were not passed an ID'd object, get the class, and how many there are
			if (!settings.navID) { var selfClass = $(this).attr('class'); var selfLength = $('.' + selfClass).length; }
			// --------------------------------------------------------------- END - Init Operations
			
			// Functions ---------------------------------------------------------------------------
			
			// If our DOM object only has a class, add an ID
			assignID = function(pass) {
				
				if ( n < pass[2] ) {
					$('.' + pass[1]).eq(n).attr( 'id', pass[1] + '-' + (n+1) );
					settings.parent = $('#' + pass[1] + '-' + (n+1));
					n++;
				}
				
			}
			
			// Get all of the important information about the DOM object ---------------------------
			// Get, Create and save these variables for later --------------------------------------
			getData = function() {
			
				var parentID = settings.parent.attr('id');			// Get the ID of the parent DOM object
				var parentUL = settings.parent.find('ul');			// Find the UL inside of our DOM object, perhaps will be updated later with a supplied id of the UL
				var items = parentUL.find(settings.item);			// Find those pesky LI's
				var itemsCount = items.length;					// How many items are there?
				var itemsWidth = items.width();					// How wide are our items
				items.each(function(i) {					// Loop through items, looking for
					var testHeight = $(this).height();				// for the tallest
					if (testHeight > itemsHeight) {
						itemsHeight = testHeight;
					}    
			        });
				var itemsMargin = items.css('margin-right');			// What is the Right Margin
					itemsMargin = itemsMargin.split('px',1);		// Get rid of the measurement
					itemsMargin = parseInt(itemsMargin);			// Convert to an integer
					itemsWidth = itemsWidth + itemsMargin;			// Add to the width
				var itemsLength = items.length;					// How many items do we have?
				var parentWidth = parentUL.width();				// Width of the Parent Item, aka the DOM object
				var itemsOnScreen = Math.ceil( parentWidth / itemsWidth );	// Get Items on Screen
					// If Items on screen is equal to parent width, do some stuff
					if ( ( parentWidth == ( itemsOnScreen * itemsWidth ) ) && ( itemsOnScreen > 1) ) {
						itemsOnScreen--;				// Subtract from Items on Screent
						itemsWidth = ( Math.ceil( parentWidth / itemsOnScreen ) - ( itemsMargin / 2 ) );
						items.css({
							'width':itemsWidth + 'px',		// Set Item Width
							'margin-right':itemsMargin + 'px'	// Set Item Margin Right
						});
						itemsWidth = itemsWidth + itemsMargin;		// Update Item Width with new margin & width
					}
				var parentULWidth = itemsWidth * itemsCount;			// Get the width for the UL		
				var parentWrapID = parentID + '-wrap';				// Create the Wrap ID
				
				var itemsLeft = 0;
				var itemsRight = itemsCount - itemsOnScreen;
				var dItemsCount = itemsCount;
				var timer = 0;
				if ( settings.transitionMove == 'group' ) { dItemsCount = Math.ceil(itemsCount / itemsOnScreen); }
				
				// Navigational elements - Pretty self explanatory -----------------------------
				
				// If you are not using custom Nav, or you passed a classed DOM object
				if ( !settings.navID ) {
					settings.navID = parentID + '-slide-nav';
				}
				var prevID;
				if ( settings.navPrev ) { prevID = settings.navPrev; }
				if ( !settings.navPrev ) { prevID = parentID + '-slide-prev'; }
				var prevClass = 'prev-slide';
				var nextID;
				if ( settings.navNext ) { nextID = settings.navNext; }
				if ( !settings.navPrev ) { nextID = parentID + '-slide-next'; }
				var nextClass = 'next-slide';
				var currentCount = 1;
				var currentCountID;
				if ( settings.currentCountContainer ) { currentCountID = settings.currentCountContainer; }
				if ( !settings.currentCountContainer ) { currentCountID = parentID + '-slide-count'; }
				var currentCountClass = 'current-count';
				var totalCountID;
				if ( settings.totalCountContainer ) { totalCountID = settings.totalCountContainer; }
				if ( !settings.totalCountContainer ) { totalCountID = parentID + '-slide-total'; }
				var totalCountClass = 'total-count';
				var nav = '<ul id="'+settings.navID+'" class="slide-nav"><li><a href="#" id="'+prevID+'" class="'+prevClass+'">Previous</a></li><li class="nav-count-container"><span id="'+currentCountID+'" class="'+currentCountClass+'">'+currentCount+'</span> of <span id="'+totalCountID+'" class="'+totalCountClass+'">'+dItemsCount+'</span></li><li><a href="#" id="'+nextID+'" class="'+nextClass+'">Next</a></li></ul>';

				
			// Actions taken from gathered Data ----------------------------------------------------

			//Commented out the height setting on the parent element --  DC 09.29.11

				// Set some CSS and then wrap the whole thing 
				parentUL.css({
					'width':parentULWidth + 'px',			// Set width
					'height':itemsHeight + 'px',			// Set Height
					'position':'relative',				// Set position
					'top':0,					// You get it
					'left':0					// Ditto
				}).wrap('<div id="' + parentWrapID + '" style="width:' + parentWidth + 'px; overflow:hidden;height:'+(itemsHeight + 10)+'px" />'); 

				// Make a jQuery object out of our newly created DOM object
				var parentWrap = $('#' + parentWrapID );		// The Parent Trap, I mean Wrap
				
				// If you wanted navigation, we shall insert it now 
				if ( ( settings.nav ) && ( settings.nav != 'custom' ) ) {
					if ( settings.navPosition == 'before' ) {parentWrap.before(nav);}
					if ( settings.navPosition == 'after' ) {parentWrap.after(nav);}
				}

				if ( settings.nav == 'custom' ) {
					$('#' + currentCountID).text(currentCount);
					$('#' + totalCountID).text(dItemsCount);	
				}
				
				if ( settings.playPause && ( settings.transitionStart == 'auto' ) ) { $('#' + settings.playPauseID ).addClass('play'); }				

				// Make a jQuery object out of our newly created DOM object
				var prev = $('#' + prevID );				// Our Previous Button
				var next = $('#' + nextID );				// Our Next Button
				prev.addClass('inactive');
				
				// Placeholders for Calling Movement Variable
				var d;							// Direction
				var v;							// Variables
				var p;							// Placeholder
				var end = false; 					// Let's us know if we're at the end during looping
				
				var paused = true;
				var pause;
				
				// Create our data Object
				settings.parent.data({
					parentUL : parentUL,
					parentULWidth : parentULWidth,
					itemsWidth : itemsWidth,
					itemsHeight : itemsHeight,
					itemsOnScreen : itemsOnScreen,
					itemsLeft : itemsLeft,
					itemsRight : itemsRight,
					itemsCount : itemsCount,
					dItemsCount : dItemsCount,
					prev : prev,
					prevID : prevID,
					next : next,
					nextID : nextID,
					currentCount : currentCount,
					currentCountID : currentCountID,
					totalCountID : totalCountID,
					playPause : settings.playPause,
					playPauseID : settings.playPauseID,
					paused : paused,
					pause : pause,
					creditsToggleID : settings.creditsToggleID,
					creditsToggleTarget : settings.creditsToggleTarget,
					p : p,
					timer : timer,
					transitionStyle : settings.transitionStyle,
					item : settings.item,
					nav : settings.nav,
					navID : settings.navID,
					navPosition : settings.navPosition,
					transitionMove : settings.transitionMove,
					transitionStyle : settings.transitionStyle,
					transitionStart : settings.transitionStart,
					transitionTime : settings.transitionTime,
					transitionDelay	: settings.transitionDelay,
					count : settings.count,
					end : end
				});
				
				// Store our data Object
				v = settings.parent.data();
				
				
				// Set up Listeners -----------------------------------------------------------
				prev.click(function() { 
					d = 'prev'; 
					clearInterval(v.timer); 
					beginMove(v,d); 
					d = 'next'; 
					if ( v.transitionStart == 'auto' ) {
						v.timer = setInterval( function() { runTimer( v, d ); }, ( v.transitionDelay * 2 ) );
					}
					return false; 
				});
				
				next.click(function() { 
					d = 'next'; 
					clearInterval(v.timer); 
					beginMove(v,d); 
					if ( v.transitionStart == 'auto' ) {
						v.timer = setInterval( function() { runTimer( v, d ); }, ( v.transitionDelay * 2 ) );
					}
					return false; 
				}); 
				
				if ( ( v.transitionStart == 'auto' ) && ( !v.playPause ) ) {
					d = 'next'; 
					v.timer = setInterval( function() { runTimer( v, d ); }, v.transitionDelay );
				}
				
				if ( ( v.transitionStart == 'auto' ) && ( v.playPause ) && ( v.paused ) ) {
					$('#' + v.playPauseID).live('click', function() {
						d = 'next';
						$(this).removeClass('play').addClass('pause');
						v.pause = false;
						clearInterval( v.timer );
						v.timer = setInterval( function() { runTimer( v, d ); }, v.transitionDelay );
						return false;
					});
				}
				
				if ( v.playPause ) {
				
					$('#' + v.playPauseID + '.pause').live('click', function() {
						$(this).removeClass('pause').addClass('play');
						v.pause = true;
						clearInterval( v.timer );
						return false;
					});
					
					$('#' + v.creditsToggleID + ' p').click(function() { 
						$('.' + v.creditsToggleTarget).slideToggle(300); 
						$('#' + v.creditsToggleID + ' p').toggle();
						//return false;
					});
					
				}
				
			}
			
			// Move Function - v = Variables, d = Direction ----------------------------------------
			beginMove = function( v, d ) {

				if ( v.transitionMove == 'group' ) {
				
					if ( ( !v.end ) && ( v.itemsRight == 0 ) ) { v.end = true; }
					
					if ( ( d == 'next' ) && ( v.itemsRight > 0 ) ){
					
						if ( ( v.itemsRight > 0 ) && ( v.itemsRight <= v.itemsOnScreen ) ) {
							v.p = v.itemsRight;
							v.currentCount = v.dItemsCount;
							v.itemsLeft = (v.itemsCount - v.itemsOnScreen);
							v.itemsRight = 0;
							v.next.removeClass('inactive');
							v.prev.removeClass('inactive');
							move(v,d);
						}
						
						if ( v.itemsRight > v.itemsOnScreen ) { 
							v.p = v.itemsOnScreen;
							v.currentCount++;
							v.itemsLeft = (v.itemsLeft + v.itemsOnScreen);
							v.itemsRight = (v.itemsRight - v.itemsOnScreen);
							v.next.removeClass('inactive');
							v.prev.removeClass('inactive');
							move(v,d);
						}
												
					}
					if ( ( d == 'prev' ) && ( v.itemsLeft > 0 ) ) { 
						
						if ( ( v.itemsLeft > 0 ) && ( v.itemsLeft <= v.itemsOnScreen ) ) {
							v.p = v.itemsLeft;
							v.currentCount = 1;
							v.itemsLeft =  0;
							v.itemsRight = v.itemsCount - v.itemsOnScreen;
							v.prev.addClass('inactive');
							v.next.removeClass('inactive');
							move(v,d);
						}
						
						if ( v.itemsLeft > v.itemsOnScreen ) { 
							v.p = v.itemsOnScreen;
							v.currentCount--;
							v.itemsLeft = (v.itemsLeft - v.itemsOnScreen);
							v.itemsRight = (v.itemsRight + v.itemsOnScreen);
							v.prev.removeClass('inactive');
							v.next.addClass('inactive');
							move(v,d);
						}
						
					}
					
				}
				
				if ( v.transitionMove == 'single' ) {

					v.p = 1;					// Set multiplication variable to 1
					if ( ( d == 'next' ) && ( v.itemsRight > 0 ) ){
						v.currentCount++;
						v.itemsLeft++;
						v.itemsRight--;
						v.next.removeClass('inactive');
						v.prev.removeClass('inactive');
						move(v,d);
						updateCount(v);
					}
					if ( ( d == 'prev' ) && ( v.itemsLeft > 0 ) ){
						v.currentCount--;
						v.itemsLeft--;
						v.itemsRight++;
						v.next.removeClass('inactive');
						v.prev.removeClass('inactive');
						move(v,d);
						updateCount(v);
					}
					if ( ( d == 'next' ) && ( v.itemsRight == 0 ) && ( !v.end ) ) {
						clearInterval(v.timer);
						v.timer = setInterval( function() { v.end = true; }, v.transitionDelay );
					}
				}
				
				if ( v.end ) {		// only runs if user is on the last slide and clicks next
					if ( v.transitionStart == 'auto' ) { clearInterval( v.timer ); }
					d = 'next';
					v.currentCount = 1;
					v.itemsLeft =  0;
					v.itemsRight = v.itemsCount - v.itemsOnScreen;
					v.prev.addClass('inactive');
					v.next.removeClass('inactive');					
					if ( v.transitionStyle == 'slide' ) {
						// Move Schtuff around -----------------------------------------
						v.parentUL.animate({left: 0}, 'medium');
						updateCount(v);
					}
					if ( v.transitionStyle == 'fade' ) {
						// Move Schtuff around -----------------------------------------
						v.parentUL.fadeOut('fast').animate({left: 0}, 10).fadeIn('fast');
						updateCount(v);
					}
					v.end = false;
				}
				
				
			}
			// -------------------------------------------------------------------------- END - Move
			move = function(v,d) {
				v.end = false;
				if ( d == 'next' ) {
					if ( v.transitionStyle == 'slide' ) {
						// Move Schtuff around -----------------------------------------
						v.parentUL.animate({left: '-=' + ( v.itemsWidth * v.p )}, v.transitionSpeed);
						updateCount(v);
					}
					if ( v.transitionStyle == 'fade' ) {
						// Move Schtuff around -----------------------------------------
						v.parentUL.fadeOut('fast').animate({left: '-=' + ( v.itemsWidth * v.p )}, 10).fadeIn('fast');
						updateCount(v);
					}
				}
				if ( d == 'prev' ) {
					if ( v.transitionStyle == 'slide' ) {
						// Move Schtuff around -----------------------------------------
						v.parentUL.animate({left: '+=' + ( v.itemsWidth * v.p )}, v.transitionSpeed);updateCount(v);
					}
					if ( v.transitionStyle == 'fade' ) {
						// Move Schtuff around -----------------------------------------
						v.parentUL.fadeOut('fast').animate({left: '+=' + ( v.itemsWidth * v.p )}, 10).fadeIn('fast');
						updateCount(v);
					}
				}	
			}
			// Update Count - v = Variables --------------------------------------------------------
			updateCount = function( v ) { 

				if ( v.count ) {
					$('#' + v.currentCountID).text(v.currentCount);
					
					// Recalculate button states to prevent glitches
					if (v.currentCount == 1) { 			// if on first slide
						if (v.prev.hasClass('inactive')) {} else {v.prev.addClass('inactive');}
						v.next.removeClass('inactive');
					}
					else if (v.currentCount == v.dItemsCount) {	// if on last slide
						if (v.next.hasClass('inactive')) {} else {v.next.addClass('inactive');}
						v.prev.removeClass('inactive');
					}
					else {						// if neither first nor last slide
						v.next.removeClass('inactive');
						v.prev.removeClass('inactive');
					}
				} 
			}
			// ------------------------------------------------------------------ END - Update Count
		
			// Timer Function - v = Variables, d = Direction ---------------------------------------
			runTimer = function(v,d) {
			
				if ( !v.pause ) {
				
					v.paused = false;
					
					clearInterval( v.timer );
					if ( v.itemsRight == 0 ) {
						v.itemsLeft = 0; 
						v.itemsRight = (v.itemsCount - v.itemsOnScreen);
						v.currentCount = 1;
						v.prev.addClass('inactive');
						v.next.removeClass('inactive');
						if ( v.transitionStyle == 'slide' ) {
							// Move Schtuff around -----------------------------------------
							v.parentUL.animate({left: 0}, 'medium');
							updateCount(v);
						}
						if ( v.transitionStyle == 'fade' ) {
							// Move Schtuff around -----------------------------------------
							v.parentUL.fadeOut('fast').animate({left: 0}, 10).fadeIn('fast');
							updateCount(v);
						}
					}
					else { beginMove( v, d ); }
					v.timer = setInterval( function() { runTimer( v, d ); }, v.transitionDelay );
				
				}
				
				if ( v.pause ) { v.paused = true; clearInterval( v.timer ); }

				
			}
			// ---------------------------------------------------------------- END - Timer Function
			
			
			// --------------------------------------------------------------------- END - Functions
			
			// Each --------------------------------------------------------------------------------
			return this.each(function() {
			
				// Cache this
				var $this = $(this);
				
				if ( selfClass ) { var pass = [$this, selfClass, selfLength]; assignID(pass); }
				if ( settings.parent.find(settings.item).length > 1 ) {
					// If you weren't a blockhead and the plugin worked
					if ( settings.parent ) { getData(); }
					if ( !settings.parent ) { console.log("You didn't configure this correctly and didn't pass a live variable"); }
				}
				
				
			});
			// -------------------------------------------------------------------------- END - Each

		}	// -------------------------------------------------------------------------- END - Init

	};  // ----------------------------------------------------------------------------------- END - methods
		
$.fn.dSlides = function( method ) {

	if ( methods[method] ) {
		return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
	} else if ( typeof method === 'object' || ! method ) {
		return methods.init.apply( this, arguments );
	} else {
		$.error( 'Method ' +  method + ' does not exist on jQuery.dSlides' );
	}    

};

})( jQuery );
		
			
			

/*
* Version 1.1 20100708 MP
* Requires jQuery 1.5 and the jQuery template plugin (http://api.jquery.com/category/plugins/templates/)
*
* This plugin has 3 methods.
* - The default method outputs the currently logged in user's account data
* (everything that is exposed by the OpenCMS registration rest API - http://sp10prod/divisions/dispatch_it_web/Redtail%20Wiki/Registration%20Module.aspx)
* in a named jquery template. You can pass this method the name of a named template (there are 6 defined in the plugin - see the documentation).
* 
* - 'getValues' takes no parameters and outputs the profiledata object returned by the rest api.
*
* - 'isGuest' returns true if the user is currently a guest, false if the user is logged in to a registered account. Takes no parameters.
*
* Version 1.1 -- added a callback to the init function and a custom template for the dispatch toobar.
* Version 1.2 -- added caching of account data to avoid repeated calls.
*
*/

(function( $ ){


  // set the cms-link-tagged uri base (all methods below use the same one).
  var globalPostUri = "/content/system/modules/com.dispatch.registration/rest/user";
  
  var userProfile = {};

  var methods = {

    init : function( options ) {

      var tmpmarkup = '<div class="dAccount"><p class="monikers"><span class="realname">{{= firstname}} {{= lastname}}</span> <span class="username">({{= login}})</span></p><p class="email">{{= email}}</p><p class="zipcode">{{= zipcode}}</p><p class="dates">Account Created: <span class="createddate">{{= createddate}}</span> | Last Login: <span class="lastlogin">{{= lastlogin}}</span></p></div>';
      $.template("dAccountDefault", tmpmarkup);
      
      tmpmarkup = '<div class="dAccount"><p class="monikers"><span class="realname">{{= firstname}} {{= lastname}}</span> <span class="username">({{= login}})</span></p><p class="email">{{= email}}</p><p class="zipcode">{{= zipcode}}</p></div>';
      $.template("dAccountNameAndEmail", tmpmarkup);
      
      tmpmarkup = '<div class="dAccount"><p class="monikers"><span class="realname">{{= firstname}} {{= lastname}}</span> <span class="username">({{= login}})</span></p></div>';
      $.template("dAccountName", tmpmarkup);
      
      tmpmarkup = '<div class="dAccount"><p class="username">{{= login}}</p></div>';
      $.template("dAccountUsername", tmpmarkup);
      
      tmpmarkup = '<span class="realname">{{= firstname}} {{= lastname}}</span> <span class="username">({{= login}})</span>';
      $.template("dAccountNameInline", tmpmarkup);
      
      tmpmarkup = '<span class="username">{{= login}}</span>';
      $.template("dAccountUsernameInline", tmpmarkup);
      
      var settings = {
        'template' : 'dAccountDefault',
        'posturi'  : globalPostUri,
        'ifLoggedIn'  : true,
        'loggedOutAlt' : false,
        'loggedOutHTML' : '',
        'clearfirst' : false,
        'callback'  : ''
        
      }
      
      if ( options ) { 
        $.extend( settings, options );
      }

      return this.each(function() {

        var $this = $(this);
        
        if (!userProfile.hasOwnProperty('login')) {
        
          var cachebust = Math.round(new Date().getTime() / 1000);
        
          $.ajax({
            type: "GET",
            jsonp: null,
            jsonpCallback: null,
            url: settings.posturi,
            async: false,
            data: {
            	z : cachebust
            },
            dataType: "json",
            success: function (accountdata) {
              if ((accountdata.login != "Guest" && settings.ifLoggedIn) ||  !settings.ifLoggedIn) {
                if (settings.clearfirst) {
                  $this.html('');
                }
                $.tmpl(settings.template, accountdata).appendTo($this);
                userProfile = accountdata;
              }
              if(typeof settings.callback == 'function'){
                //settings.callback.call(accountdata.login);
                settings.callback(accountdata.login);
              }
            }
          });
        
        } else {
          $.tmpl(settings.template, userProfile).appendTo($this);
        }
        
      });
    },
    getValues : function (options) {
      
      var settings = {
        'posturi'  : globalPostUri
      }
      
      if ( options ) { 
        $.extend( settings, options );
      }
      
      if (!userProfile.hasOwnProperty('login')) {
      
        var cachebust = Math.round(new Date().getTime() / 1000);
        
        var profiledata;
        
        $.ajax({
            type: "GET",
            async: false,
            url: settings.posturi,
            jsonp: null,
            jsonpCallback: null,
            data: {
            	z : cachebust
            },
            dataType: "json",
            success: function (accountdata) {
              profiledata = accountdata;
              userProfile = accountdata;
            }
          });
      
      } else {
        profiledata = userProfile;
      }
        
      return profiledata;
      
    },
    isGuest : function (options) {
      
      var settings = {
        'posturi'  : globalPostUri
      }
      
      if ( options ) { 
        $.extend( settings, options );
      }
      
      var loggedasguest;
      
      if (!userProfile.hasOwnProperty('login')) {
      
        var cachebust = Math.round(new Date().getTime() / 1000);
        
        $.ajax({
            type: "GET",
            async: false,
            url: settings.posturi,
            jsonp: null,
            jsonpCallback: null,
            data: {
            	z : cachebust
            },
            dataType: "json",
            success: function (accountdata) {
              if (accountdata.login == "Guest") {
                loggedasguest = true;
              } else {
                loggedasguest = false;
              }
              userProfile = accountdata;
            }
          });
          
        } else {
        
          if (userProfile.login == "Guest") {
            loggedasguest = true;
          } else {
            loggedasguest = false;
          }
        
        }
      
      return loggedasguest;
    } 
  }

  $.fn.daccount = function ( method ) {

    if ( methods[method] ) {
      return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
    } else if ( typeof method === 'object' || ! method ) {
      return methods.init.apply( this, arguments );
    } else {
      $.error( 'Method ' +  method + ' does not exist.' );
    }
  }
})( jQuery );
		
			
			





function nicheGetLastInitial (lname) {
  var initialAndPeriod = lname;
  if (lname.length > 1) {
    initialAndPeriod = lname.charAt(0)+".";
  }
  return initialAndPeriod;
}

(function( $ ){

  var tmpmarkup = '<div class="comment-container-{{= commentLevel}}" id="comment-{{= id}}"><a class="comment-flag" href="#">flag</a><p class="comment-name">{{= name}}</p><p class="comment-subject">{{= subject}}</p><p class="comment-text">{{= commentText}}</p><p class="comment-timestamp">{{= created}}</p></div>';
  
  var tmpmarkup_niche = '<div class="comment-container-{{= commentLevel}}" id="comment-{{= id}}"><a class="comment-flag" href="#">flag</a><p class="comment-name">{{= firstname}} {{= nicheGetLastInitial(lastname)}}</p><p class="comment-subject">{{= subject}}</p><p class="comment-text">{{= commentText}}</p><p class="comment-timestamp">{{= created}}</p></div>';
  
  $.template("dCommentsDefault", tmpmarkup);
  
  $.template("dCommentsNiche", tmpmarkup_niche);
  
  var defaultProfile = '';
  
  var sendBackURL = encodeURIComponent(location.href);

  var methods = {
    init : function (options) {
      var settings = {
        'profile'           : defaultProfile,
        'formPosition'      : 'top',
        'formTemplate'      : 'default',
        'recaptcha'         : true,
        'recaptchaTheme'    : 'clean',
        'resourceid'        : '0',
        'defaultPagination' : true,
        'loginLinkText'     : '<a href="/content/system/modules/com.dispatch.registration/pages/login.jsp?sendback='+sendBackURL+'#comment">Login</a> or <a href="/content/system/modules/com.dispatch.registration/pages/signup.jsp?sendback='+sendBackURL+'#comment">register</a> to post a comment.',
        'commentsPerPage'	: 50,
        'page'            : 1,
        'getLevel'        : 'public', // flagged, deleted, blocked, unapproved
        'templateName'    : 'dCommentsDefault',
        'logintoview'     : false,
        'logintopost'     : true,
        'commentPrompt'   : 'Place comment here',
        'syndicatePrompt' : 'Post to Facebook or Twitter',
        'commentOrder'    : 'newestlast',
        'successCallback' : '',
        'errorCallback'   : 'userReport',
        'updateCallback'  : false, // provides a callback for when the list of comments is updated/displayed
        'disabled'        : '' // true, [false or ''], nowrite
        
      };
      
      if (settings.logintoview && settings.logintopost) {
        settings.loginLinkText = '<a href="/content/system/modules/com.dispatch.registration/pages/login.jsp?sendback='+sendBackURL+'#comment">Login</a> or <a href="/content/system/modules/com.dispatch.registration/pages/signup.jsp?sendback='+sendBackURL+'#comment">register</a> to view and post comments.';
      }
      
      if ( options ) { 
        $.extend( settings, options );
      }
      
      $('a.comment-flag').live('click', function () {
      
        $commetContainer = $(this).parent();
        commentid = $commetContainer.attr('id').substr(8);
        
        $.ajax({
          type: "POST",
          jsonp: null,
            jsonpCallback: null,
          url: '/content/system/modules/com.dispatch.comments/rest/flag',
          data: {
            'c'       : commentid,
            'r'       : 'user'
          },
          dataType: "json",
          success: function(commdata) {
            if ("error" in commdata) {
              $commetContainer.find('.comment-flag').html("<strong>Flag Error</strong>");
            } else {
              $commetContainer.find('.comment-flag').html("<strong>Comment Flagged</strong>");
            }
          }
        });
        
        return false;
        
      });
      
      $('span.dpg-pages a').live('click', function () {
        settings.page = $(this).text();
        $this.dcomments('getComments', settings);
        return false;
      });
      
      return this.each(function() {
        
        if (settings.disabled != 'true') {
        
          $this = $(this);
          
          var $wraps = $('<div class="dcommentswrap"><div class="dcomments"><div id="dcpagination_top" class="dcpagination"></div><div class="comments"></div><div id="dcpagination_bottom" class="dcpagination"></div></div></div>');
          var form_wrap = '<div class="commentForm"></div>';
          
          $this.html($wraps);
          
          if (settings.formPosition == 'top') {
            $('.dcommentswrap').prepend(form_wrap);
          } else {
            $('.dcommentswrap').append(form_wrap);
          }
          
          $this.dcomments('getComments', settings);
          
          commentForm(settings);
        
        }
        
      });
      
    },
    
    getComments : function (options) {
      var settings = {
        'profile'         : defaultProfile,
        'page'            : 1,
        'getLevel'        : 'public', // flagged, deleted, blocked, unapproved
        'resourceid'      : '0',
        'templateName'    : 'dCommentsDefault',
        'commentsPerPage'	: 50,
        'commentOrder'    : 'newestlast',
        'logintoview'     : false
      };
      
      if ( options ) { 
        $.extend( settings, options );
      }
      
      var getAction, cmt_tmpl;
      
      var cmt_tmpl_holder = $('#'+settings.templateName);
      if (cmt_tmpl_holder.length) {
        $.template(settings.templateName, cmt_tmpl_holder);
      }
      
      switch(settings.getLevel) {
        case 'flagged':
          getAction = '/content/system/modules/com.dispatch.comments/rest/getflaggedcomments';
          break;
        case 'deleted':
          getAction = '/content/system/modules/com.dispatch.comments/rest/getdeletedcomments';
          break;
        case 'blocked':
          getAction = '/content/system/modules/com.dispatch.comments/rest/getblockedcomments';
          break;
        case 'unapproved':
          getAction = '/content/system/modules/com.dispatch.comments/rest/getunapprovedcomments';
          break;
        case 'approved':
          getAction = '/content/system/modules/com.dispatch.comments/rest/getapprovedcomments';
          break;
        default:
          getAction = '/content/system/modules/com.dispatch.comments/rest/getcomments';
          break;
      }
      
      return this.each(function() {
        
        $.ajax({
          type: "POST",
          url: getAction,
          jsonp: null,
            jsonpCallback: null,
          data: {
            'profile' : settings.profile,
            'r'       : settings.resourceid,
            'p'       : settings.page
          },
          dataType: "json",
          success: function(commdata) {
            if ("error" in commdata) {
              if (settings.updateCallback != false) {
			settings.updateCallback.call(true);
		}
            } else {
              commdata.Comments.reverse();
              updateComments(commdata.Comments, settings.templateName);
              pagination(settings.page, settings.commentsPerPage, settings.resourceid, settings);
              // use the update callback if defined
              if (settings.updateCallback != false) {
			settings.updateCallback.call(true);
		}
            }
          }
        });
      });
      
    },
    
    moderate : function (options) {
      var settings = {
        
      };
      
      if ( options ) { 
        $.extend( settings, options );
      }
      
      return this.each(function() {
        
        $this = $(this);
        
      });
      
    },
    
    getCommentCount : function (options) {
      var settings = {
        'resourceid'        : '0'
      };
      
      if ( options ) { 
        $.extend( settings, options );
      }
      
      var ccount = 0;
      
      $.ajax({
          type: "POST",
          async: false,
          jsonp: null,
            jsonpCallback: null,
          url: '/content/system/modules/com.dispatch.comments/rest/getcount',
          data: {
            'r'       : settings.resourceid
          },
          dataType: "json",
          success: function(commdata) {
            if ("error" in commdata) {
              //console.log("Comment Load Fail (dcomments): "+commdata.error);
            } else {
              ccount = commdata;
            }
          }
        });
      
      return ccount.count;
      
    }
    
  };
  
  function updateComments (commentDateObject, templateName, loginLink, settings){
  
    var commentHolder = $(".comments");
    commentHolder.html('');
    $.tmpl(templateName, commentDateObject).appendTo('.comments');  
    
  };
  
  function pagination (p, ncpp, rid, settings) {
  	$.ajax({
          type: "POST",
          jsonp: null,
            jsonpCallback: null,
          url: '/content/system/modules/com.dispatch.comments/rest/getcount',
          data: {
            'r'       : rid
          },
          dataType: "json",
          success: function(commdata) {
            if ("error" in commdata) {
              //console.log("Comment Load Fail (dcomments): "+commdata.error);
            } else {
              var np;
              if (commdata.count % ncpp > 0) {
              	np = ((commdata.count - (commdata.count % ncpp)) / ncpp) + 1;
              } else {
              	np = (commdata.count / ncpp);
              }
              
              if (np>1) {
              
                var paginationHTML = '<span class="dc-mc">More comments: </span><a class="dpg-first" href="#">First</a><a class="dpg-prev" href="#">Prev</a><span class="dpg-pages">';
                
                if (np > 10) {
  	              for (tp = 1; tp<=np; tp++) {
  	              	linkclass = "";
  	              	if (tp == p) {
  	              	  linkclass="current-page";
  	              	}
  	                paginationHTML += '<a class="'+linkclass+'" href="#">'+tp+'</a>';
  	              }
                } else {
                	for (tp = 1; tp<=np; tp++) {
  	              	linkclass = "";
  	              	if (tp == p) {
  	              	  linkclass="current-page";
  	              	}
  	              	paginationHTML += '<a class="'+linkclass+'" href="#">'+tp+'</a>';
  	              }
                }
                
                paginationHTML += '</span><a class="dpg-next" href="#">Next</a><a class="dpg-last" href="#">Last</a><div class="clear"></div>';
                
                $('#dcpagination_top').html(paginationHTML);
                $('#dcpagination_bottom').html(paginationHTML);
                
              } else {
                $('.dcpagination').remove();
              }
              
            }
          }
        });
  };
  
  function commentForm (settings) {
  
    var commentformcode = $('<div />').addClass('dpc_comments_form')
              .html('<p id="dcalert">&nbsp;</p><form name="dcomments" class="dcommentForm" action="post" action="#"><ul><li class="commentInstructions"><p class="commentInstructions"></p></li><li class="s"><input type="text" name="s" /><label for="s">Title</label></li><li class="t"><label for="t">Comment</label><br /><textarea name="t"></textarea></li><li class="recaptcha"><div id="recaptcha_div"></div></li><li class="syndicate"><input type="checkbox" name="syndicate" val="yes" /><label for="syndicate">Share your comment</label></li><li class="post"><input type="submit" id="submit-button" name="submit-button" value="Post" /></li><li><a class="dcomments-logout" href="/content/system/modules/com.dispatch.registration/pages/logout.jsp?sendback='+sendBackURL+'">Log Out / Change User</a></li></ul></form>');
    var commentFormHiddenFields = '<input type="hidden" name="profile" value="'+settings.profile+'" /><input type="hidden" name="r" value="'+settings.resourceid+'" /><input type="hidden" name="p" value="" />';
    
    var loginlinkcode = $('<div />').addClass('dpc_comments_form')
              .html(settings.loginLinkText);
              
    var anonhtml = '<li><input type="text" name="s" /><label for="s">Display Name</label></li><li><input type="text" name="e" /><label for="e">Email</label></li>';
    
    if (settings.disabled != 'nowrite') {
      if ($.fn.daccount('isGuest')) {
        $('.commentForm').append(loginlinkcode);
      } else {
        if (settings.formTemplate == 'default') {
          $('.commentForm').append(commentformcode);
        } else {
          $('.commentForm').append('<form name="dcomments" class="dcommentForm" action="post" action="#">'+$('#'+settings.formTemplate).html()+'</form>');
        }
      }
    }
    
    $('.commentForm').find('form').prepend(commentFormHiddenFields);
    $('textarea[name=t]').val(settings.commentPrompt).focus(function(){if($(this).val()==settings.commentPrompt){$(this).val('')}}).blur(function(){if($(this).val()==''){$(this).val(settings.commentPrompt)}});
    $('label[for=syndicate]').text(settings.syndicatePrompt);
    $('a.dcomments-logout').css({
      'text-align':'right',
      'font-size': '11px',
      'font-family': 'arial',
      'color': '#666',
      'text-decoration': 'none',
      'border': 'none',
      'float':'right',
      'margin-top':'-16px'
    });
    //a.dcomments-logout{text-align:right; font-size: 11px; font-family: arial; color: #333; text-decoration: none;}
    
    if (settings.recaptcha) {
      var recaptchaoptions = {
        'theme' : settings.recaptchaTheme,
        'tabindex' : 3
      };
            
      Recaptcha.create('6LdMVsESAAAAAHIkQexP-a3ve5_BJ1exIKON9hT7', "recaptcha_div", recaptchaoptions);
    }
    
    $("form.dcommentForm").submit(function () {
    
      if (($('textarea[name=t]').val() != '') && ($('textarea[name=t]').val() != settings.commentPrompt)) {

        var $form = $('form.dcommentForm');
        
        $('input[type=submit]', $form).attr('disabled', 'disabled');
  
        var commentpost = {};
        commentpost.e = $("input[name=e]", $form).val();
        commentpost.p = $("input[name=p]", $form).val();
        commentpost.m = $("input[name=m]", $form).val();
        commentpost.profile = $("input[name=profile]", $form).val();
        commentpost.r = $("input[name=r]", $form).val();
        commentpost.s = $("input[name=s]", $form).val();
        commentpost.t = $("textarea[name=t]", $form).val();
        if (settings.recaptcha) {
        	commentpost.c = Recaptcha.get_challenge();
        	commentpost.v = Recaptcha.get_response();
        }
        commentpost.m = '';
        
        if ($('input[name=syndicate]').attr('checked')) {
          RPXNOW.init({appId: 'cfockpaeeccahlmhlkmg',
          xdReceiver: '/content/digital/config/rpx_xdcomm.html'});
          
          RPXNOW.loadAndRun(['Social'], function () {
            var activity = new RPXNOW.Social.Activity(
               "Share your comment",
               commentpost.t,
               window.location.href);
            RPXNOW.Social.publishActivity(activity);
          });
        }
        
        $.ajax({
  	        type: "POST",
  	        url: '/content/system/modules/com.dispatch.comments/rest/add',
  	        data: commentpost,
  	        jsonp: null,
            jsonpCallback: null,
  	        dataType: "json",
  	        success: function(commdata) {
  	          if (commdata["error"] || commdata["errors"]) {
  	            
  	            if($.isFunction(settings.errorCallback)){
                  settings.errorCallback.call(commdata);
                }
  	            
  	          } else {
  	            //commdata.Comments.reverse();
  	            //updateComments(commdata.Comments, settings.templateName);
  	            
  	            //<div class="comment-container-{{= commentLevel}}" id="comment-{{= id}}"><a class="comment-flag" href="#">flag</a><p class="comment-name">{{= name}}</p><p class="comment-subject">{{= subject}}</p><p class="comment-text">{{= commentText}}</p><p class="comment-timestamp">{{= created}}</p></div>
  	            var posted = {
  	              'id' : 'new',
  	              'name': 'you',
  	              'firstname' : 'you',
  	              'lastname' : ' ',
  	              'subject' : commentpost.s,
  	              'commentText' : commentpost.t,
  	              'created' : 'just now'
  	            };
  	            
  	            //ccount = $.fn.dcomments('getCommentCount', {'r':commentpost.r});
  	            
  	            //if (ccount <= $('.comments').length) {
                  $.tmpl(settings.templateName, posted).appendTo('.comments');
                //}
                
                userReport('Your comment has been posted.');
  	            
  	            $(".dpc_comments_form form").find(':input').each(function() {
                  switch(this.type) {
                    case 'password':
                    case 'select-multiple':
                    case 'select-one':
                    case 'text':
                    case 'textarea':
                      $(this).val('');
                      break;
                    case 'checkbox':
                    case 'radio':
                      this.checked = false;
                      break;
                  }
                });
                
                $('textarea[name=t]').val(settings.commentPrompt);
                
                if($.isFunction(settings.successCallback)){
                  settings.successCallback.call(commdata);
                }
                
                if (settings.recaptcha) {
                  Recaptcha.create('6LdMVsESAAAAAHIkQexP-a3ve5_BJ1exIKON9hT7', "recaptcha_div", recaptchaoptions);
                }
                
                $('input[type=submit]', $form).removeAttr("disabled");     
                
  	          }
  	        }
  	      });
	      
	    }
      
      return false;
      
    });
    
    function userReport (message) {
      $('#dcalert').css({opacity:0}).text(message).animate({opacity: 1}, 'fast', function () {$('#dcalert').delay(500).animate({opacity: 0}, 'slow'); $('#dcalert').click(function() {$('#dcalert').animate({opacity: 0}, 'fast')})});
    }
    
    return false;
    
  };
  
  $.fn.dcomments = function ( method ) {
    
    if ( methods[method] ) {
      return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
    } else if ( typeof method === 'object' || ! method ) {
      return methods.init.apply( this, arguments );
    } else {
      $.error( 'Method ' +  method + ' does not exist.' );
    }
    
  }
  
})( jQuery );
		
			
			










/* ONREADY */
	$(function() {
		$("#interests-content li:odd").addClass("alt");
	});

/*	///////////////////////////////////////////////////////////////
	FAVORITES/RATINGS/COMMENTS
*/

		function removeFavorite(aObj, id) {
			$(aObj).parent().fadeOut();

			jQuery.ajax({
				type:'POST',
				url:'/content/system/modules/com.dispatch.favorites/rest/deleteFavorite/index.jsp',
				data:'r='+id,
				success: function() {
					//alert("You've removed this favorite.");
				}
			});	
	
		}
		
		function changeRating(aObj, id, rating) {
			var o_stars = $(aObj).parent().parent().find("li");
			var i_stars = 1;
			
			o_stars.each(function(index) {
				if (i_stars <= rating) {
					$(this).removeClass("rating-off").addClass("rating-on");
				} else {
					$(this).removeClass("rating-on").addClass("rating-off");
				}
				
				i_stars++;
			});
			
			jQuery.ajax({
				type:'POST',
				url:'/content/system/modules/com.dispatch.favorites/rest/addRating/index.jsp',
				data:'r='+id+'&rating='+rating,
				success: function() {
					//alert("You've altered this rating.");
				}
			});	
		}


/*	///////////////////////////////////////////////////////////////
	INTERESTS
*/
	function interestOn(aObj, id) {
		$(aObj).parent().removeClass("not-interested").addClass("interested");
		jQuery.ajax({
			type:'POST',
			url:'/content/system/modules/com.dispatch.exacttarget/rest/addInterest/index.jsp',
			data:'iid='+id,
			success: function() {
				//alert("You've been subscribed from this newsletter.");
			}
		});	
	}
	
	function interestOff(aObj, id) {
		$(aObj).parent().removeClass("interested").addClass("not-interested");
		jQuery.ajax({
			type:'POST',
			url:'/content/system/modules/com.dispatch.exacttarget/rest/removeInterest/index.jsp',
			data:'iid='+id,
			success: function() {
				//alert("You've been unsubscribed from this newsletter.");
			}
		});	
	}
	



/*	///////////////////////////////////////////////////////////////
	NEWSLETTERS & ALERTS
*/
		
		
		function newsletterSubscribe(id) {
			$('#newsletters-content input[value="'+id+'"]').attr("checked","checked");
		
			jQuery.ajax({
				type:'POST',
				url:'/content/system/modules/com.dispatch.exacttarget/rest/subscribe/index.jsp',
				data:'nid=' + id,
				success: function() {
					//alert("You've been subscribed from this newsletter.");
					newsletterSubmitToggle();
					
				}
			});	
		}
		
		function newsletterUnsubscribe(id) {
			$('#newsletters-content input[value="'+id+'"]').attr("checked","");
		
			jQuery.ajax({
				type:'POST',
				url:'/content/system/modules/com.dispatch.exacttarget/rest/unsubscribe/index.jsp',
				data:'nid=' + id,
				success: function() {
					newsletterSubmitToggle();
					//alert("You've been unsubscribed from this newsletter.");
				}
			});	
		}
		
		function newsletterSubmitToggle() {
			newsletterToggleMgr = (newsletterToggleMgr - 1);
			
			if (newsletterToggleMgr <= 0) {
				$('#newsletters-content input[type="submit"]').attr("disabled","").attr("value","Save changes");
			}
		}
		
		var newsletterToggleMgr = 0;
		function newsletterChange(inputObj) {
			var o_input = $(inputObj);
			var b_add   = o_input.attr("checked");
			var id      = o_input.attr("value");
			var match   ='input[value="'+id+'"]';
			
			newsletterToggleMgr++;
			$('#newsletters-content input[type="submit"]').attr("disabled","disabled").attr("value","Please wait...");

			if (b_add) {
				newsletterSubscribe(id);
			} else {
				newsletterUnsubscribe(id);
			}
		}		
		
			
			


/**
* Singleton class for Kick Apps Single Sign on (SSO) implementation
*/
var KickAppsManager = (function() {
	
	/**
	* Write debug statements to firebug console if it is open
	* @param {value} The value to write to the console
	*/
	var debug = function(value) {
		// MAKE SURE CONSOLE EXISTS AND WRITE VALUE
		window.console && console.log("[KickAppsManager] " + value);
	}
	
	/** All final constants used for Kick Apps Single Signon */
	KICKAPPS_CONSTANTS = (function() {
		var globals = {};
		
		/** The URL to the iFrame to use to invoke a single signon */
		globals.SINGLE_SIGNON_URL = "http://affiliate.kickapps.com/service/openCustomPage.kickAction";
		
		/** The query string parameter used to pass a Kick Apps Session Token */
		globals.PARAM_KICK_APPS_SESSION_TOKEN = "st";

		/** The query string parameter used to pass a Kick Apps Session Token */
		globals.PARAM_KICK_APPS_TRANSACTION_ID = "tid";
		
		/** The query string parameter used to pass a Kick Apps affiliate Site ID */
		globals.PARAM_KICK_APPS_AFFILIATE_SITE_ID = "asid";
		
		/** The jQuery DOM location where a login form submit button is expected */
		globals.DOM_LOGIN_SUBMIT_BUTTON = '#loginOffers input[name="login_submit"]';
		
		/** The jQuery DOM location where the iFrame to complete SSO should be appended */
		globals.DOM_IFRAME_APPEND_DESTINATION = "#footer";
		
		/** The URL for the rest call to start logging a user into KickApps */
		globals.KICK_APPS_USER_REST_URL = "/content/system/modules/com.dispatch.kickapps/rest/getKickappsUserTokens/index.jsp";
	
		/** The name of the cookie used to store information about the state of Single Sign On */
		globals.KICK_APPS_COOKIE_NAME = "KA_data";
		
		/** The value for the cookie when a Kick Apps Single Signon should be attempted */
		globals.COOKIE_STATE_LOGGING_IN = "logging-in"
		
		/** Accessor method for Kick Apps Constants 
		@param {valueName} The string name of a constant to return
		*/
		return { getValue : function(valueName) {
				debug("Attempting to read constant: " + valueName);
				debug("Value found: " + globals[valueName]);
				return globals[valueName];
			}
		}
	}());
	
	/** The affiliate Id */
	var affiliateId = "";
	
	/** The Kick Apps cookie for the current user */
	var kickAppsCookie = readCookie(KICKAPPS_CONSTANTS.getValue("KICK_APPS_COOKIE_NAME"));
	
	/**
	* Bind an event to the login form submit button which will write a cookie prior to the login attempt
	*/
	var startClickListener = function() {
	
		// LOG THE ATTEMPT TO SEARCH FIND 
		debug("Trying to setup a click event for login form submit button");
	
		// LOOK FOR A LOGIN FORM SUBMIT BUTTON AND BIND CODE ON CLICK
		jQuery(KICKAPPS_CONSTANTS.getValue("DOM_LOGIN_SUBMIT_BUTTON")).click(function() {

			// LOG THE CLICK OF THE SUBMIT BUTTON
			debug("Entering bind method for KickAppsManager on login form submit");
		
			// ERASE ANY PREVIOUS COOKIE RELATED TO THIS
			eraseCookie(KICKAPPS_CONSTANTS.getValue("KICK_APPS_COOKIE_NAME"));
			debug("Cookie Data Cleared");
			
			// SETUP A NEW COOKIE SAYING LISTENER WAS ENGAGED
			createCookie(KICKAPPS_CONSTANTS.getValue("KICK_APPS_COOKIE_NAME"), 
				KICKAPPS_CONSTANTS.getValue("COOKIE_STATE_LOGGING_IN"));
			debug("Updated Cookie Data: " + cookieData);
			
		});
		
		// LOG THE COMPLETION OF THE START CLICK LISTENER ROUTINE
		debug("Done configuring click event for login submit");
		
	}
	
	/**
	* Attempt a single signon to KickApps as the user recently went through a login process
	*/
	var attemptSingleSignon = function() {
	
		// LOG THE SINGLE SINGON ATTEMPT
		debug("Attempting to sign user in to KickApps");
		
		// MAKE AJAX CALL TO BEGIN KICK APPS SINGLE SIGNON
		jQuery.ajax({
			type: 'POST',
			url: KICKAPPS_CONSTANTS.getValue("KICK_APPS_USER_REST_URL"),
			data: 'data',
			dataType: 'JSON',
			jsonp: null,
            		jsonpCallback: null,
			success: function( payload ) {
			
				// LOG THE RESPONSE PAYLOAD
				debug("KickApps SingleSignOn Rest Call complete");
				debug(payload);
				
				// SEE IF A BAD PAYLOAD WAS RETURNED
				if ( payload == null ) {
				
					// LOG THE FAILED ATTEMPT TO LOGIN TO KICKAPPS
					debug("Attempt to login user to KickApps failed");

				} else {
				
					// LOG THE RETURNED SESSION TOKEN AND TRANSACTION ID
					debug("Kick Apps Session Token Returned: " + payload.sessionToken);
					debug("Kick Apps Transaction ID Returned: " + payload.transactionId);

					// CREATE AN IFRAME TO FINISH SSO WITH NEW CREDENTIALS
					var iframeUrl = KICKAPPS_CONSTANTS.getValue("SINGLE_SIGNON_URL") + "?" + 
						KICKAPPS_CONSTANTS.getValue("PARAM_KICK_APPS_AFFILIATE_SITE_ID") + "=" + affiliateId + "&" +
						KICKAPPS_CONSTANTS.getValue("PARAM_KICK_APPS_SESSION_TOKEN") + "=" + payload.sessionToken + "&" +
						KICKAPPS_CONSTANTS.getValue("PARAM_KICK_APPS_TRANSACTION_ID") + "=" + payload.transactionId;
				
					// CREATE SSO IFRAME TO FINISH LOGIN
					debug("KickApps SSO IFrame Source: " + iframeUrl);
					
					// ADD THE IFRAME TO THE FOOTER
					jQuery(KICKAPPS_CONSTANTS.getValue("DOM_IFRAME_APPEND_DESTINATION"))
						.append("<iframe src=\"" + iframeUrl + 
						"\" width=\"1\" height=\"1\" id=\"kickapps-sso\"></iframe>");

					// LOG THE COMPLETION OF THE SINGLE SIGNON PROCESS
					debug("Single signon completed");
					
					// IF ARRIVED FROM KICKAPPS, READ DESTINATION COOKIE
					var destination = readCookie("KA_SSO_Redirect");
						debug("Reading Redirect Cookie");
						debug("Redirect URL: " + destination);
					eraseCookie("KA_SSO_Redirect");
						debug("Redirect Cookie Deleted");
						
					// FUNCTION FOR REDIRECTING TO PREVIOUS KICKAPPS SITE	
					destinationGo = function() { window.location = destination; }
					
					// FUNCTION FOR INSERTING A FALLBACK LINK
					insertFallbackLink = function() {
						$('#message').append('<a href="'+destination+'">Click here for your destination</a>');
					}
					
					// IF THE KA_SSO_REDIRECT COOKIE EXISTS
					if ( ( destination != '' ) && ( destination != undefined ) ) {
						setTimeout('destinationGo()', 5500); 
						setTimeout('insertFallbackLink()', 5000); 
					}
				
				}
				
				// ERASE THE COOKIE AS EITHER LOGIN FAILED OR SSO COMPLETED
				eraseCookie(KICKAPPS_CONSTANTS.getValue("KICK_APPS_COOKIE_NAME"));
				
				// LOG THE DELETE OF THE KICK APPS COOKIE
				debug("KickApps cookie for SSO has been deleted");
				
			}
		});
	
	}
	
	/** All the public methods for this class attach here */
	var publicMethods = {};
	
	/**
	* Start the Kick Apps Manager for single Sign On
	* @param {asid} The Kick Apps affiliate ID to start the Kick Apps Manager for
	*/
	publicMethods.start = function(asid) {
	
		// LOG THE AFFILIATE SITE ID
		debug("Starting Kick Apps Manager with affiliate ID: " + asid);
	
		// STORE THE AFFILIATE SITE ID TO USE
		if(asid) {
			affiliateId = asid;
		}
		
		// START THE CLICK LISTENER FOR THE LOGIN PAGE
		startClickListener();
		
		// READ KICK APPS COOKIE
		debug("Current users Kick Apps cookie Data: " + kickAppsCookie);

		// CHECK TO SEE THAT A COOKIE IS DEFINED
		if (kickAppsCookie === undefined) {
		
			// LOG THE LACK OF A COOKIE;
			debug("No kick apps cookie currently exists for this user");
		
		} else {
		
			// A KICK APPS COOKIE EXISTS
			if(kickAppsCookie === KICKAPPS_CONSTANTS.getValue("COOKIE_STATE_LOGGING_IN") ) {
			
				attemptSingleSignon();
			
			}
		}	
	}

	/** Return the public methods */
	return publicMethods;

}());
		
			
			









(function( $ ){
    var methods = {
        init : function(options) {
            // Default settings
			var settings = {
				"videoComponent"    : "Video Player Component", // Name of KA video player component (required)
				"videoUrl"          : false, // URL of video XML (required)
				"playlists"         : false, // Array of playlists (optional)
				"prerollUrl"        : false, // URL of RealMedia ad (optional)
				"omniture"          : false, // Name for Omniture tracking, friendly name (optional)
				"custom"            : false, // Optional objects for other components
				"debug"             : false // Turn on debug
			}
            
            // Override/combine variables with any that have been passed
			if (options) { $.extend(settings, options); }
	               
			// Debug console logging, local to plugin only
			debug = function(str) {
				if (settings.debug) {
					var s = new String(str); s = s+"<br />"; $("#video-plugin-debug").append(s);
				} 
			}
			
			isExternalUrl = function(str) {
				var isExternal    = str.indexOf("http");
				
				if (isExternal < 0) {
	            			isExternal = str.indexOf("rtmp");
	            		}
			
				debug("isExternalUrl: "+isExternal);
			
				return(isExternal);
			}	
		
			
            
            // Handling of targeted element
            return this.each(function() { 
            	var $this = $(this); // $this contains the element you called the plugin on and has all JQ functions

            	

				// Add debug DIV if turned on
				if (settings.debug) {
					$this.append('<pre id="video-plugin-debug" style="position:absolute;top:0;left:0;background-color:#ffc;z-index:99;"></pre>');
					$("#video-plugin-debug").click(function() { $("#video-plugin-debug").html(""); });
					debug("---- DEBUG CONSOLE IS ON");
				}
				
				// Get OBJECT element and get ID for later use
				var widgetId = $this.find("object").attr("id");
				debug("Widget ID: "+widgetId);
				
				// Check browser to handle doc object accordingly.
				var s_browserAgent = navigator.userAgent;
				if ((s_browserAgent.indexOf("Chrome") > 0) || (s_browserAgent.indexOf("Safari") > 0) || (s_browserAgent.indexOf("MSIE") > 0)) {
					o_player  = window[widgetId];
				} else {
					o_player  = document[widgetId];
				}				
						
				// Set video XML on player and playlist, overwrites any baked into object
				
				if (settings.videoUrl) {
					if (isExternalUrl(settings.videoUrl) < 0) {
						settings.videoUrl = "http://www.bluejacketsxtra.com"+settings.videoUrl;
					}
					
					o_player.setComponentProperty(settings.videoComponent, "mediaURL", settings.videoUrl);

					debug("videoComponent: "+settings.videoComponent);
					debug("videoURL: "+settings.videoUrl);					
					
					// Only process playlists if exists, overwrites any baked into object
					if (settings.playlists) {
						debug("Number of playlists: "+settings.playlists.length);
						for (i=0; i < settings.playlists.length; i++) {
							var s_playlistComponent =  settings.playlists[i]["componentName"];
							var s_playlistFeedUrl   =  settings.playlists[i]["feedUrl"];
							
							if (isExternalUrl(s_playlistFeedUrl) < 0) {
					        		s_playlistFeedUrl = "http://www.bluejacketsxtra.com"+s_playlistFeedUrl;
							}
					            	
							debug("playlistComponent "+i+": "+s_playlistComponent);
					        	debug("playlistUrl "+i+": "+s_playlistFeedUrl);					            	
					            	
					        	o_player.setComponentProperty(s_playlistComponent, "mediaURL", s_playlistFeedUrl);
						
						} // END playlist loop
					}
				}
				
				// Omniture settings, overwrites in-widget settings
				if (settings.omniture) {
					debug ("Omniture tracking is ON");
				
					for (var propertyName in settings.omniture) {
						if (settings.omniture.hasOwnProperty(propertyName)) {
							var omnitureProperty      = propertyName;
							var omniturePropertyValue = settings.omniture[propertyName];
							
							o_player.setComponentProperty("AppContainer", omnitureProperty, omniturePropertyValue);
							
							debug ("Setting: "+omnitureProperty+" = "+omniturePropertyValue);
						}
					}					
				} else {
					debug ("Omniture tracking is OFF");
				}			
					
				
				// Set preroll URL if exists, overwrites any baked into object
				if (settings.prerollUrl) {
					debug("prerollUrl: "+settings.prerollUrl);
					
					o_player.setComponentProperty(settings.videoComponent, "twentyFourSevenAdTag", settings.prerollUrl);
				}
				
				// Set custom component values if specified
				if (settings.custom) {
					debug ("Custom components found");
					
					for (i=0; i < settings.custom.length; i++) {
						var o_custom = settings.custom[i];
						
						if (o_custom["componentName"] && o_custom["propertyName"] && o_custom["value"]) {
							o_player.setComponentProperty(o_custom["componentName"], o_custom["propertyName"], o_custom["value"]);
							
							debug (i+": componentName: "+o_custom["componentName"]);
							debug (i+": propertyName: "+o_custom["propertyName"]);
							debug (i+": value: "+o_custom["value"]);							
						}
					}
				}				

            }); // End each()
            
        }   // END init()

    }; // END methods

    // Plugin namespace and attachment
    $.fn.kickappsVideo = function( method ) {
            if ( methods[method] ) {
                    return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
            } else if ( typeof method === 'object' || ! method ) {
                    return methods.init.apply( this, arguments );
            } else {
                    $.error( 'Method ' +  method + ' does not exist on jQuery.kickappsVideo ' );
            }    

    };
})(jQuery);
		
			
			/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.5.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.5
 * @date April 11, 2008
 * @category jQuery plugin
 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
 * @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.2N.3g=6(4){4=23.2H({2B:\'#34\',2g:0.8,1d:F,1M:\'18/5-33-Y.16\',1v:\'18/5-1u-2Q.16\',1E:\'18/5-1u-2L.16\',1W:\'18/5-1u-2I.16\',19:\'18/5-2F.16\',1f:10,2A:3d,2s:\'1j\',2o:\'32\',2j:\'c\',2f:\'p\',2d:\'n\',h:[],9:0},4);f I=N;6 20(){1X(N,I);u F}6 1X(1e,I){$(\'1U, 1S, 1R\').l({\'1Q\':\'2E\'});1O();4.h.B=0;4.9=0;7(I.B==1){4.h.1J(v 1m(1e.17(\'J\'),1e.17(\'2v\')))}j{36(f i=0;i<I.B;i++){4.h.1J(v 1m(I[i].17(\'J\'),I[i].17(\'2v\')))}}2n(4.h[4.9][0]!=1e.17(\'J\')){4.9++}D()}6 1O(){$(\'m\').31(\'<e g="q-13"></e><e g="q-5"><e g="5-s-b-w"><e g="5-s-b"><1w g="5-b"><e 2V="" g="5-k"><a J="#" g="5-k-V"></a><a J="#" g="5-k-X"></a></e><e g="5-Y"><a J="#" g="5-Y-29"><1w W="\'+4.1M+\'"></a></e></e></e><e g="5-s-b-T-w"><e g="5-s-b-T"><e g="5-b-A"><1i g="5-b-A-1t"></1i><1i g="5-b-A-1g"></1i></e><e g="5-1s"><a J="#" g="5-1s-22"><1w W="\'+4.1W+\'"></a></e></e></e></e>\');f z=1D();$(\'#q-13\').l({2K:4.2B,2J:4.2g,S:z[0],P:z[1]}).1V();f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]}).E();$(\'#q-13,#q-5\').C(6(){1a()});$(\'#5-Y-29,#5-1s-22\').C(6(){1a();u F});$(G).2G(6(){f z=1D();$(\'#q-13\').l({S:z[0],P:z[1]});f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]})})}6 D(){$(\'#5-Y\').E();7(4.1d){$(\'#5-b,#5-s-b-T-w,#5-b-A-1g\').1b()}j{$(\'#5-b,#5-k,#5-k-V,#5-k-X,#5-s-b-T-w,#5-b-A-1g\').1b()}f Q=v 1j();Q.1P=6(){$(\'#5-b\').2D(\'W\',4.h[4.9][0]);1N(Q.S,Q.P);Q.1P=6(){}};Q.W=4.h[4.9][0]};6 1N(1o,1r){f 1L=$(\'#5-s-b-w\').S();f 1K=$(\'#5-s-b-w\').P();f 1n=(1o+(4.1f*2));f 1y=(1r+(4.1f*2));f 1I=1L-1n;f 2z=1K-1y;$(\'#5-s-b-w\').3f({S:1n,P:1y},4.2A,6(){2y()});7((1I==0)&&(2z==0)){7($.3e.3c){1H(3b)}j{1H(3a)}}$(\'#5-s-b-T-w\').l({S:1o});$(\'#5-k-V,#5-k-X\').l({P:1r+(4.1f*2)})};6 2y(){$(\'#5-Y\').1b();$(\'#5-b\').1V(6(){2u();2t()});2r()};6 2u(){$(\'#5-s-b-T-w\').38(\'35\');$(\'#5-b-A-1t\').1b();7(4.h[4.9][1]){$(\'#5-b-A-1t\').2p(4.h[4.9][1]).E()}7(4.h.B>1){$(\'#5-b-A-1g\').2p(4.2s+\' \'+(4.9+1)+\' \'+4.2o+\' \'+4.h.B).E()}}6 2t(){$(\'#5-k\').E();$(\'#5-k-V,#5-k-X\').l({\'K\':\'1C M(\'+4.19+\') L-O\'});7(4.9!=0){7(4.1d){$(\'#5-k-V\').l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9-1;D();u F})}j{$(\'#5-k-V\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9-1;D();u F})}}7(4.9!=(4.h.B-1)){7(4.1d){$(\'#5-k-X\').l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9+1;D();u F})}j{$(\'#5-k-X\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9+1;D();u F})}}2k()}6 2k(){$(d).30(6(12){2i(12)})}6 1G(){$(d).11()}6 2i(12){7(12==2h){U=2Z.2e;1x=27}j{U=12.2e;1x=12.2Y}14=2X.2W(U).2U();7((14==4.2j)||(14==\'x\')||(U==1x)){1a()}7((14==4.2f)||(U==37)){7(4.9!=0){4.9=4.9-1;D();1G()}}7((14==4.2d)||(U==39)){7(4.9!=(4.h.B-1)){4.9=4.9+1;D();1G()}}}6 2r(){7((4.h.B-1)>4.9){2c=v 1j();2c.W=4.h[4.9+1][0]}7(4.9>0){2b=v 1j();2b.W=4.h[4.9-1][0]}}6 1a(){$(\'#q-5\').2a();$(\'#q-13\').2T(6(){$(\'#q-13\').2a()});$(\'1U, 1S, 1R\').l({\'1Q\':\'2S\'})}6 1D(){f o,r;7(G.1h&&G.28){o=G.26+G.2R;r=G.1h+G.28}j 7(d.m.25>d.m.24){o=d.m.2P;r=d.m.25}j{o=d.m.2O;r=d.m.24}f y,H;7(Z.1h){7(d.t.1l){y=d.t.1l}j{y=Z.26}H=Z.1h}j 7(d.t&&d.t.1A){y=d.t.1l;H=d.t.1A}j 7(d.m){y=d.m.1l;H=d.m.1A}7(r<H){1z=H}j{1z=r}7(o<y){1B=o}j{1B=y}21=v 1m(1B,1z,y,H);u 21};6 1p(){f o,r;7(Z.1Z){r=Z.1Z;o=Z.2M}j 7(d.t&&d.t.1F){r=d.t.1F;o=d.t.1Y}j 7(d.m){r=d.m.1F;o=d.m.1Y}2q=v 1m(o,r);u 2q};6 1H(2C){f 2x=v 2w();1q=2h;3h{f 1q=v 2w()}2n(1q-2x<2C)};u N.11(\'C\').C(20)}})(23);',62,204,'||||settings|lightbox|function|if||activeImage||image||document|div|var|id|imageArray||else|nav|css|body||xScroll||jquery|yScroll|container|documentElement|return|new|box||windowWidth|arrPageSizes|details|length|click|_set_image_to_view|show|false|window|windowHeight|jQueryMatchedObj|href|background|no|url|this|repeat|height|objImagePreloader|arrPageScroll|width|data|keycode|btnPrev|src|btnNext|loading|self||unbind|objEvent|overlay|key||gif|getAttribute|images|imageBlank|_finish|hide|left|fixedNavigation|objClicked|containerBorderSize|currentNumber|innerHeight|span|Image|bind|clientWidth|Array|intWidth|intImageWidth|___getPageScroll|curDate|intImageHeight|secNav|caption|btn|imageBtnPrev|img|escapeKey|intHeight|pageHeight|clientHeight|pageWidth|transparent|___getPageSize|imageBtnNext|scrollTop|_disable_keyboard_navigation|___pause|intDiffW|push|intCurrentHeight|intCurrentWidth|imageLoading|_resize_container_image_box|_set_interface|onload|visibility|select|object|top|embed|fadeIn|imageBtnClose|_start|scrollLeft|pageYOffset|_initialize|arrayPageSize|btnClose|jQuery|offsetHeight|scrollHeight|innerWidth||scrollMaxY|link|remove|objPrev|objNext|keyToNext|keyCode|keyToPrev|overlayOpacity|null|_keyboard_action|keyToClose|_enable_keyboard_navigation|right|hover|while|txtOf|html|arrayPageScroll|_preload_neighbor_images|txtImage|_set_navigation|_show_image_data|title|Date|date|_show_image|intDiffH|containerResizeSpeed|overlayBgColor|ms|attr|hidden|blank|resize|extend|close|opacity|backgroundColor|next|pageXOffset|fn|offsetWidth|scrollWidth|prev|scrollMaxX|visible|fadeOut|toLowerCase|style|fromCharCode|String|DOM_VK_ESCAPE|event|keydown|append|of|ico|000|fast|for||slideDown||100|250|msie|400|browser|animate|lightBox|do'.split('|'),0,{}));
		
			
			









var videoplayer = {
	debug:function(str) {
		if (this.b_debug) { console.log(str); }
	},
	
	// doc ready call, fires ONCE
	ready:function(debugOn) {
		this.settings;
		this.o_videoPlayer;
		this.o_videoPlaylist;
		this.o_galleryPlaylist;

		this.b_debug            = debugOn;
		this.s_galleryCategory  = this.settings["default-playlist"];
		this.s_videoCategory    = this.s_galleryCategory;
		
		
		// Default player to load is normal clip player (false)
		var s_loadPlayerType = false;
		
		// Check modifier to pre-load a different video player. s_modifier is a global var set on the page.
		switch (s_modifier) {
			case "streaming-live":
				s_loadPlayerType = "live";
				$("#gallery-menu li").removeClass("current");
				$("#gallery-menu .breaking-news-tab li").addClass("current");
				break;
				
			case "streaming-newscast":
				s_loadPlayerType = "newscast";
				$("#gallery-menu li").removeClass("current");
				$("#gallery-menu li.newscast").addClass("current");
				break;
				
			case "streaming-radar":
				s_loadPlayerType = "radar";
				$("#gallery-menu li").removeClass("current");
				$("#gallery-menu li.radar").addClass("current");
				break;
		
		}

		// Get playlist and load appropriate player
		this.getPlaylist(this.settings["default-playlist"], {
			"showGallery" : true,
			"setAsCurrent": true,
			"loadPlayer"  : true,
			"loadPlayerType" : s_loadPlayerType
		});
		
		
		// Bind category menu
		$("#gallery-menu li a").click(function() {
			var aObj    = $(this);
			var liObj   = aObj.parent();
			var aRel    = aObj.attr("rel");						
			
			if (aRel) {
				$("#gallery-menu li").removeClass("current");
				liObj.addClass("current");			
			
				videoplayer.s_galleryCategory = aRel;
				videoplayer.getPlaylist(videoplayer.s_galleryCategory, {"showGallery":true});
			}
		});			
	},



	// Retreive player Flash object and drop into element
	loadPlayer:function(type) {
		this.debug("----- loadPlayer");
		
		// Default player type is always normal clip player
		var playerPath = "/content/digital/video/620-video-page-player.html";
		
		// Handle different player types
		switch(type) {
			case "radar"    : playerPath = "/content/digital/video/streaming-radar.html"; break;
			case "live"     : playerPath = "/content/digital/video/streaming-live.html"; break;
			case "newscast" : playerPath = "/content/digital/video/streaming-newscast.html"; break;			
		}
	
		// Grab HTML through callback
		$.ajax({
			url: playerPath,
			dataType:"html",
			jsonp: null,
            		jsonpCallback: null,
			success: function(data){ $("#"+videoplayer.settings["player-container"]).html(data); }		
		});
	},
	
	
	
	// Triggered by Flash loading callback. This fires when the widget reaches onload
	playerLoaded:function() {
		this.debug("----- playerLoaded");
		var s_playerElementId = $("#"+this.settings["player-container"]+" object").attr("id");
		
		this.debug(s_playerElementId);
		
		// Check browser to handle doc object accordingly.
		var s_browserAgent = navigator.userAgent;
		if ((s_browserAgent.indexOf("Chrome") > 0) || (s_browserAgent.indexOf("Safari") > 0) || (s_browserAgent.indexOf("MSIE") > 0)) {
		     this.o_videoPlayer  = window[s_playerElementId];
		} else {
		     this.o_videoPlayer  = document[s_playerElementId];
		} 

		this.loadVideo(this.i_loadVideoPos, this.b_autoplay);
	},	
	
	
	
	
	// Loads video list as JSON playlist object + builds matching HTML thumbnail gallery
	// Expects string of playlist name
	getPlaylist:function(id, args) {
		this.debug("----- getPlaylist");
		
		var s_listUrl = this.settings[id]["list"];
		
		this.debug(s_listUrl);
		
		$.ajax({
			url: "/content/digital/video/getplaylist.html?list="+s_listUrl,
			dataType:"json",
			jsonp: null,
            		jsonpCallback: null,
			success: function(data){ 
				if (data) {
					videoplayer.o_galleryPlaylist = data;
					videoplayer.o_galleryPlaylist["playlist"].pop(); // Pop array to remove empty playlist item
					
					if (args["showGallery"]) {
						videoplayer.buildHtmlGallery("video-gallery");
					}
					
					if (args["setAsCurrent"]) {
						videoplayer.o_videoPlaylist = videoplayer.o_galleryPlaylist;
						videoplayer.s_videoCategory = videoplayer.s_galleryCategory;
					}
					
					if (args["loadPlayer"]) {
						videoplayer.loadPlayer(args["loadPlayerType"]);
					}
				}
			}		
		});		
	},
	
	// Applies preroll change to active main player
	// Used by changePreroll() only
	setPreroll:function(prerollUrl) {
		if (!prerollUrl) {
			prerollUrl = this.settings[this.s_videoCategory]["preroll"];
		}

		this.o_videoPlayer.setComponentProperty("Video Player Component", "twentyFourSevenAdTag", prerollUrl);
	},	
	
	
	
	// Send video to player
	loadVideo:function(index, auto) {
		this.debug("----- loadVideo");
	
		if (!index) { index = 0; }
		this.i_loadVideoPos = index;
		
		
		// When normal video player is available and loaded
		if (this.o_videoPlayer) {
		
			// If there parameter passed video to watch, load it and autoplay; otherwise go default settings
			if (this.watchVideoUrl) {
				// single redtail video requested
				var auto           = true;
				var thisVideoUrl   = "http://www.bluejacketsxtra.com"+this.watchVideoUrl;
				this.watchVideoUrl = false;			
				
				this.setPreroll(this.settings["autoPrerollUrl"]);
			} else if (this.kickAppsHostedId){
				// Legacy video from KA hosted environment requested
				this.o_videoPlayer.setComponentProperty("Video Player Component", "mediaType_mediaId", "video_" + this.kickAppsHostedId);
				this.setPreroll();
			} else {
				// No video specified - load playlist
				var thisVideoUrl = "http://www.bluejacketsxtra.com"+this.o_videoPlaylist["playlist"][index]["media"];
				this.setPreroll();	
			}
			
			// Sets autoplay on player
			if (auto) {
				this.o_videoPlayer.setComponentProperty("Video Player Component", "autoPlay", true);
				this.o_videoPlayer.setComponentProperty("Video Player Component", "playOnLoad", true);
			}		
			
			// Changes URL of media on player
			this.debug(thisVideoUrl);
			this.o_videoPlayer.setComponentProperty("Video Player Component", "mediaURL", thisVideoUrl);
			this.setNextVideoTitle(index);
		} else {
			// When switching to clip, automatically autoplay
			this.b_autoplay = true;
		
			// Must switch to normal player from streaming player
			this.o_videoPlaylist = this.o_galleryPlaylist;
			this.s_videoCategory = this.s_galleryCategory;
			
			this.loadPlayer();
		}
	},
	
	
	
	// Sets text in Flash player that displays title of next video after current video ends
	setNextVideoTitle:function(pos) {
		this.debug("----- setNextVideoTitle");
		this.debug(pos);
		
		pos = parseInt(pos);
		var nextPos = (pos + 1);
		
		if (nextPos >= this.o_videoPlaylist["playlist"]["size"]) { nextPos = 0; }
		
		this.i_nextVideoPos = nextPos;

		this.debug(this.o_videoPlaylist["playlist"][nextPos]["title"]);
		this.o_videoPlayer.setComponentProperty("varNextTitle", "text", this.o_videoPlaylist["playlist"][nextPos]["title"]);
	},
	
	// Load clip from gallery
	galleryVideo:function(pos) {
		this.debug("----- galleryVideo:function");
		this.debug(pos);
	
		this.o_videoPlaylist = this.o_galleryPlaylist;
		this.s_videoCategory = this.s_galleryCategory;			

		this.loadVideo(pos, true);
	
	},		
	
	// Non-clip player handling. Sets o_videoPlayer object to false for checking later.
	radar:function() {
		this.o_videoPlayer = false;
		this.loadPlayer('radar');
		return false;
	},
	
	live:function() {
		this.o_videoPlayer = false;
		this.loadPlayer('live');
		return false;
	},
	
	newscast:function() {
		this.o_videoPlayer = false;
		this.loadPlayer('newscast');
		return false;
	},
	
	// Builds HTML thumbnail gallery that controls playlist browsing
	buildHtmlGallery:function(elementId) {
	
		var galleryColumn = '<div class="column-2 video-item"><a onclick="videoplayer.galleryVideo(\'{{= pos}}\');return false;" class="img"><img src="{{= image}}" alt="" class="video-item-img" /><strong>{{= title}}</strong></a></div>';
		$.template("galleryColumn", galleryColumn);
		$("#"+elementId).html($.tmpl("galleryColumn", this.o_galleryPlaylist["playlist"]));
		
		// Dispatch Video Page Specifics
		var dCount = videoplayer.o_galleryPlaylist.size;
		var dCCount = 0;
		
		if (dCount <= 9) { $('.column-2.video-item').wrapAll('<div id="no-video-carousel" />'); }
		
		if (dCount > 9) {
		
			$('.column-2.video-item').wrapAll('<ul class="video-carousel" />');			
			$('.video-carousel').wrapChildren({ childElem : 'div' , groupSize: 9, wrapper : '<li class="video-carousel-item">'});			
			
			// Carousel Functionality
			$('#video-gallery').dSlides({			
				transitionMove : 'group',
				transitionStyle : 'slide',
				transitionStart : 'click'
			}); 
			
		}
	}		
};
		
			
			

$(document).ready(function(){
// Javascript for Comments
	var profile = "/digital/config/commentprofile.html";
			
	ccount = $.fn.dcomments('getCommentCount', {'resourceid' : cms_resourceId});
	$('#view-comments').text(ccount);
	
	if (typeof cms_comments_disabled=="undefined") {
	 cms_comments_disabled = "false";
	}
	
	if (cms_comments_disabled == "true") {
	 $('#comment-header').hide();
	}
	
	$("#comment-wrapper").dcomments({
	    'profile':profile, 
	    'resourceid':cms_resourceId,
	    'disabled' : cms_comments_disabled,
	    'formPosition':'top',
	    'recaptcha': false
	});
	
	// Lightbox Functionality
	$("a[rel='lightbox']").lightBox({
		'imageLoading' : '/content/system/shared/img/lightbox/lightbox-ico-loading.gif',
		'imageBtnClose' : '/content/system/shared/img/lightbox/lightbox-btn-close.gif',
		'imageBtnPrev' : '/content/system/shared/img/lightbox/lightbox-btn-prev.gif',
		'imageBtnNext' : '/content/system/shared/img/lightbox/lightbox-btn-next.gif'
	});
	
	// Kickapps SSO NEVER EVER DELETE OR YOU WILL BE STRUCK BY LIGHTNING
	KickAppsManager.start(137243);
	/*****************************************/

	$register = $('#register');
	var loginLink = "/content/system/modules/com.dispatch.registration/pages/login.jsp?sendback="+window.location;
	var logoutLink = "/content/system/modules/com.dispatch.registration/pages/logout.jsp?sendback="+window.location;
	var editProfileLink = "/content/system/modules/com.dispatch.registration/pages/edit-profile.jsp?sendback="+window.location;
	
	
	// User state for tip top toolbar
	var profiledata = $.fn.daccount("getValues"); // Assigns the entire REST object to the profiledata variable.
		
	if ($.fn.daccount("isGuest")) {} else {
		$register.html('<p class="welcome-login">Welcome '+profiledata.firstname+'</p>');
		$register.append('<a id="edit-profile-link" class="registration-links" href="'+editProfileLink+'">Edit Profile</a>');
		$register.append('<a id="logout-link" class="registration-links" href="'+logoutLink+'">Not '+profiledata.login+'? Logout</a>');
	}

});
		
	

