﻿/*
 * SPServices - Work with SharePoint's Web Services using jQuery
 * Version 0.5.6
 * @requires jQuery v1.3.2 or greater
 *
 * Copyright (c) 2009-2010 Sympraxis Consulting LLC
 * Examples and docs at:
 * http://spservices.codeplex.com
 * Licensed under the MIT license:
 * http://www.opensource.org/licenses/mit-license.php
 */
/**
 * @description Work with SharePoint's Web Services using jQuery
 * @type jQuery
 * @name SPServices
 * @category Plugins/SPServices
 * @author Sympraxis Consulting LLC/marc.anderson@sympraxisconsulting.com
 */
(function(D){var g="/";var m="Alerts";var l="Authentication";var p="Copy";var J="Forms";var n="Lists";var H="Meetings";var d="People";var b="Permissions";var q="PublishedLinksService";var x="Search";var I="usergroup";var F="UserProfileService";var Q="Versions";var j="Views";var C="WebPartPages";var o="Webs";var c="Workflow";var e="";var G=new Array();G.GetAlerts=[m,false];G.DeleteAlerts=[m,true];G.Mode=[l,false];G.Login=[l,false];G.CopyIntoItems=[p,true];G.CopyIntoItemsLocal=[p,true];G.GetItem=[p,false];G.GetForm=[J,false];G.GetFormCollection=[J,false];G.AddAttachment=[n,true];G.AddList=[n,true];G.CheckInFile=[n,true];G.CheckOutFile=[n,true];G.DeleteList=[n,true];G.GetAttachmentCollection=[n,false];G.GetList=[n,false];G.GetListAndView=[n,false];G.GetListCollection=[n,false];G.GetListContentType=[n,false];G.GetListContentTypes=[n,false];G.GetListItems=[n,false];G.UpdateList=[n,true];G.UpdateListItems=[n,true];G.AddMeeting=[H,true];G.CreateWorkspace=[H,true];G.RemoveMeeting=[H,true];G.SetWorkSpaceTitle=[H,true];G.SearchPrincipals=[d,false];G.AddPermission=[b,true];G.AddPermissionCollection=[b,true];G.GetPermissionCollection=[b,true];G.RemovePermission=[b,true];G.RemovePermissionCollection=[b,true];G.UpdatePermission=[b,true];G.GetLinks=[q,true];G.GetPortalSearchInfo=[x,false];G.GetSearchMetadata=[x,false];G.Query=[x,false];G.QueryEx=[x,false];G.Status=[x,false];G.AddGroup=[I,true];G.AddGroupToRole=[I,true];G.AddRole=[I,true];G.GetAllUserCollectionFromWeb=[I,false];G.GetGroupCollection=[I,false];G.GetGroupCollectionFromRole=[I,false];G.GetGroupCollectionFromSite=[I,false];G.GetGroupCollectionFromUser=[I,false];G.GetGroupCollectionFromWeb=[I,false];G.GetGroupInfo=[I,false];G.GetRoleCollection=[I,false];G.GetRoleCollectionFromGroup=[I,false];G.GetRoleCollectionFromUser=[I,false];G.GetRoleCollectionFromWeb=[I,false];G.GetRolesAndPermissionsForCurrentUser=[I,false];G.GetRolesAndPermissionsForSite=[I,false];G.GetUserCollection=[I,false];G.GetUserCollectionFromGroup=[I,false];G.GetUserCollectionFromRole=[I,false];G.GetUserCollectionFromSite=[I,false];G.GetUserCollectionFromWeb=[I,false];G.GetUserInfo=[I,false];G.GetUserLoginFromEmail=[I,false];G.RemoveGroup=[I,true];G.GetCommonMemberships=[F,false];G.GetUserColleagues=[F,false];G.GetUserLinks=[F,false];G.GetUserMemberships=[F,false];G.GetUserPinnedLinks=[F,false];G.GetUserProfileByName=[F,false];G.GetUserProfileCount=[F,false];G.GetUserProfileSchema=[F,false];G.ModifyUserPropertyByAccountName=[F,true];G.DeleteAllVersions=[Q,true];G.DeleteVersion=[Q,true];G.GetVersions=[Q,false];G.RestoreVersion=[Q,true];G.GetViewCollection=[j,false];G.AddWebPart=[C,true];G.GetWebPart2=[C,false];G.GetWebPartPage=[C,false];G.GetWebPartProperties=[C,false];G.GetWebPartProperties2=[C,false];G.GetListTemplates=[o,false];G.GetWeb=[o,false];G.GetWebCollection=[o,false];G.GetAllSubWebCollection=[o,false];G.WebUrlFromPageUrl=[o,false];G.GetTemplatesForItem=[c,false];G.GetToDosForItem=[c,false];G.GetWorkflowDataForItem=[c,false];G.GetWorkflowTaskData=[c,false];G.StartWorkflow=[c,true];var A=new Object();A.header="<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body>";A.footer="</soap:Body></soap:Envelope>";A.payload="";D.fn.SPServices=function(R){var S=D.extend({},D.fn.SPServices.defaults,R);A.opheader="<"+S.operation+" ";switch(G[S.operation][0]){case m:A.opheader+="xmlns='http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/' >";SOAPAction="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/";break;case H:A.opheader+="xmlns='http://schemas.microsoft.com/sharepoint/soap/meetings/' >";SOAPAction="http://schemas.microsoft.com/sharepoint/soap/meetings/";break;case b:A.opheader+="xmlns='http://schemas.microsoft.com/sharepoint/soap/directory/' >";SOAPAction="http://schemas.microsoft.com/sharepoint/soap/directory/";break;case q:A.opheader+="xmlns='http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService/' >";SOAPAction="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService/";break;case x:A.opheader+="xmlns='urn:Microsoft.Search' >";SOAPAction="urn:Microsoft.Search/";break;case I:A.opheader+="xmlns='http://schemas.microsoft.com/sharepoint/soap/directory/' >";SOAPAction="http://schemas.microsoft.com/sharepoint/soap/directory/";break;case F:A.opheader+="xmlns='http://microsoft.com/webservices/SharePointPortalServer/UserProfileService' >";SOAPAction="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService/";break;case C:A.opheader+="xmlns='http://microsoft.com/sharepoint/webpartpages' >";SOAPAction="http://microsoft.com/sharepoint/webpartpages/";break;case c:A.opheader+="xmlns='http://schemas.microsoft.com/sharepoint/soap/workflow/' >";SOAPAction="http://schemas.microsoft.com/sharepoint/soap/workflow/";break;default:A.opheader+="xmlns='http://schemas.microsoft.com/sharepoint/soap/'>";SOAPAction="http://schemas.microsoft.com/sharepoint/soap/";break}SOAPAction+=S.operation;A.opfooter="</"+S.operation+">";var T="_vti_bin/"+G[S.operation][0]+".asmx";if(S.webURL.charAt(S.webURL.length-1)==g){T=S.webURL+T}else{if(S.webURL.length>0){T=S.webURL+g+T}else{T=D().SPServices.SPGetCurrentSite()+g+T}}A.payload="";switch(S.operation){case"GetAlerts":break;case"DeleteAlerts":A.payload+="<IDs>";for(i=0;i<S.IDs.length;i++){A.payload+=v("string",S.IDs[i])}A.payload+="</IDs>";break;case"Mode":break;case"Login":A.payload+=v("username",S.username);A.payload+=v("password",S.password);break;case"CopyIntoItems":A.payload+=v("SourceUrl",S.SourceUrl);A.payload+="<DestinationUrls>";for(i=0;i<S.DestinationUrls.length;i++){A.payload+=v("string",S.DestinationUrls[i])}A.payload+="</DestinationUrls>";A.payload+=v("Fields",S.Fields);A.payload+=v("Stream",S.Stream);A.payload+=v("Results",S.Results);break;case"CopyIntoItemsLocal":A.payload+=v("SourceUrl",S.SourceUrl);A.payload+="<DestinationUrls>";for(i=0;i<S.DestinationUrls.length;i++){A.payload+=v("string",S.DestinationUrls[i])}A.payload+="</DestinationUrls>";break;case"GetItem":A.payload+=v("Url",S.Url);A.payload+=v("Fields",S.Fields);A.payload+=v("Stream",S.Stream);break;case"GetForm":A.payload+=v("listName",S.listName);A.payload+=v("formUrl",S.formUrl);break;case"GetFormCollection":A.payload+=v("listName",S.listName);break;case"AddAttachment":A.payload+=v("listName",S.listName);A.payload+=v("listItemID",S.listItemID);A.payload+=v("fileName",S.fileName);A.payload+=v("attachment",S.attachment);break;case"AddList":A.payload+=v("listName",S.listName);A.payload+=v("description",S.description);A.payload+=v("templateID",S.templateID);break;case"CheckInFile":A.payload+=v("pageUrl",S.pageUrl);A.payload+=v("comment",S.comment);A.payload+=v("CheckinType",S.CheckinType);break;case"CheckOutFile":A.payload+=v("pageUrl",S.pageUrl);A.payload+=v("checkoutToLocal",S.checkoutToLocal);A.payload+=v("lastmodified",S.lastmodified);break;case"DeleteList":A.payload+=v("listName",S.listName);break;case"GetAttachmentCollection":A.payload+=v("listName",S.listName);A.payload+=v("listItemID",S.ID);break;case"GetList":A.payload+=v("listName",S.listName);break;case"GetListAndView":A.payload+=v("listName",S.listName);A.payload+=v("viewName",S.viewName);break;case"GetListCollection":break;case"GetListContentType":A.payload+=v("listName",S.listName);A.payload+=v("contentTypeId",S.contentTypeId);break;case"GetListContentTypes":A.payload+=v("listName",S.listName);break;case"GetListItems":A.payload+=v("listName",S.listName);A.payload+=v("viewName",S.viewName);A.payload+=v("query",S.CAMLQuery);A.payload+=v("viewFields",S.CAMLViewFields);A.payload+=v("rowLimit",S.CAMLRowLimit);A.payload+=v("queryOptions",S.CAMLQueryOptions);break;case"UpdateList":A.payload+=v("listName",S.listName);A.payload+=v("listProperties",S.listProperties);A.payload+=v("newFields",S.newFields);A.payload+=v("updateFields",S.updateFields);A.payload+=v("deleteFields",S.deleteFields);A.payload+=v("listVersion",S.listVersion);break;case"UpdateListItems":A.payload+=v("listName",S.listName);if(S.updates.length>0){A.payload+=v("updates",S.updates)}else{A.payload+="<updates><Batch OnError='Continue'><Method ID='1' Cmd='"+S.batchCmd+"'>";for(i=0;i<S.valuepairs.length;i++){A.payload+="<Field Name='"+S.valuepairs[i][0]+"'>"+S.valuepairs[i][1]+"</Field>"}if(S.batchCmd!="New"){A.payload+="<Field Name='ID'>"+S.ID+"</Field>"}A.payload+="</Method></Batch></updates>"}break;case"AddMeeting":A.payload+=v("organizerEmail",S.organizerEmail);A.payload+=v("uid",S.uid);A.payload+=v("sequence",S.sequence);A.payload+=v("utcDateStamp",S.utcDateStamp);A.payload+=v("title",S.title);A.payload+=v("location",S.location);A.payload+=v("utcDateStart",S.utcDateStart);A.payload+=v("utcDateEnd",S.utcDateEnd);A.payload+=v("nonGregorian",S.nonGregorian);break;case"CreateWorkspace":A.payload+=v("title",S.title);A.payload+=v("templateName",S.templateName);A.payload+=v("lcid",S.lcid);A.payload+=v("timeZoneInformation",S.timeZoneInformation);case"RemoveMeeting":A.payload+=v("recurrenceId",S.recurrenceId);A.payload+=v("uid",S.uid);A.payload+=v("sequence",S.sequence);A.payload+=v("utcDateStamp",S.utcDateStamp);A.payload+=v("cancelMeeting",S.cancelMeeting);case"SetWorkspaceTitle":A.payload+=v("title",S.title);case"SearchPrincipals":A.payload+=v("searchText",S.searchText);A.payload+=v("maxResults",S.maxResults);A.payload+=v("principalType",S.principalType);break;case"AddPermission":A.payload+=v("objectName",S.objectName);A.payload+=v("objectType",S.objectType);A.payload+=v("permissionIdentifier",S.permissionIdentifier);A.payload+=v("permissionType",S.permissionType);A.payload+=v("permissionMask",S.permissionMask);break;case"AddPermissionCollection":A.payload+=v("objectName",S.objectName);A.payload+=v("objectType",S.objectType);A.payload+=v("permissionsInfoXml",S.permissionsInfoXml);break;case"GetPermissionCollection":A.payload+=v("objectName",S.objectName);A.payload+=v("objectType",S.objectType);break;case"RemovePermission":A.payload+=v("objectName",S.objectName);A.payload+=v("objectType",S.objectType);A.payload+=v("permissionIdentifier",S.permissionIdentifier);A.payload+=v("permissionType",S.permissionType);break;case"RemovePermissionCollection":A.payload+=v("objectName",S.objectName);A.payload+=v("objectType",S.objectType);A.payload+=v("memberIdsXml",S.memberIdsXml);break;case"UpdatePermission":A.payload+=v("objectName",S.objectName);A.payload+=v("objectType",S.objectType);A.payload+=v("permissionIdentifier",S.permissionIdentifier);A.payload+=v("permissionType",S.permissionType);A.payload+=v("permissionMask",S.permissionMask);break;case"GetLinks":break;case"GetPortalSearchInfo":A.opheader="<"+S.operation+" xmlns='http://microsoft.com/webservices/OfficeServer/QueryService'/>";SOAPAction="http://microsoft.com/webservices/OfficeServer/QueryService/"+S.operation;break;case"GetSearchMetadata":A.opheader="<"+S.operation+" xmlns='http://microsoft.com/webservices/OfficeServer/QueryService'/>";SOAPAction="http://microsoft.com/webservices/OfficeServer/QueryService/"+S.operation;break;case"Query":A.payload+=v("queryXml",a(S.queryXml));break;case"QueryEx":A.opheader="<"+S.operation+" xmlns='http://microsoft.com/webservices/OfficeServer/QueryService'>";SOAPAction="http://microsoft.com/webservices/OfficeServer/QueryService/"+S.operation;A.payload+=v("queryXml",a(S.queryXml));break;case"Status":break;case"AddGroup":A.payload+=v("groupName",S.groupName);A.payload+=v("ownerIdentifier",S.ownerIdentifier);A.payload+=v("ownerType",S.ownerType);A.payload+=v("defaultUserLoginName",S.defaultUserLoginName);A.payload+=v("groupName",S.groupName);A.payload+=v("description",S.description);break;case"AddGroupToRole":A.payload+=v("groupName",S.groupName);A.payload+=v("roleName",S.roleName);break;case"AddRole":A.payload+=v("roleName",S.roleName);A.payload+=v("description",S.description);A.payload+=v("permissionMask",S.permissionMask);break;case"GetAllUserCollectionFromWeb":break;case"GetGroupCollectionFromRole":A.payload+=v("roleName",S.roleName);break;case"GetGroupCollection":A.payload+=v("groupNamesXml",S.groupNamesXml);break;case"GetGroupCollectionFromSite":break;case"GetGroupCollectionFromUser":A.payload+=v("userLoginName",S.userLoginName);break;case"GetGroupCollectionFromWeb":break;case"GetGroupInfo":A.payload+=v("groupName",S.groupName);break;case"GetRoleCollection":A.payload+=v("roleNamesXml",S.roleNamesXml);break;case"GetRoleCollectionFromGroup":A.payload+=v("groupName",S.groupName);break;case"GetRoleCollectionFromUser":A.payload+=v("userLoginName",S.userLoginName);break;case"GetRoleCollectionFromWeb":break;case"GetRoleInfo":A.payload+=v("roleName",S.roleName);break;case"GetRolesAndPermissionsForCurrentUser":break;case"GetRolesAndPermissionsForSite":break;case"GetUserCollection":A.payload+=v("userLoginNamesXml",S.userLoginNamesXml);break;case"GetUserCollectionFromGroup":A.payload+=v("groupName",S.groupName);break;case"GetUserCollectionFromRole":A.payload+=v("roleName",S.roleName);break;case"GetUserCollectionFromSite":break;case"GetUserCollectionFromWeb":break;case"GetUserInfo":A.payload+=v("userLoginName",S.userLoginName);break;case"GetUserLoginFromEmail":A.payload+=v("emailXml",S.emailXml);break;case"RemoveGroup":A.payload+=v("groupName",S.groupName);break;case"GetCommonMemberships":A.payload+=v("accountName",S.accountName);break;case"GetUserColleagues":A.payload+=v("accountName",S.accountName);break;case"GetUserLinks":A.payload+=v("accountName",S.accountName);break;case"GetUserMemberships":A.payload+=v("accountName",S.accountName);break;case"GetUserPinnedLinks":A.payload+=v("accountName",S.accountName);break;case"GetUserProfileByName":if(S.accountName.length>0){A.payload+=v("AccountName",S.accountName)}else{A.payload+=v("AccountName",S.AccountName)}break;case"GetUserProfileCount":break;case"GetUserProfileSchema":break;case"ModifyUserPropertyByAccountName":A.payload+=v("accountName",S.accountName);A.payload+=v("newData",S.newData);break;case"GetViewCollection":A.payload+=v("listName",S.listName);break;case"DeleteAllVersions":A.payload+=v("fileName",S.fileName);break;case"DeleteVersion":A.payload+=v("fileName",S.fileName);A.payload+=v("fileVersion",S.fileVersion);break;case"GetVersions":A.payload+=v("fileName",S.fileName);break;case"RestoreVersion":A.payload+=v("fileName",S.fileName);A.payload+=v("fileVersion",S.fileVersion);break;case"AddWebPart":A.payload+=v("pageUrl",S.pageUrl);A.payload+=v("webPartXml",S.webPartXml);A.payload+=v("storage",S.storage);break;case"GetWebPart2":A.payload+=v("pageUrl",S.pageUrl);A.payload+=v("storageKey",S.storageKey);A.payload+=v("storage",S.storage);A.payload+=v("behavior",S.behavior);break;case"GetWebPartPage":A.payload+=v("documentName",S.documentName);A.payload+=v("behavior",S.behavior);break;case"GetWebPartProperties":A.payload+=v("pageUrl",S.pageUrl);A.payload+=v("storage",S.storage);break;case"GetWebPartProperties2":A.payload+=v("pageUrl",S.pageUrl);A.payload+=v("storage",S.storage);A.payload+=v("behavior",S.behavior);break;case"GetWeb":A.payload+=v("webUrl",S.webURL);break;case"GetListTemplates":break;case"GetWebCollection":break;case"GetAllSubWebCollection":break;case"WebUrlFromPageUrl":A.payload+=v("pageUrl",S.pageURL);break;case"GetTemplatesForItem":A.payload+=v("item",S.item);break;case"GetToDosForItem":A.payload+=v("item",S.item);break;case"GetWorkflowDataForItem":A.payload+=v("item",S.item);break;case"GetWorkflowTaskData":A.payload+=v("item",S.item);A.payload+=v("listId",S.listId);A.payload+=v("taskId",S.taskId);break;case"StartWorkflow":A.payload+=v("item",S.item);A.payload+=v("templateId",S.templateId);A.payload+=v("workflowParameters",S.workflowParameters);break;default:break}var U=A.header+A.opheader+A.payload+A.opfooter+A.footer;D.ajax({url:T,async:S.async,beforeSend:function(V){if(G[S.operation][1]){V.setRequestHeader("SOAPAction",SOAPAction)}},type:"POST",data:U,dataType:"xml",contentType:"text/xml; charset='utf-8'",complete:S.completefunc})};D.fn.SPServices.defaults={operation:"",webURL:"",pageURL:"",listName:"",description:"",templateID:"",viewName:"",formUrl:"",fileName:"",fileVersion:"",ID:1,updates:"",comment:"",CheckinType:"",checkoutToLocal:"",lastmodified:"",CAMLViewName:"",CAMLQuery:"",CAMLViewFields:"",CAMLRowLimit:0,CAMLQueryOptions:"<QueryOptions></QueryOptions>",batchCmd:"Update",valuepairs:[],listProperties:"",newFields:"",updateFields:"",deleteFields:"",listVersion:"",contentTypeId:"",username:"",password:"",accountName:"",newData:"",AccountName:"",userLoginName:"",groupNamesXml:"",groupName:"",ownerIdentifier:"",ownerType:"",defaultUserLoginName:"",roleNamesXml:"",roleName:"",permissionIdentifier:"",permissionType:"",permissionMask:"",permissionsInfoXml:"",memberIdsXml:"",userLoginNamesXml:"",emailXml:"",objectName:"",objectType:"List",IDs:null,listItemID:"",attachment:"",SourceUrl:"",Url:"",DestinationUrls:[],Fields:"",Stream:"",Results:"",documentName:"",behavior:"Version3",storageKey:"",storage:"Shared",webPartXml:"",item:"",listId:"",taskId:"",templateId:"",workflowParameters:"",fClaim:false,queryXml:"",cancelMeeting:true,lcid:"",location:"",nonGregorian:false,organizerEmail:"",recurrenceId:0,sequence:0,templateName:"",timeZoneInformation:"",title:"",uid:"",utcDateStamp:"",utcDateStart:"",utcDateEnd:"",searchText:"",maxResults:10,principalType:"User",async:true,completefunc:null};D.fn.SPServices.SPGetCurrentSite=function(){if(e.length>0){return e}var R=A.header+"<WebUrlFromPageUrl xmlns='http://schemas.microsoft.com/sharepoint/soap/' ><pageUrl>"+((location.href.indexOf("?")>0)?location.href.substr(0,location.href.indexOf("?")):location.href)+"</pageUrl></WebUrlFromPageUrl>"+A.footer;D.ajax({async:false,url:"/_vti_bin/Webs.asmx",type:"POST",data:R,dataType:"xml",contentType:'text/xml; charset="utf-8"',complete:function(T,S){e=D(T.responseXML).find("WebUrlFromPageUrlResult").text()}});return e};D.fn.SPServices.SPCascadeDropdowns=function(R){var T=D.extend({},{relationshipWebURL:"",relationshipList:"",relationshipListParentColumn:"",relationshipListChildColumn:"",relationshipListSortColumn:"",parentColumn:"",childColumn:"",CAMLQuery:"",promptText:"Choose {0}...",completefunc:null,debug:false},R);var S=new K(T.parentColumn);if(S.Obj.html()==null&&T.debug){B("SPServices.SPCascadeDropdowns","parentColumn: "+T.parentColumn,"Column not found on page");return}switch(S.Type){case"S":S.Obj.bind("change",function(){M(T)});S.Obj.change();break;case"C":S.Obj.bind("propertychange",function(){M(T)});S.Obj.trigger("propertychange");break;case"M":S.Obj.bind("dblclick",function(){M(T)});parentSelections=S.Obj.closest("span").find("select[ID$='SelectResult'][Title^='"+T.parentColumn+" ']");parentSelections.bind("dblclick",function(){M(T)});S.Obj.closest("span").find("button").each(function(){D(this).bind("click",function(){M(T)})});M(T);break;default:break}};function M(U){var ae="";var Y=null;var X=[];var T;var Z;var ab;var ac;var W=new K(U.parentColumn);switch(W.Type){case"S":X.push(W.Obj.find("option:selected").text());break;case"C":X.push(W.Obj.attr("value"));break;case"M":parentSelections=W.Obj.closest("span").find("select[ID$='SelectResult'][Title^='"+U.parentColumn+" ']");D(parentSelections).find("option").each(function(){X.push(D(this).html())});break;default:break}var aa=D().SPServices.SPGetStaticFromDisplay({listName:u(),columnDisplayName:U.childColumn});if(W.Obj.attr("SPCascadeDropdown_Selected_"+aa)==X.join(";#")){return}W.Obj.attr("SPCascadeDropdown_Selected_"+aa,X.join(";#"));var S=new K(U.childColumn);if(S.Obj.html()==null&&U.debug){B("SPServices.SPCascadeDropdowns","childColumn: "+U.childColumn,"Column not found on page");return}switch(S.Type){case"S":Y=S.Obj.find("option:selected").val();break;case"C":Y=S.Obj.attr("value");break;case"M":Z=S.Obj.closest("span").find("input[name$='MultiLookupPicker$data']");T=window[S.Obj.closest("tr").find("button[id$='AddButton']").attr("id").replace(/AddButton/,"MultiLookupPicker_m")];currentSelection=S.Obj.closest("span").find("select[ID$='SelectResult'][Title^='"+U.childColumn+" ']");T.data="";break;default:break}var V=(U.relationshipListSortColumn.length>0)?U.relationshipListSortColumn:U.relationshipListChildColumn;var R="<Query><OrderBy><FieldRef Name='"+V+"'/></OrderBy><Where>";if(U.CAMLQuery.length>0){R+="<And>"}if(X.length==0){R+="<Eq><FieldRef Name='"+U.relationshipListParentColumn+"'/><Value Type='Text'></Value></Eq>"}else{if(X.length==1){R+="<Eq><FieldRef Name='"+U.relationshipListParentColumn+"'/><Value Type='Text'>"+s(X[0])+"</Value></Eq>"}else{var ad=(X.length>2)?true:false;for(i=0;i<(X.length-1);i++){R+="<Or>"}for(i=0;i<X.length;i++){R+="<Eq><FieldRef Name='"+U.relationshipListParentColumn+"'/><Value Type='Text'>"+s(X[i])+"</Value></Eq>";if(i>0&&(i<(X.length-1))&&ad){R+="</Or>"}}R+="</Or>"}}if(U.CAMLQuery.length>0){R+=U.CAMLQuery+"</And>"}R+="</Where></Query>";D().SPServices({operation:"GetList",async:false,listName:u(),completefunc:function(ag,af){D(ag.responseXML).find("Fields").each(function(){D(this).find("Field").each(function(){if(D(this).attr("DisplayName")==U.childColumn){ac=(D(this).attr("Required")=="TRUE")?true:false;return false}})})}});D().SPServices({operation:"GetListItems",async:false,webURL:U.relationshipWebURL,listName:U.relationshipList,CAMLQuery:R,CAMLViewFields:"<ViewFields><FieldRef Name='"+U.relationshipListParentColumn+"' /><FieldRef Name='"+U.relationshipListChildColumn+"' /></ViewFields>",CAMLRowLimit:0,CAMLQueryOptions:"<QueryOptions><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns></QueryOptions>",completefunc:function(ag,af){D(ag.responseXML).find("faultcode").each(function(){if(U.debug){B("SPServices.SPCascadeDropdowns","relationshipListParentColumn: "+U.relationshipListParentColumn+" or relationshipListChildColumn: "+U.relationshipListChildColumn,"Not found in relationshipList "+U.relationshipList)}return});switch(S.Type){case"S":S.Obj.attr({length:0});if(!ac&&(U.promptText.length>0)){S.Obj.append("<option value='0'>"+U.promptText.replace(/\{0\}/g,U.childColumn)+"</option>")}break;case"C":ae=ac?"":"(None)|0";S.Obj.attr("value","");break;case"M":S.Obj.attr({length:0});ab="";break;default:break}D(ag.responseXML).find("[nodeName=z:row]").each(function(){var ai=(D(this).attr("ows_"+U.relationshipListChildColumn).indexOf(";#")>0)?D(this).attr("ows_"+U.relationshipListChildColumn).split(";#")[0]:D(this).attr("ows_ID");if(isNaN(ai)){ai=D(this).attr("ows_ID")}var ah=(D(this).attr("ows_"+U.relationshipListChildColumn).indexOf(";#")>0)?D(this).attr("ows_"+U.relationshipListChildColumn).split(";#")[1]:D(this).attr("ows_"+U.relationshipListChildColumn);switch(S.Type){case"S":var aj=(D(this).attr("ows_ID")==Y)?" selected='selected'":"";S.Obj.append("<option"+aj+" value='"+ai+"'>"+ah+"</option>");break;case"C":if(ah==Y){S.Obj.attr("value",Y)}ae=ae+((ae.length>0)?"|":"")+ah+"|"+ai;break;case"M":S.Obj.append("<option value='"+ai+"'>"+ah+"</option>");ab+=ai+"|t"+ah+"|t |t |t";break;default:break}});switch(S.Type){case"S":S.Obj.trigger("change");break;case"C":S.Obj.attr("choices",ae);S.Obj.trigger("propertychange");break;case"M":Z.attr("value",ab);D(currentSelection).find("option").each(function(){var ah=D(this);D(this).attr("selected","selected");D(S.Obj).find("option").each(function(){if(D(this).html()==ah.html()){ah.attr("selected","")}})});GipRemoveSelectedItems(T);D(S.Obj).find("option").each(function(){var ah=D(this);D(currentSelection).find("option").each(function(){if(D(this).html()==ah.html()){ah.remove()}})});GipAddSelectedItems(T);T.data=GipGetGroupData(ab);break;default:break}}});if(U.completefunc!=null){U.completefunc()}}D.fn.SPServices.SPDisplayRelatedInfo=function(R){var S=D.extend({},{columnName:"",relatedWebURL:"",relatedList:"",relatedListColumn:"",relatedColumns:[],displayFormat:"table",headerCSSClass:"ms-vh2",rowCSSClass:"ms-vb",CAMLQuery:"",numChars:0,matchType:"Eq",completefunc:null,debug:false},R);var T=new K(S.columnName);if(T.Obj.html()==null&&S.debug){B("SPServices.SPDisplayRelatedInfo","columnName: "+S.columnName,"Column not found on page");return}switch(T.Type){case"S":T.Obj.bind("change",function(){y(S)});T.Obj.change();break;case"C":T.Obj.bind("propertychange",function(){y(S)});T.Obj.trigger("propertychange");break;case"M":if(S.debug){B("SPServices.SPDisplayRelatedInfo","columnName: "+S.columnName,"Multi-select columns not supported by this function")}break;default:break}};function y(W){var S=null;var X=new K(W.columnName);switch(X.Type){case"S":S=X.Obj.find("option:selected").text();break;case"C":S=X.Obj.attr("value");if(W.numChars>0&&S.length<W.numChars){return}break;case"M":break;default:break}if(X.Obj.attr("showRelatedSelected")==S){return}X.Obj.attr("showRelatedSelected",S);var U=h("SPDisplayRelatedInfo",W.columnName);D("#"+U).remove();X.Obj.parent().append("<div id="+U+"></div>");var V=[];D().SPServices({operation:"GetList",async:false,webURL:W.relatedWebURL,listName:W.relatedList,completefunc:function(Z,Y){D(Z.responseXML).find("faultcode").each(function(){if(W.debug){B("SPServices.SPDisplayRelatedInfo","relatedList: "+W.relatedList,"List not found")}return});D(Z.responseXML).find("Fields").each(function(){D(Z.responseXML).find("Field").each(function(){for(i=0;i<W.relatedColumns.length;i++){if(D(this).attr("Name")==W.relatedColumns[i]){V[i]=D(this)}}})})}});var R="<Query><Where>";if(W.CAMLQuery.length>0){R+="<And>"}R+="<"+W.matchType+"><FieldRef Name='"+W.relatedListColumn+"'/><Value Type='Text'>"+s(S)+"</Value></"+W.matchType+">";if(W.CAMLQuery.length>0){R+=W.CAMLQuery+"</And>"}R+="</Where></Query>";var T=" ";for(i=0;i<W.relatedColumns.length;i++){T+="<FieldRef Name='"+W.relatedColumns[i]+"' />"}D().SPServices({operation:"GetListItems",async:false,webURL:W.relatedWebURL,listName:W.relatedList,CAMLQuery:R,CAMLViewFields:"<ViewFields>"+T+"</ViewFields>",CAMLRowLimit:0,completefunc:function(aa,Z){D(aa.responseXML).find("faultcode").each(function(){if(W.debug){B("SPServices.SPDisplayRelatedInfo","relatedListColumn: "+W.relatedListColumn,"Column not found in relatedList "+W.relatedList)}return});var Y;switch(W.displayFormat){case"table":Y="<table>";Y+="<tr>";for(i=0;i<W.relatedColumns.length;i++){if(V[i]==undefined&&W.debug){B("SPServices.SPDisplayRelatedInfo","columnName: "+W.relatedColumns[i],"Column not found in relatedList");return}Y+="<th class='"+W.headerCSSClass+"'>"+V[i].attr("DisplayName")+"</th>"}Y+="</tr>";D(aa.responseXML).find("[nodeName=z:row]").each(function(){Y+="<tr>";for(i=0;i<W.relatedColumns.length;i++){Y+="<td class='"+W.rowCSSClass+"'>"+t(V[i],D(this).attr("ows_"+W.relatedColumns[i]),W)+"</td>"}Y+="</tr>"});Y+="</table>";break;case"list":Y="<table>";for(i=0;i<W.relatedColumns.length;i++){D(aa.responseXML).find("[nodeName=z:row]").each(function(){Y+="<tr>";Y+="<th class='"+W.headerCSSClass+"'>"+V[i].attr("DisplayName")+"</th>";Y+="<td class='"+W.rowCSSClass+"'>"+t(V[i],D(this).attr("ows_"+W.relatedColumns[i]),W)+"</td>";Y+="</tr>"})}Y+="</table>";break;default:break}D("#"+U).html("").append(Y)}});if(W.completefunc!=null){W.completefunc()}}D.fn.SPServices.SPDebugXMLHttpResult=function(S){var U=D.extend({},{node:null,indent:0},S);var W=3;var V=4;var R="";R+="<table class='ms-vb' style='margin-left:"+U.indent*3+"px;' width='100%'>";if(U.node.nodeName=="DisplayPattern"){R+="<tr><td width='100px' style='font-weight:bold;'>"+U.node.nodeName+"</td><td><textarea readonly='readonly' rows='5' cols='50'>"+U.node.xml+"</textarea></td></tr>"}else{if(!U.node.hasChildNodes()){R+="<tr><td width='100px' style='font-weight:bold;'>"+U.node.nodeName+"</td><td>"+((U.node.nodeValue!=null)?r(U.node.nodeValue):"&nbsp;")+"</td></tr>";if(U.node.attributes){R+="<tr><td colspan='99'>";R+=L(U.node,U);R+="</td></tr>"}}else{if(U.node.hasChildNodes()&&U.node.firstChild.nodeType==V){R+="<tr><td width='100px' style='font-weight:bold;'>"+U.node.nodeName+"</td><td><textarea readonly='readonly' rows='5' cols='50'>"+U.node.parentNode.text+"</textarea></td></tr>"}else{if(U.node.hasChildNodes()&&U.node.firstChild.nodeType==W){R+="<tr><td width='100px' style='font-weight:bold;'>"+U.node.nodeName+"</td><td>"+r(U.node.firstChild.nodeValue)+"</td></tr>"}else{R+="<tr><td width='100px' style='font-weight:bold;' colspan='99'>"+U.node.nodeName+"</td></tr>";if(U.node.attributes){R+="<tr><td colspan='99'>";R+=L(U.node,U);R+="</td></tr>"}R+="<tr><td>";for(var T=0;T<U.node.childNodes.length;T++){R+=D().SPServices.SPDebugXMLHttpResult({node:U.node.childNodes.item(T),indent:U.indent++})}R+="</td></tr>"}}}}R+="</table>";return R};D.fn.SPServices.SPGetCurrentUser=function(T){var U=D.extend({},{fieldName:"Name",debug:false},T);var S="";var R=RegExp('FieldInternalName="'+U.fieldName+'"',"gi");D.ajax({async:false,url:D().SPServices.SPGetCurrentSite()+"/_layouts/userdisp.aspx?Force=True&"+new Date().getTime(),complete:function(W,V){D(W.responseText).find("table.ms-formtable td[id^='SPField']").each(function(){if(R.test(D(this).html())){switch(D(this).attr("id")){case"SPFieldText":S=D(this).text();break;case"SPFieldNote":S=D(this).find("div").html();break;case"SPFieldURL":S=D(this).find("img").attr("src");break;default:S=D(this).text();break}return false}})}});return S.replace(/(^[\s\xA0]+|[\s\xA0]+$)/g,"")};D.fn.SPServices.SPLookupAddNew=function(T){var U=D.extend({},{lookupColumn:"",promptText:"Add new {0}",completefunc:null,debug:false},T);var S=new K(U.lookupColumn);if(S.Obj.html()==null&&U.debug){B("SPServices.SPLookupAddNew","lookupColumn: "+U.lookupColumn,"Column not found on page");return}var W="";var R="";var V="";D().SPServices({operation:"GetList",async:false,listName:u(),completefunc:function(Y,X){D(Y.responseXML).find("Field").each(function(){if(D(this).attr("DisplayName")==U.lookupColumn){V=D(this).attr("StaticName");D().SPServices({operation:"GetList",async:false,listName:D(this).attr("List"),completefunc:function(aa,Z){D(aa.responseXML).find("List").each(function(){R=D(this).attr("WebFullUrl");R=R!=g?R+g:R})}});D().SPServices({operation:"GetFormCollection",async:false,listName:D(this).attr("List"),completefunc:function(aa,Z){D(aa.responseXML).find("Form").each(function(){if(D(this).attr("Type")=="NewForm"){W=D(this).attr("Url")}})}});return false}})}});if(R.length==0&&U.debug){B("SPServices.SPLookupAddNew","lookupColumn: "+U.lookupColumn,"This column does not appear to be a lookup column");return}if(W.length>0){newLink="<div id='SPLookupAddNew_"+V+"'><a href='"+R+W+"?Source="+P(location.href)+"'>"+U.promptText.replace(/\{0\}/g,U.lookupColumn)+"</a></div>";D(S.Obj).parents("td.ms-formbody").append(newLink)}else{if(U.debug){B("SPServices.SPLookupAddNew","lookupColumn: "+U.lookupColumn,"NewForm cannot be found");return}}if(U.completefunc!=null){U.completefunc()}};D.fn.SPServices.SPGetLastItemId=function(S){var U=D.extend({},{webURL:"",listName:"",userAccount:"",CAMLQuery:""},S);var T;var V=0;D().SPServices({operation:"GetUserInfo",async:false,userLoginName:(U.userAccount!="")?U.userAccount:D().SPServices.SPGetCurrentUser(),completefunc:function(X,W){D(X.responseXML).find("User").each(function(){T=D(this).attr("ID")})}});var R="<Query><Where>";if(U.CAMLQuery.length>0){R+="<And>"}R+="<Eq><FieldRef Name='Author' LookupId='TRUE'/><Value Type='Integer'>"+T+"</Value></Eq>";if(U.CAMLQuery.length>0){R+=U.CAMLQuery+"</And>"}R+="</Where><OrderBy><FieldRef Name='Created_x0020_Date' Ascending='FALSE'/></OrderBy></Query>";D().SPServices({operation:"GetListItems",async:false,webURL:U.webURL,listName:U.listName,CAMLQuery:R,CAMLViewFields:"<ViewFields><FieldRef Name='ID'/></ViewFields>",CAMLRowLimit:1,completefunc:function(X,W){D(X.responseXML).find("[nodeName=z:row]").each(function(){V=D(this).attr("ows_ID")})}});return V};D.fn.SPServices.SPRequireUnique=function(Z){var R=D.extend({},{columnStaticName:"Title",duplicateAction:0,ignoreCase:false,initMsg:"This value must be unique.",initMsgCSSClass:"ms-vb",errMsg:"This value is not unique.",errMsgCSSClass:"ms-formvalidation",completefunc:null},Z);var T=D().SPServices.SPGetQueryString();var X=T.ID;var S="<span id='SPRequireUnique"+R.columnStaticName+"' class='{0}'>{1}<br/></span>";var V=S.replace(/\{0\}/g,R.initMsgCSSClass).replace(/\{1\}/g,R.initMsg);var W=S.replace(/\{0\}/g,R.errMsgCSSClass).replace(/\{1\}/g,R.errMsg);var U=D().SPServices.SPGetDisplayFromStatic({listName:u(),columnStaticName:R.columnStaticName});var Y=D("input[Title='"+U+"']");D(Y).parent().append(V);D(Y).blur(function(){var ab=0;var ac=D(this).attr("value");D().SPServices({operation:"GetListItems",async:false,listName:u(),CAMLQuery:"<Query><Where><IsNotNull><FieldRef Name='"+R.columnStaticName+"'/></IsNotNull></Where></Query>",CAMLViewFields:"<ViewFields><FieldRef Name='ID' /><FieldRef Name='"+R.columnStaticName+"' /></ViewFields>",CAMLRowLimit:0,completefunc:function(af,ad){var ae=R.ignoreCase?ac.toUpperCase():ac;D(af.responseXML).find("[nodeName=z:row]").each(function(){var ag=R.ignoreCase?D(this).attr("ows_"+R.columnStaticName).toUpperCase():D(this).attr("ows_"+R.columnStaticName);if((ae==ag)&&(D(this).attr("ows_ID")!=X)){ab++}})}});var aa=V;D("input[value='OK']").attr("disabled","");if(ab>0){aa=W;if(R.duplicateAction==1){D("input[Title='"+R.columnDisplayName+"']").focus();D("input[value='OK']").attr("disabled","disabled")}}D("span#SPRequireUnique"+R.columnStaticName).html(aa)});if(R.completefunc!=null){R.completefunc()}};D.fn.SPServices.SPGetDisplayFromStatic=function(S){var U=D.extend({},{webURL:"",listName:"",columnStaticName:""},S);var T="";var R="";D().SPServices({operation:"GetList",async:false,webURL:U.webURL,listName:U.listName,completefunc:function(W,V){D(W.responseXML).find("Field").each(function(){if(D(this).attr("StaticName")==U.columnStaticName){R=D(this).attr("DisplayName");return false}})}});return R};D.fn.SPServices.SPGetStaticFromDisplay=function(S){var U=D.extend({},{webURL:"",listName:"",columnDisplayName:""},S);var R="";var T="";D().SPServices({operation:"GetList",async:false,listName:U.listName,completefunc:function(W,V){D(W.responseXML).find("Field").each(function(){if(D(this).attr("DisplayName")==U.columnDisplayName){T=D(this).attr("StaticName");return false}})}});return T};D.fn.SPServices.SPRedirectWithID=function(Z){var R=D.extend({},{redirectUrl:""},Z);var X=u();var S=D().SPServices.SPGetQueryString();var U=S.ID;var V=S.List;var Y=S.RootFolder;var W=S.ContentTypeId;if(S.ID==undefined){U=D().SPServices.SPGetLastItemId({listName:X});D("form[name='aspnetForm']").each(function(){var ab=(location.href.indexOf("?")>0)?location.href.substring(0,location.href.indexOf("?")):location.href;var ac=(typeof S.Source=="string")?"Source="+S.Source.replace(/\//g,"%2f").replace(/:/g,"%3a"):"";var aa=new Array();if(V!=undefined){aa.push("List="+V)}if(Y!=undefined){aa.push("RootFolder="+Y)}if(W!=undefined){aa.push("ContentTypeId="+W)}var ad=ab+((aa.length>0)?("?"+aa.join("&")+"&"):"?")+"Source="+ab+"?ID="+U+((ac.length>0)?("%26RealSource="+S.Source):"")+((typeof S.RedirectURL=="string")?("%26RedirectURL="+S.RedirectURL):"");D(this).attr("action",ad)})}else{while(S.ID==U){U=D().SPServices.SPGetLastItemId({listName:X})}var T=(typeof S.RedirectURL=="string")?S.RedirectURL:R.redirectUrl;location.href=T+"?ID="+U+((typeof S.RealSource=="string")?("&Source="+S.RealSource):"")}};D.fn.SPServices.SPSetMultiSelectSizes=function(Z){var R=D.extend({},{multiSelectColumn:"",minWidth:0,maxWidth:0},Z);var V=D("select[ID$='SelectCandidate'][Title^='"+R.multiSelectColumn+" ']");var X=V.closest("span").find("select[ID$='SelectResult'][Title^='"+R.multiSelectColumn+" ']");var W=h("SPSetMultiSelectSizes",R.multiSelectColumn);V.clone().appendTo(V.closest("span")).css({width:"auto",height:0,visibility:"hidden"}).attr({id:W,length:0});var U=D("#"+W);V.find("option").each(function(){U.append("<option value='"+D(this).html()+"'>"+D(this).html()+"</option>")});X.find("option").each(function(){U.append("<option value='"+D(this).html()+"'>"+D(this).html()+"</option>")});var S=D("#"+W).width()+5;var Y=S;if(R.minWidth>0||R.maxWidth>0){if(S<R.minWidth){S=R.minWidth}if(Y<R.minWidth){Y=R.minWidth}if(Y>R.maxWidth){Y=R.maxWidth}}var T=S-17;V.css("width",T+"px").parent().css("width",Y+"px");X.css("width",T+"px").parent().css("width",Y+"px");D("#"+W).remove()};D.fn.SPServices.SPScriptAudit=function(S){var T=D.extend({},{webURL:"",listName:"",outputId:"",auditForms:true,auditViews:true,auditPages:true,auditPagesListName:"Pages",showHiddenLists:false,showNoScript:false,showSrc:true},S);var R=["Display","Edit","New"];var U;D("#"+T.outputId).append("<table id='SPScriptAudit' width='100%' style='border-collapse: collapse;' border=0 cellSpacing=0 cellPadding=1><tr><th></th><th>List</th><th>Page Class</th><th>Page Type</th><th>Page</th>"+(T.showSrc?"<th>Script in the Page</th><th>Script in a Web Part</th>":"")+"<th>jQuery</th></tr></table>");D("#SPScriptAudit th").attr("class","ms-vh2-nofilter");if(T.auditForms||T.auditViews){D().SPServices({operation:"GetListCollection",webURL:T.webURL,async:false,completefunc:function(W,V){D(W.responseXML).find(n).each(function(){D(this).find("List").each(function(){U=D(this);if((T.showHiddenLists&&U.attr("Hidden")=="False")||!T.showHiddenLists){if(T.auditForms){D().SPServices({operation:"GetListContentTypes",webURL:T.webURL,listName:U.attr("ID"),async:false,completefunc:function(Y,X){D(Y.responseXML).find("ContentType").each(function(){if(D(this).attr("ID").substring(0,6)!="0x0120"){D(this).find("FormUrls").each(function(){for(var Z=0;Z<R.length;Z++){D(this).find(R[Z]).each(function(){k(T,U,"Form",R[Z],((T.webURL.length>0)?T.webURL:D().SPServices.SPGetCurrentSite())+g+D(this).text())})}})}})}})}if(T.auditViews){D().SPServices({operation:"GetViewCollection",webURL:T.webURL,listName:U.attr("ID"),async:false,completefunc:function(Y,X){D(Y.responseXML).find("View").each(function(){k(T,U,"View",D(this).attr("DisplayName"),D(this).attr("Url"))})}})}}})})}})}if(T.auditPages){D().SPServices({operation:"GetList",async:false,webURL:T.webURL,listName:T.auditPagesListName,completefunc:function(W,V){D(W.responseXML).find("List").each(function(){U=D(this)})}});D().SPServices({operation:"GetListItems",async:false,webURL:T.webURL,listName:T.auditPagesListName,CAMLQuery:"<Query><Where><Neq><FieldRef Name='ContentType'/><Value Type='Text'>Folder</Value></Neq></Where></Query>",CAMLViewFields:"<ViewFields><FieldRef Name='Title'/><FieldRef Name='FileRef'/></ViewFields>",CAMLRowLimit:0,completefunc:function(W,V){D(W.responseXML).find("[nodeName=z:row]").each(function(){var Y=D(this).attr("ows_FileRef").split(";#")[1];var X=(D(this).attr("ows_Title")!=undefined)?D(this).attr("ows_Title"):"";if(Y.indexOf(".aspx")>0){k(T,U,"Page",X,g+Y)}})}})}D("#SPScriptAudit tr[class='ms-alternating']:even").attr("class","")};function k(R,T,ad,X,V){var ab=0;var ac=0;var U=new Object();U.type=[];U.src=[];U.script=[];var W=new Object();W.type=[];W.src=[];W.script=[];var S="$(";var Y=RegExp("<head[\\s\\S]*?/head>","gi");var aa=RegExp("<script[\\s\\S]*?/script>","gi");var Z;D.ajax({type:"GET",url:V,dataType:"text",success:function(af){headHtml=Y.exec(af);while(scriptMatch=aa.exec(headHtml)){var ai=z(scriptMatch,"language");var ak=z(scriptMatch,"type");var ae=z(scriptMatch,"src");if(ae!=null&&ae.length>0&&!E(ae)){W.type.push((ai!=null&&ai.length>0)?ai:ak);W.src.push(ae)}var am=scriptMatch.innerHTML;if(am!=undefined&&am.indexOf(S)>-1){W.script.push(scriptMatch.innerHTML);ab++}}D(af).find("script").each(function(){if(D(this).closest("td[id^='MSOZoneCell_WebPartWP']").html()==null){if((D(this).attr("src")!=undefined)&&(D(this).attr("src").length>0)&&!E(D(this).attr("src"))){W.type.push(D(this).attr("language").length>0?D(this).attr("language"):D(this).attr("type"));W.src.push(D(this).attr("src"))}if(D(this).html().indexOf(S)>-1){W.script.push(D(this).html());ab++}}else{if(D(this).attr("src")!=undefined&&D(this).attr("src").length>0){U.type.push(D(this).attr("language").length>0?D(this).attr("language"):D(this).attr("type"));U.src.push(D(this).attr("src"))}if(D(this).html().indexOf(S)>-1){U.script.push(D(this).html());ac++}}});if((!R.showNoScript&&(U.type.length>0||W.type.length>0))||R.showNoScript){var aj=V.substring(0,V.lastIndexOf(g)+1);var ag="<tr class=ms-alternating><td class=ms-vb-icon><a href='"+T.attr("DefaultViewUrl")+"'><IMG border=0 src='"+T.attr("ImageUrl")+"'width=16 height=16></A></TD><td class=ms-vb2><a href='"+T.attr("DefaultViewUrl")+"'>"+T.attr("Title")+((T.attr("Hidden")=="True")?"(Hidden)":"")+"</td><td class=ms-vb2>"+ad+"</td><td class=ms-vb2>"+X+"</td><td class=ms-vb2><a href='"+V+"'>"+w(V)+"</td>";if(R.showSrc){ag+="<td valign='top'><table width='100%' style='border-collapse: collapse;' border=0 cellSpacing=0 cellPadding=1>";for(var ah=0;ah<W.type.length;ah++){var al=(W.src[ah].substr(0,1)!=g)?aj+W.src[ah]:W.src[ah];ag+="<tr><td class=ms-vb2 width='30%'>"+W.type[ah]+"</td>";ag+="<td class=ms-vb2 width='70%'><a href='"+al+"'>"+w(W.src[ah])+"</td></tr>"}if(ab>0){for(var ah=0;ah<W.script.length;ah++){ag+="<tr><td class=ms-vb2 colspan=99><textarea class=ms-vb2 readonly='readonly' rows='5' cols='50'>"+W.script[ah]+"</textarea></td></tr>"}}ag+="</table></td>";ag+="<td valign='top'><table width='100%' style='border-collapse: collapse;' border=0 cellSpacing=0 cellPadding=1>";for(var ah=0;ah<U.type.length;ah++){var al=(U.src[ah].substr(0,1)!=g)?aj+U.src[ah]:U.src[ah];ag+="<tr><td class=ms-vb2 width='30%'>"+U.type[ah]+"</td>";ag+="<td class=ms-vb2 width='70%'><a href='"+al+"'>"+w(U.src[ah])+"</td></tr>"}if(ac>0){for(var ah=0;ah<U.script.length;ah++){ag+="<tr><td class=ms-vb2 colspan=99><textarea class=ms-vb2 readonly='readonly' rows='5' cols='50'>"+U.script[ah]+"</textarea></td></tr>"}}ag+="</table></td>"}ag+="<td class=ms-vb2>"+(((ab+ac)>0)?"Yes":"No")+"</td></tr>";D("#SPScriptAudit").append(ag)}}})}function z(T,S){var R=RegExp(S+"=(\"([^\"]*)\")|('([^']*)')","gi");if(matches=R.exec(T)){return matches[2]}return null}function E(T){var S=["WebResource.axd","_layouts"];for(var R=0;R<S.length;R++){if(T.indexOf(S[R])>-1){return true}}return false}D.fn.SPServices.SPArrangeChoices=function(S){var T=D.extend({},{columnName:"",perRow:99,randomize:false},S);var V=false;var S=new Array();var R;D().SPServices({operation:"GetList",async:false,listName:u(),completefunc:function(X,W){D(X.responseXML).find("Fields").each(function(){D(this).find("Field").each(function(){if(D(this).attr("DisplayName")==T.columnName){V=(D(this).attr("FillInChoice")=="TRUE")?true:false;return false}})})}});var U=RegExp('FieldName="'+T.columnName+'"',"gi");D("td.ms-formbody").each(function(){if(U.test(D(this).html())){var Y=D(this).find("tr").length;var X=0;var Z;var W;D(this).find("tr").each(function(){X++;if(V&&X==Y-1){Z=D(this).find("td").html()}else{if(V&&X==Y){W=D(this).find("td").html()}else{S.push(D(this).html())}}});R="<TR>";if(T.randomize){S.sort(N)}for(i=0;i<S.length;i++){R+=S[i];if((i+1)%T.perRow==0){R+="</TR><TR>"}}R+="</TR>";if(V){R+="<TR><TD colspan='99'>"+Z+W+"</TD></TR>"}D(this).find("tr").remove();D(this).find("table").append(R);return false}})};D.fn.SPServices.SPAutocomplete=function(T){var U=D.extend({},{WebURL:"",sourceList:"",sourceColumn:"",columnName:"",CAMLQuery:"",numChars:0,ignoreCase:false,slideDownSpeed:"fast",processingIndicator:"<img src='_layouts/images/REFRESH.GIF'/>",debug:false},T);var S=D("input[Title='"+U.columnName+"']");D("input[Title='"+U.columnName+"']").css("position","");var W=D(S).attr("ID");var V=D(S).css("color");if(S.html()==null&&U.debug){B("SPServices.SPAutocomplete","columnName: "+U.columnName,"Column is not an input control or is not found on page");return}var R=h("SPAutocomplete",U.columnName);S.after("<ul id='"+R+"' style='display:none;padding:2px;border:1px solid #2A1FAA;background-color:#FFF;position:absolute;z-index:40;margin:0'>");D("#"+R).css("width",S.width());S.wrap("<table id='"+R+"container' cellpadding='0' cellspacing='0' width='100%'><tr><td width='"+S.width()+"'></td></tr></table>");S.closest("tr").append("<td id='"+R+"processingIndicator' style='display:none;'>"+U.processingIndicator+"</td>");D(S).keyup(function(){var aa=D(this).val();if(aa.length<U.numChars){D("#"+R).hide();return false}D("#"+R).hide();D("#"+R+"processingIndicator").show();var Z=new Array();var X="<Query><OrderBy><FieldRef Name='"+U.sourceColumn+"'/></OrderBy><Where>";if(U.CAMLQuery.length>0){X+="<And>"}X+="<IsNotNull><FieldRef Name='"+U.sourceColumn+"'/></IsNotNull>";if(U.CAMLQuery.length>0){X+=U.CAMLQuery+"</And>"}X+="</Where></Query>";D().SPServices({operation:"GetListItems",async:false,webURL:U.WebURL,listName:U.sourceList,CAMLQuery:X,CAMLViewFields:"<ViewFields><FieldRef Name='"+U.sourceColumn+"' /></ViewFields>",CAMLRowLimit:0,completefunc:function(ad,ab){var ac=U.ignoreCase?aa.toUpperCase():aa;D(ad.responseXML).find("[nodeName=z:row]").each(function(){var ae=U.ignoreCase?D(this).attr("ows_"+U.sourceColumn).toUpperCase():D(this).attr("ows_"+U.sourceColumn);if(ac==ae.substr(0,ac.length)){Z.push(D(this).attr("ows_"+U.sourceColumn))}})}});var Y="";for(i=0;i<Z.length;i++){Y+="<li style='display: block; position: relative; cursor: pointer;'>"+Z[i]+"</li>"}D("#"+R).html(Y);D("#"+R+" li").click(function(){D("#"+R).fadeOut(U.slideUpSpeed);D("#"+W).val(D(this).html())}).mouseover(function(){var ab={cursor:"hand",color:"#ffffff",background:"#3399ff"};D(this).css(ab)}).mouseout(function(){var ab={cursor:"inherit",color:V,background:"transparent"};D(this).css(ab)});D("#"+R+"processingIndicator").fadeOut("slow");if(Z.length>0){D("#"+R).slideDown(U.slideDownSpeed)}})};D.fn.SPServices.SPGetQueryString=function(){var W=new Object();var R=location.search.substring(1,location.search.length);var S=R.split("&");for(var U=0;U<S.length;U++){var T=/^([^=]+)=(.+)/i,V=T.exec(S[U]);if(T.test(location.href)){if(V.length>2){W[V[1]]=unescape(V[2]).replace("+"," ")}}}return W};function t(W,V,U){if(V==undefined){return""}var R;switch(W.attr("Type")){case"Text":R=V;break;case"URL":switch(W.attr("Format")){case"Hyperlink":R="<a href='"+V.substring(0,V.search(","))+"'>"+V.substring(V.search(",")+1)+"</a>";break;case"Image":R="<img alt='"+V.substring(V.search(",")+1)+"' src='"+V.substring(0,V.search(","))+"'/>";break;default:R=V;break}break;case"User":R="<a href='/_layouts/userdisp.aspx?ID="+V.substring(0,V.search(";#"))+"&Source="+P(location.href)+"'>"+V.substring(V.search(";#")+2)+"</a>";break;case"Calculated":var S=V.split(";#");R=S[1];break;case"Number":R=parseFloat(V).toFixed(W.attr("Decimals")).toString();break;case"Currency":R=parseFloat(V).toFixed(W.attr("Decimals")).toString();break;case"Lookup":var T;D().SPServices({operation:"GetFormCollection",async:false,listName:W.attr("List"),completefunc:function(Y,X){D(Y.responseXML).find("Form").each(function(){if(D(this).attr("Type")=="DisplayForm"){T=D(this).attr("Url");return false}})}});R="<a href='"+U.relatedWebURL+g+T+"?ID="+V.substring(0,V.search(";#"))+"&RootFolder=*'>"+V.substring(V.search(";#")+2)+"</a>";break;case"Counter":R=V;break;default:R=V;break}return R}function L(U,T){var R="<table class='ms-vb' width='100%'>";for(var S=0;S<U.attributes.length;S++){R+="<tr><td width='10px' style='font-weight:bold;'>"+S+"</td><td width='100px'>"+U.attributes.item(S).nodeName+"</td><td>"+r(U.attributes.item(S).nodeValue)+"</td></tr>"}R+="</table>";return R}function u(){var T=location.href;var S=T.substring(0,T.indexOf(".aspx"));var U=O(S.substring(0,S.lastIndexOf(g))).toUpperCase();var R="";D().SPServices({operation:"GetListCollection",async:false,completefunc:function(W,V){D(W.responseXML).find("List").each(function(){var X=D(this).attr("DefaultViewUrl");var Y=X.substring(0,X.lastIndexOf(g)).toUpperCase();if(U.indexOf(Y)>0){R=D(this).attr("ID")}})}});return R}function K(R){if((this.Obj=D("select[Title='"+R+"']")).html()!=null){this.Type="S"}else{if((this.Obj=D("input[Title='"+R+"']")).html()!=null){this.Type="C"}else{if((this.Obj=D("select[ID$='SelectCandidate'][Title^='"+R+" ']")).html()!=null){this.Type="M"}else{if((this.Obj=D("select[ID$='SelectCandidate'][Title$=': "+R+"']")).html()!=null){this.Type="M"}else{this.Type=null}}}}}function B(S,U,T){var R="<b>Error in function</b><br/>"+S+"<br/><b>Parameter</b><br/>"+U+"<br/><b>Message</b><br/>"+T+"<br/><br/><span onmouseover='this.style.cursor=\"hand\";' onmouseout='this.style.cursor=\"inherit\";' style='width=100%;text-align:right;'>Click to continue</span></div>";f(R)}function f(W){var T="position:absolute;width:300px;height:150px;padding:10px;background-color:#000000;color:#ffffff;z-index:30;font-family:'Arial';font-size:12px;display:none;";D("#aspnetForm").parent().append("<div id='SPServices_msgBox' style="+T+">"+W);var R=D("#SPServices_msgBox").height();var V=D("#SPServices_msgBox").width();var U=(D(window).width()/2)-(V/2)+"px";var S=(D(window).height()/2)-(R/2)-100+"px";D("#SPServices_msgBox").css({border:"5px #C02000 solid",left:U,top:S}).show().fadeTo("slow",0.75).click(function(){D(this).fadeOut("3000",function(){D(this).remove()})})}function h(R,S){return R+"_"+D().SPServices.SPGetStaticFromDisplay({listName:u(),columnDisplayName:S})}function N(){return(Math.round(Math.random())-0.5)}function r(R){return((R.indexOf("http")==0)||(R.indexOf(g)==0))?"<a href='"+R+"'>"+R+"</a>":R}function w(R){return R.substring(R.lastIndexOf(g)+1,R.length)}function a(R){return R.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s(R){return R.replace(/&/g,"&amp;")}function O(R){return R.replace(/%20/g," ")}function P(R){return R.replace(/&/g,"%26")}function v(S,R){return"<"+S+">"+R+"</"+S+">"}})(jQuery);
