
<div id="templateTwitterMain" class="mainPanel cssTwitterMainPanel cssServiceProviderMainPanel">
	<div class="cssMainHeadding jsMainHeadding">
		<div class="cssLeft">
			<span>Twitter</span>
		</div>
		<div class="cssTopRight">
			<a class="genericButton jsButtonNewPost" href="#"><span class="stronglastword"><?php echo $this->translate('New Post') ?></span></a>
		</div>
	</div>

	<div class="cssMainBody">
		<div class="cssSummaryPanel jsSummaryPanel">
			<form class="cssSummarySearch jsListMarker jsSearchForm">
				<div class="cssSummarySearchTop jsSummarySearchTop">
					<div class="cssSearchButton">
					<input type="hidden" class="pid" name="pid" value="" />
					<input type="hidden" class="folder" name="folder" value="" />
					<div class="cssSummarySearchInput"><input name="q" class="q" value="<?php echo $this->translate('Search') ?>" /></div>
					</div>
				</div>
				<div class="cssNoMessagesToDisplay jsSummaryRowNoMessages" mid="" style="display:none;"><?php echo $this->translate("No messages.") ?></div>
				<div class="cssNoMessagesToDisplay jsSummaryRowNoSearchResults" mid="" style="display:none;"><?php echo $this->translate("No search results. Try again.") ?></div>
				<!-- list Nodes get appended here -->
				<div class="jsFacebookListTopMarker"></div>
			</form>
		</div>

		<div class="cssMainDetailsPanel cssMainDetailsPanel jsMainDetailsPanel">
			<div class="messageThreads">
				<!-- thread messageNodes go here -->

			</div> <!-- End messageThreads -->
		</div> <!-- End cssMainDetailsPanel -->
	</div> <!-- End cssMainBody -->
</div> <!-- End template -->


<div id="templateTwitterListNodeGeneric" class="cssSummaryRow selected jsSummaryRow oldCssFollows messageRow mail_row read facebookSummaryRow" mid="PLACEHOLDER message id" from="PLACEHOLDER sender name">
	<div class="date dateFormat1"></div>
	<div class="photo mailPhoto">
		<span class="left facebookPhotoLeft" title="" style="background: url('') !important;" todo="row.user.profile_image_url"></span>
	</div>
	<div class="messageFrom mailFrom">
		<h3 title="PLACEHOLDER sender name goes here">PLACEHOLDER sender name goes here</h3>
	</div>
	<div class="messagePreview">PLACEHOLDER Thread preview goes here row.text</div>
</div>

<div id="templateTwitterMessageThreadNode" class="cssMessageNode jsMessageNode" serviceType="" serviceName="" pid="" mid=""> <!-- single thread messageNode -->
	<div class="wrapperOuter">
		<div class="wrapperInner">
			<div class="details">
				<div class="detailLeft">
					<span class="photoLarge floatLeft" title="PLACEHOLDER from name" style="background: url('') !important;"></span>
					<h1>PLACEHOLDER From name</h1>
					<h2 class="date"></h2>
				</div><!-- End fbmeta -->
			</div><!-- End details -->

			<div class="body">
				<p>TDP message goes here</p>
			</div>
			<div class="applicationName"></div>
			<div class="commentsContainer">
				<ol class="comments">
					<!-- comment nodes get appended here -->

					<li class="commentGreyCompose">
						<div class="greyCommentTop"></div>
						<div class="greyCommentBody">
							<a href="#" class="genericButton postMessageButton jsCommentButtonSend" pid=""><span><?php echo $this->translate('Send') ?></span></a>
							<div class="whiteCommentAreaTop"></div>
							<div class="whiteCommentAreaBody commentArea">
								<input name="reply" class="replyComment" style="border:0;width:100%;"/>
								<input type='hidden' name='oid' value=""/>
							</div>
							<div class="whiteCommentAreaBottom"></div>
							<div class="greyCommentBottom"></div>
						</div>
					</li>
				</ol>

			</div> <!-- End commentsContainer-->
		</div> <!-- End wrapperInner -->
	</div><!-- End wrapperOuter -->
</div> <!-- End messageNode -->

