﻿/*********************************************************************************************  

jQuery: 		Embedded Content
Filename:		embeddedContent.js
Description: 	This jQuery file utilizes SPService.js to read a list contained in a site called
				'Embedded Content'.  What ever is put inside of an item in this list will be rendered on every page.
				This is useful for loading javascript or jquery into every page on a site.
								
Author: 		Drew Frisk
Version:		v1.0
Created:		6.08.2011
Last Update: 	8.29.2011


******************************************************************************************/


$( document ).ready( function() {
	// make SPServices ajax call to the "Embedded Content" List
	$().SPServices( {
		operation: "GetListItems",
		async: false,
		listName: "Embedded Content",
		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 "Embedded Content" and add that data to the
				// #embeddedcontent div in the master page
				$( "#embeddedcontent" ).append( $(this).attr( "ows_Embedded_x0020_Content" ) );
			} ); 		
		}
	} );
} );

