AJS.toInit(function(B){var A=AJS.Data.get("context-path");
var C=B("#edit-in-word, #edit-in-word-pathauth, a.office-editable, a.office-editable-pathauth");
C.click(function(G){G.preventDefault();
var F=B(this);
var E=F.attr("data-use-path-auth");
if(typeof (E)=="undefined"){E=(F.attr("id")=="edit-in-word-pathauth"||F.hasClass("office-editable-pathauth"))
}else{E=(E==="true")
}var H=F.attr("href");
var D=F.attr("data-prog-id");
if(typeof (D)=="undefined"){D=getProgID(H)
}return doEditInOffice(A,H,D,E)
})
});
function getProgID(A){var B=A.substring(A.lastIndexOf(".")+1);
switch(B){case"ppt":case"pptx":case"ppsx":case"pot":case"potx":case"pptm":return"PowerPoint.Show";
case"doc":case"docx":case"dot":case"dotx":return"Word.Document";
case"xls":case"xlt":case"xlsx":case"xlst":case"xlsm":return"Excel.Sheet";
default:return""
}}function filterPath(C){var A=getCookie("jsessionid");
if(!A){A=getCookie("JSESSIONID")
}if(A){var B=C.split("/");
var E="";
for(var D=0;
D<B.length-1;
D++){if(B[D].length){E=E+"/"+B[D]
}}E=E+"/ocauth/"+A+"/"+B[B.length-1];
return E
}else{return C
}}function getCookie(B){var F=document.cookie.split(";");
var C="";
var D="";
var E="";
for(var A=0;
A<F.length;
A++){C=F[A].split("=");
D=C[0].replace(/^\s+|\s+$/g,"");
if(D==B){if(C.length>1){E=unescape(C[1].replace(/^\s+|\s+$/g,""))
}return E
}C=null;
D=""
}return null
}function getBaseUrl(){return location.protocol+"//"+location.host
}function doEditInOffice(B,C,F,K){var I=getBaseUrl();
if(window.ActiveXObject){var G;
try{G=new ActiveXObject("SharePoint.OpenDocuments.1")
}catch(D){window.alert("Unable to create an ActiveX object to open the document. This is most likely because of the security settings for your browser.");
return false
}if(G){if(K){C=filterPath(C)
}G.EditDocument(I+C,F);
return false
}else{window.alert("Cannot instantiate the required ActiveX control to open the document. This is most likely because you do not have Office installed or you have an older version of Office.");
return false
}}else{if(window.URLLauncher){var H=navigator.appVersion.indexOf("Mac")!=-1;
if(K&&!H){C=filterPath(C)
}var E=new URLLauncher();
if(E.open2){var J=new RegExp(B+"/plugins/servlet/[^/]+/");
var L=C.match(J);
var A=C.substring(L[0].length);
E.open2(encodeURI(L[0]),encodeURI(A))
}else{E.open(C)
}}else{if(window.InstallTrigger){if(window.confirm("A plugin is required to use this feature. Would you like to download it?")){InstallTrigger.install({"WebDAV Launcher":"https://update.atlassian.com/office-connector/URLLauncher/latest/webdavloader.xpi"})
}}else{window.alert("Firefox or Internet Explorer is required to use this feature.")
}}}return false
}function enableEdit(A){A.style.cursor="pointer";
A.style.backgroundColor="#cccccc";
A.style.color=""
}function disableEdit(A){A.style.cursor="";
A.style.backgroundColor="#ffffff";
A.style.color="#ffffff"
};