<ol>
	<li id="templateTwitterCommentTemplateNodeMe" class="commentGrey" pid="" oid="">
		<div class="greyCommentTop"></div>
		<div class="greyCommentBody">
			<div class="image"><span class="photo" title=""></span></div>
			<div class="whiteCommentAreaTop"></div>
			<div class="whiteCommentAreaBody commentArea">
				<div class="commentBody"></div>
			</div>
			<div class="whiteCommentAreaBottom"></div>
			<div class="applicationName"></div>
			<abbr class="tstamp" title=""></abbr>
			<div class="greyCommentBottom"></div>
		</div>
	</li>

	<li id="templateTwitterCommentTemplateNodeThem" class="commentBlue" pid="PLACEHOLDER pid" oid="PLACEHOLDER oid">
		<div class="blueCommentTopMeta">

		</div>
		<div class="blueCommentTop"></div>
		<div class="blueCommentBody">
			<div class="image"><span class="photo" title=""></span></div>
			<div class="whiteCommentAreaTop"></div>
			<div class="whiteCommentAreaBody commentArea">
				<div class="commentBody"></div>
			</div>
			<div class="whiteCommentAreaBottom"></div>
			<div class="applicationName"></div>
			<abbr class="tstamp" title=""></abbr>
			<div class="blueCommentBottom"></div>
		</div>
	</li>
</ol>

