﻿/*********************************************************************************************  

jQuery: 		Dynamic Footer Content
Filename:		dynamicFooter.js
Description: 	This jQuery file utilizes SPService.js to read a list contained in each site
				called 'Footer'.  On page load it will make an ajax call to the list and look
				for the column value of the first item contained for the column "Footer-Content".
				This column holds the information for each sites footer inside of an 
				'Enhanced Rich Text Field'.  It will then populate the div #footerConent with
				the information contained in that field.
								
Author: 		Drew Frisk
Version:		v1.0
Created:		4.26.2011
Last Update: 	8.29.2011


******************************************************************************************/


$( document ).ready( function() {
	// make SPServices ajax call to the "Footer" List
	$().SPServices( {
		operation: "GetListItems",
		async: false,
		listName: "Footer",
		completefunc: function ( xData, Status ) { 
			// enumerate through each row in the list
			$(xData.responseXML).find( "[nodeName='z:row']" ).each( function() {
				// query the row for the column called "Footer Content" and add that data to the
				// #footerContent div in the master page
				$( "#footerContent" ).append( $(this).attr( "ows_Footer_x002d_Content" ) );
			}); 
		
		}
	});
});