<script language='Javascript'>
	//List bindings
	$(function() {

		$.templateEngine.templates.SocialNetwork.Twitter = {
			render : function($contextMain, dataPacket) {

				var thisTemplate = this

				if( dataPacket.serviceType == undefined )
					dataPacket.serviceType = "SocialNetwork"
				if( dataPacket.serviceName == undefined )
					dataPacket.serviceName = "Twitter"
				//if the context already has the fb template in it then update instead.
				if( $('.jsListMarker', $contextMain).length != 0 && $('.mainPanel', $contextMain).attr('servicetype') == dataPacket.serviceType && $('.mainPanel', $contextMain).attr('servicename') == dataPacket.serviceName )
				{

					//call update on message list BUT make sure new folder/filter is changed, else boom //TODO: upgrade so that can have e.g. search results list from different folders (each item needs its own optional folder param)
					//if folder/filter is changing then empty bodyPanel
					if( dataPacket.folder != $('.mainPanel', $contextMain).attr('folder') )
						$('.messageThreads', $contextMain).empty()

					$('.mainPanel', $contextMain).attr('folder', dataPacket.folder )
					this.update($contextMain, dataPacket)
					return

				}

				//getData from known data structure
				dataNode = dataPacket.localDataNode

				$mainTwitter = $('#templateTwitterMain').clone().removeAttr('id')
				$mainTwitter.attr('servicetype', dataPacket.serviceType )
				$mainTwitter.attr('servicename', dataPacket.serviceName )
				$mainTwitter.attr('folder', dataPacket.folder )
				$contextMain.html( $mainTwitter )

				//TODO insert the no messages template chunk if no messages
				//traverse response data copying template parts in as required
				$.each( dataNode.serviceData, function( index, thread) {

					$(".jsSummaryPanel .jsListMarker", $contextMain).pushTwitterSummaryRow(dataPacket.pid, thread, false)

				})

				//N.B. currently can only have one FB account therefore not in a tab and therefore not context aware
				//CONSIDER upgrading to allow multiple accounts/tabs
				enableMailActions(); //TODO make more inteligent (split for each template) - not all piled into one mail.js

				if( dataPacket.localDataNode.serviceData != undefined && dataPacket.localDataNode.serviceData.length > 0)
				{

					var pid = dataPacket.pid
					var folder = dataPacket.folder
					var mid = dataPacket.localDataNode.serviceData[0].id
					this.renderThreadAction($contextMain, pid, folder, mid)
					//we do this instead of triggering a click on the first item because might still be animate-removing prev items and we odont want to wind up loading pref first item again

				}

				$('.jsButtonNewPost', $contextMain).attr('pid', dataPacket.pid )
				$('.jsButtonNewPost', $contextMain).attr('myid', dataPacket.myId || "unknown" )
				$('.jsButtonNewPost', $contextMain).bind('click', function() {

					$newPost = $(".comments", '#templateTwitterMessageThreadNode').clone().removeAttr('id')
					$(".jsCommentButtonSend", $newPost).attr('pid', $(this).attr('pid'))
					$(".jsCommentButtonSend", $newPost).attr('myid', $(this).attr('myid'))
					$(".jsCommentButtonSend", $newPost).attr('oid', $(this).attr('myid'))
					$(".jsMainDetailsPanel .messageThreads", $contextMain).html( $newPost )
					$('.textareaAutoResize', $contextMain).autoResize( { animateDuration : 300, extraSpace : 0 } )
					$('.textareaAutoResize', $contextMain).val('@')

					//bindings
					$.templateEngine.templates.SocialNetwork.Twitter.applyPostCommentButtonBinding($contextMain)

				})


				$(".jsSearchForm", $contextMain).submit( function()
				{

					//TODO: trigger keyup again if necessary to do async search against server/full dataset
					return false

				})
				$(".jsSearchForm .q", $contextMain).unbind('click').bind('click', function() {

					if( $(this).attr('value') == '<?php echo $this->translate("Search") ?>' )
						$(this).select();

				});

				$(".jsSearchForm .q", $contextMain).unbind('blur').bind('blur', function() {

					if( $(this).attr('value') == '' )
						$(this).attr('value', '<?php echo $this->translate("Search") ?>')

				});


				$(".jsSearchForm .q", $contextMain).unbind('keyup').bind('keyup', function()
				{

					thisTemplate.searchList( $contextMain, $(this).attr('value'))

				})


				//call render complete callback (overloadable by main application as an event hook)
				//CONSIDER rather triggering a custom event so that other objects can bind to the event instead
				this.renderCompleteCallback()
			},
			update : function($contextMain, dataPacket) {

				var UIOIDs = []
				$('.jsSummaryRow', $contextMain).each( function() { UIOIDs[UIOIDs.length] = $(this).attr('mid') })

				//CONSIDER: remove bodypanel if related list item dissapears
				if( dataPacket.localDataNode == undefined || dataPacket.localDataNode.serviceData == undefined )
				{
					$(".jsSummaryPanel .jsListMarker", $contextMain).pushTwitterSummaryRow(dataPacket.pid, null, false) //CONSIDER: leave blank if local data is empty, only push no items message after attempting to update from the server
					//remove mainBodyPanel as well
					$('.messageThreads', $contextMain).empty()
				}
				else
				{

					var tmpCurrentContext = $contextMain
					//delete deleted rows out of ui
					$(UIOIDs).each( function(index1, UIOID) {

						//for each UI MID run through new dataPacket and continue if found or delete if not found
						var UIOIDFoundInServiceData = false
						$( dataPacket.localDataNode.serviceData).each( function(index, thread) {
							//if found then continue
							if( UIOID == thread.id )
								UIOIDFoundInServiceData = true
						})
						if( !UIOIDFoundInServiceData )
						{

							//$('.jsSummaryRow[mid="' + UIOID + '"]', $contextMain).slideUp("fast", function() { $(this).remove() })
							$('.jsSummaryRow[mid="' + UIOID + '"]', $contextMain).remove()
							$('.messageThreads .jsMessageNode[mid="'+ UIOID + '"]', $contextMain).remove()

						}

					})

					//quick fix to decide if new items should go on top = are there existing items in the list after culling
					if( $('.jsSummaryRow', $contextMain).length > 0 )
						prepend = true
					else
						prepend = false

					//push new rows in to ui - on top (must be new)
					$( dataPacket.localDataNode.serviceData).each( function(index1, thread) {

						//if not found in MUIDs then add it
						var threadIdFoundInUIOIDs = false
						$(UIOIDs).each( function(index, UIOID) {

							if( UIOID == thread.id )
							{
								threadIdFoundInUIOIDs = true
								return false //break
							}
						})
						if( !threadIdFoundInUIOIDs )
						{
							$(".jsSummaryPanel .jsListMarker", $contextMain).pushTwitterSummaryRow(dataPacket.pid, thread, prepend)//TODO: when paging (older) or new (newer) need to inteligently slot the nodes into timeline (last (true arg currently forces to prepend))
						}

					})
				}
				//CONSIDER: if none are selected at the end then select the top one - so that you dont wind up with an empty or stranded main body OR do we want the mast selected thread to remain on screen incase person was reading it (wouldnt want it to suddenly dissapear cos of an auto reload)
				//if main body empty then select first list item (N.B. for panels with no initial local data, this will be empty and hand off to callNewData so wont populate bodyPanel with anthing)
				if( $('.messageThreads', $contextMain).children().length == 0 && dataPacket.localDataNode.serviceData.length > 0 )
				{
					var pid = dataPacket.pid
					var folder = dataPacket.folder
					var mid = dataPacket.localDataNode.serviceData[0].id
					this.renderThreadAction($contextMain, pid, folder, mid)
				}

			},
			renderThreadNode : function($contextMain, dataPacket) {

				var dataNode = dataPacket.localDataNode
				var pid = dataPacket.pid
				var myId = dataPacket.myId || $.localData.dataStore["pid"+pid].myId || "unknown" || alert("myId not defined") //safe for stream when might have rows from different FB sources in one list

				$newNode = $('#templateTwitterMessageThreadNode').clone().removeAttr('id')
				$newNode.attr('servicetype', dataPacket.serviceType || "SocialNetwork" ) //TODO prepopulate this data if server didnt return (use called values - as irrelevant - server didnt need to change destination template)
				$newNode.attr('servicename', dataPacket.serviceName || "Twitter" ) //TODO prepopulate this data if server didnt return (use called values - as irrelevant - server didnt need to change destination template)
				$newNode.attr('pid', dataPacket.pid )
				$newNode.attr('mid', dataNode.id_str )
				$('.detailLeft .photoLarge', $newNode).attr("style", "background: url('" + dataNode.user.profile_image_url_https + "') !important;")
				$('.detailLeft .photoLarge', $newNode).attr("title", dataNode.user.description )
				$('.detailLeft h1', $newNode).html(dataNode.user.screen_name)
				$('.detailLeft h1', $newNode).attr('title', dataNode.user.location)

				d = new Date(dataNode.created_at) //Twitter dates are in the format: Tue Sep 13 01:35:50 +0000 2011
				$('.detailLeft h2', $newNode).attr('title',  d.toStringISO8601() ) //title used by timeago for calc, then html used as title in ui
				$('.detailLeft h2', $newNode).html( d.toString() ) //show title in users local time
				$('.detailLeft h2', $newNode).timeago()


				$('.body', $newNode).html( dataNode.text )
				$('.applicationName', $newNode).html( dataNode.source )

				//debug - render data packet to assist with putting all useful data into the template
				//$newNode.append( "<div style=\"clear:both;\"><pre>" + dumpObjectIndented(dataPacket) + "</pre></div>" )

				var $uiContext = $(".jsMainDetailsPanel .messageThreads", $contextMain).html( $newNode ) //CONSIDER: change this to an append instead of a replace
				$('.textareaAutoResize', $contextMain).val('@' + dataNode.user.screen_name + " ")
				$('.textareaAutoResize', $contextMain).autoResize( { animateDuration : 300, extraSpace : 0 } )

				//populate reply composer required fields
				$('.jsCommentButtonSend', $newNode).attr('pid', pid)
				$('.jsCommentButtonSend', $newNode).attr('myid', myId || "unknown")
				$('.jsCommentButtonSend', $newNode).attr('folder', "comments")
				$('.jsCommentButtonSend', $newNode).attr('oid', dataNode.id)

				this.applyPostCommentButtonBinding($contextMain)

				//call render complete callback (overloadable by main application as an event hook)
				//CONSIDER rather triggering a custom event so that other objects can bind to the event instead
				this.renderThreadNodeCompleteCallback()
			},
			applyPostCommentButtonBinding : function($contextMain) {

				$(".jsCommentButtonSend", $contextMain).bind('click', function()
				{


					//var _this = this
					var pid = $(this).attr("pid")
					var message = $("textarea[name=reply]",$contextMain).attr("value");
					var url = '<?php echo $this->appBaseUrl ?>/api/unify/post/forceNew/' + (new Date().getTime());
					;
					var row = { pid : pid, message : message }
					XHRCall = $.ajax({
						cache : false,
						url : url,
						data : row,
						success : function(data, textStatus)
						{
							//what about other data
							$('.comments .commentGreyCompose', $contextMain).pushTwitterCommentRow( pid, data )
							$('.comments .commentGreyCompose textarea', $contextMain).val('')

						},
						error : function(jqXHR, textStatus, errorThrown) {  },
						statusCode : { 404: function() {  } },
						timeoutNumber : 30000,
						type : "POST",
						dataType : "json"
					});

				})

				$("input.replyComment",$contextMain).bind('keydown', function(e)
				{

					if( e.which == 13 )
					{
						$(".jsCommentButtonSend", $contextMain).trigger('click');
						e.preventDefault();
					}

				})
			},
			searchList : function($context, searchTerm)
			{

				// Un-highlight previous selections
				$(".messageFrom > h3, .messageSubject > h3, .messagePreview", $context).each(function()
				{
					$(this).removeHighlight();
				})

				// Require more then 3 characters to perform the search
				if(searchTerm.length < 3)
				{
					$(".jsSummaryRow", $context).show()
					$('.jsSummaryRowNoSearchResults', $context).hide()
					return false
				}

				var searchMatches = 0
				var reg = new RegExp( searchTerm, 'i' )
				// Loop through each node and try match
				$(".jsSummaryRow", $context).each( function()
				{

					var matchFound = false
					$(".messageFrom > h3, .messageSubject > h3, .messagePreview", $(this)).each( function()
					{

						if( reg.test($(this).text()) )
						{
							$(this).highlight(searchTerm)
							matchFound = true
						}

					})
					if( matchFound == true )
						searchMatches++;
					else
						$(this).hide()

				})
				if(searchMatches == 0)
					$('.jsSummaryRowNoSearchResults', $context).show()
				else
					$('.jsSummaryRowNoSearchResults', $context).hide()

			},
			searchList : function($context, searchTerm)
			{

				// Un-highlight previous selections
				$(".messageFrom > h3, .messagePreview", $context).each(function()
				{
					$(this).removeHighlight();
				})

				// Require more then 3 characters to perform the search
				if(searchTerm.length < 3)
				{
					$(".jsSummaryRow", $context).show()
					$('.jsSummaryRowNoSearchResults', $context).hide()
					return false
				}

				var searchMatches = 0
				var reg = new RegExp( searchTerm, 'i' )
				// Loop through each node and try match
				$(".jsSummaryRow", $context).each( function()
				{

					var matchFound = false
					$(".messageFrom > h3, .messagePreview", $(this)).each( function()
					{

						if( reg.test($(this).text()) )
						{
							$(this).highlight(searchTerm)
							matchFound = true
						}

					})
					if( matchFound == true )
						searchMatches++;
					else
						$(this).hide()

				})
				if(searchMatches == 0)
					$('.jsSummaryRowNoSearchResults', $context).show()
				else
					$('.jsSummaryRowNoSearchResults', $context).hide()

			},
			renderCompleteCallback : function() {  },
			renderThreadNodeCompleteCallback : function() {  }
		}




		$.templateEngine.templates.SocialNetwork.Twitter.pushTwitterSummaryRow = function( $context, pid, row, prepend )
		{
			$contextMain = $context.parent().parent().parent()

			if( row == null )
			{
				$newNode = $("#templateTwitterListNoMessages").clone().removeAttr('id').removeClass('selected')
				$(".jsListMarker", $context).append( $newNode )
				return

			}

			$newNode = $("#templateTwitterListNodeGeneric").clone().removeAttr('id').removeClass('selected')
			$newNode.attr('serviceType', $contextMain.attr('serviceType') )
			$newNode.attr('serviceName', $contextMain.attr('serviceName') )
			$newNode.attr('folder', $contextMain.attr('folder') )
			$newNode.attr('pid', pid)
			$newNode.attr('mid', row.id_str)
			$newNode.attr('from', row.user.screen_name)

			//d = $.timeago.parse(row.created_at)
			//$.setISO8601(row.created_at);

			if(isNaN(Date.parse(row.created_at)))
			{
				var datePart = row.created_at.split(' ');
				var timePart = datePart[3].split(':');
				//alert(datePart[1] + ' ' + Date.parse(datePart[1]).Month + ' ' + datePart[2] + ' ' + timePart[0] + ' ' + timePart[1] + ' ' + timePart[2] + ' ' + '0');
				d = new Date(datePart[5], 1, datePart[2], timePart[0], timePart[1], timePart[2], 0);
				//Twitter dates are in the format: Tue Sep 13 01:35:50 +0000 2011
			}
			else
			{
				d = new Date(row.created_at); //Twitter dates are in the format: Tue Sep 13 01:35:50 +0000 2011
			}

			$('.date', $newNode).attr('title',  d.toStringISO8601() ) //title used by timeago for calc, then html used as title in ui
			$('.date', $newNode).html( d.toString() ) //show title in users local time
			$('.date', $newNode).timeago()

			$(".photo span", $newNode).attr('style', "background: url('" + row.user.profile_image_url_https + "') !important;")
			$(".photo span", $newNode).attr('title', row.user.description)

			var subject = row.text || "&nbsp;"
			$(".messageFrom h3", $newNode ).attr('title', row.user.location)
			$(".messageFrom h3", $newNode ).html( row.user.screen_name )
			$(".messagePreview", $newNode ).html( row.text )

			//add bindings
			$newNode.bind('click', function()
			{

				$contextMain = $(this).parent().parent().parent().parent()

				//unselect all other jsSummaryRow
				$('.jsSummaryRow', $contextMain).removeClass('selected');
				//mark this jsSummaryRow as selected
				$(this).addClass('selected');

				var pid = $(this).attr('pid')
				var mid = $(this).attr('mid')
				var folder = $(this).attr('folder')
				$.templateEngine.templates.SocialNetwork.Twitter.renderThreadAction($contextMain, pid, folder, mid)
				return false

			})

			//$newNode.hide()
			if( prepend )
				$('.jsSummarySearchTop', $context).after( $newNode )
			else
				$context.append( $newNode ) //$newNode.slideDown('fast') )

		}

		$.templateEngine.templates.SocialNetwork.Twitter.renderThreadAction = function($contextMain, pid, folder, mid) {

			localDataNode = $.localData.findById( $.localData.dataStore["pid"+pid].folders[folder].serviceData, mid )
			var dataPacket = { pid : pid, folder : folder, localDataNode : localDataNode}
			$.templateEngine.templates.SocialNetwork.Twitter.renderThreadNode($contextMain, dataPacket)

		}

		$.fn.pushTwitterSummaryRow = function(pid, row, prepend) {

			$.templateEngine.templates.SocialNetwork.Twitter.pushTwitterSummaryRow( $(this), pid, row, prepend )
			return $(this)

		}


		$.templateEngine.templates.SocialNetwork.Twitter.pushTwitterCommentRow = function( $context, pid, responseData ) //CONSIDER: Binding these methods to the jQuery core doesnt really add more value than having it accessible in the template tree
		{

			// OK, so we have a message. Who is it from?
			var $newNode = $("#templateTwitterCommentTemplateNodeThem").clone().removeAttr('id') //TODO: clone me node if i made the comment
			$newNode.attr('pid', pid)
			//$newNode.attr('folder', $contextMain.attr('folder') )
			$newNode.attr('mid', responseData.id)
			$(".photo", $newNode).attr('style', "background: url('" + responseData.user.profile_image_url_https + "') !important;")
			$(".photo", $newNode).attr('title', responseData.user.name)

			$(".applicationName", $newNode).html( responseData.source )
			$(".commentBody", $newNode ).html( responseData.text )
			d = new Date(responseData.created_at) //Twitter dates are in the format: Tue Sep 13 01:35:50 +0000 2011
			$('.tstamp', $newNode).attr('title',  d.toStringISO8601() ) //title used by timeago for calc, then html used as title in ui
			$('.tstamp', $newNode).html( d.toString() ) //show title in users local time
			$('.tstamp', $newNode).timeago()

			$newNode.hide()
			var $uiContext = $context.before( $newNode.slideDown('fast') )

		}

		$.fn.pushTwitterCommentRow = function(pid, responseData ) {

			$.templateEngine.templates.SocialNetwork.Twitter.pushTwitterCommentRow( $(this), pid, responseData )
			return $(this)

		}

		$.templateEngine.templates.SocialNetwork.Twitter.defaultFolders = {
			statuses_mentions : {
				lastUpdated : 0,
				cacheTTL : 60,
				sort : undefined,
				order : undefined,
				folderName : "Mentions",
				completeDataset : false, // set to true if reached the end of paging of if sent complete dataset in one hit
				serviceData : []
			},
			statuses_home_timeline : {
				lastUpdated : 0,
				cacheTTL : 60,
				sort : undefined,
				order : undefined,
				folderName : "Timeline",
				completeDataset : false, // set to true if reached the end of paging of if sent complete dataset in one hit
				serviceData : []
			}
		}

	});
</script>
