You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

280 lines
11 KiB

4 years ago
  1. //CdnPath=http://ajax.aspnetcdn.com/ajax/4.5.1/1/SmartNav.js
  2. var snSrc;
  3. if ((typeof(window.__smartNav) == "undefined") || (window.__smartNav == null))
  4. {
  5. window.__smartNav = new Object();
  6. window.__smartNav.update = function()
  7. {
  8. var sn = window.__smartNav;
  9. var fd;
  10. document.detachEvent("onstop", sn.stopHif);
  11. sn.inPost = false;
  12. try { fd = frames["__hifSmartNav"].document; } catch (e) {return;}
  13. var fdr = fd.getElementsByTagName("asp_smartnav_rdir");
  14. if (fdr.length > 0)
  15. {
  16. if ((typeof(sn.sHif) == "undefined") || (sn.sHif == null))
  17. {
  18. sn.sHif = document.createElement("IFRAME");
  19. sn.sHif.name = "__hifSmartNav";
  20. sn.sHif.style.display = "none";
  21. sn.sHif.src = snSrc;
  22. }
  23. try {window.location = fdr[0].url;} catch (e) {};
  24. return;
  25. }
  26. var fdurl = fd.location.href;
  27. var index = fdurl.indexOf(snSrc);
  28. if ((index != -1 && index == fdurl.length-snSrc.length)
  29. || fdurl == "about:blank")
  30. return;
  31. var fdurlb = fdurl.split("?")[0];
  32. if (document.location.href.indexOf(fdurlb) < 0)
  33. {
  34. document.location.href=fdurl;
  35. return;
  36. }
  37. sn._savedOnLoad = window.onload;
  38. window.onload = null;
  39. window.__smartNav.updateHelper();
  40. }
  41. window.__smartNav.updateHelper = function()
  42. {
  43. if (document.readyState != "complete")
  44. {
  45. window.setTimeout(window.__smartNav.updateHelper, 25);
  46. return;
  47. }
  48. window.__smartNav.loadNewContent();
  49. }
  50. window.__smartNav.loadNewContent = function()
  51. {
  52. var sn = window.__smartNav;
  53. var fd;
  54. try { fd = frames["__hifSmartNav"].document; } catch (e) {return;}
  55. if ((typeof(sn.sHif) != "undefined") && (sn.sHif != null))
  56. {
  57. sn.sHif.removeNode(true);
  58. sn.sHif = null;
  59. }
  60. var hdm = document.getElementsByTagName("head")[0];
  61. var hk = hdm.childNodes;
  62. var tt = null;
  63. var i;
  64. for (i = hk.length - 1; i>= 0; i--)
  65. {
  66. if (hk[i].tagName == "TITLE")
  67. {
  68. tt = hk[i].outerHTML;
  69. continue;
  70. }
  71. if (hk[i].tagName != "BASEFONT" || hk[i].innerHTML.length == 0)
  72. hdm.removeChild(hdm.childNodes[i]);
  73. }
  74. var kids = fd.getElementsByTagName("head")[0].childNodes;
  75. for (i = 0; i < kids.length; i++)
  76. {
  77. var tn = kids[i].tagName;
  78. var k = document.createElement(tn);
  79. k.id = kids[i].id;
  80. k.mergeAttributes(kids[i]);
  81. switch(tn)
  82. {
  83. case "TITLE":
  84. if (tt == kids[i].outerHTML)
  85. continue;
  86. k.innerText = kids[i].text;
  87. hdm.insertAdjacentElement("afterbegin", k);
  88. continue;
  89. case "BASEFONT" :
  90. if (kids[i].innerHTML.length > 0)
  91. continue;
  92. break;
  93. default:
  94. var o = document.createElement("BODY");
  95. o.innerHTML = "<BODY>" + kids[i].outerHTML + "</BODY>";
  96. k = o.firstChild;
  97. break;
  98. }
  99. if((typeof(k) != "undefined") && (k != null))
  100. hdm.appendChild(k);
  101. }
  102. document.body.clearAttributes();
  103. document.body.id = fd.body.id;
  104. document.body.mergeAttributes(fd.body);
  105. var newBodyLoad = fd.body.onload;
  106. if ((typeof(newBodyLoad) != "undefined") && (newBodyLoad != null))
  107. document.body.onload = newBodyLoad;
  108. else
  109. document.body.onload = sn._savedOnLoad;
  110. var s = "<BODY>" + fd.body.innerHTML + "</BODY>";
  111. if ((typeof(sn.hif) != "undefined") && (sn.hif != null))
  112. {
  113. var hifP = sn.hif.parentElement;
  114. if ((typeof(hifP) != "undefined") && (hifP != null))
  115. sn.sHif=hifP.removeChild(sn.hif);
  116. }
  117. document.body.innerHTML = s;
  118. var sc = document.scripts;
  119. for (i = 0; i < sc.length; i++)
  120. {
  121. sc[i].text = sc[i].text;
  122. }
  123. sn.hif = document.all("__hifSmartNav");
  124. if ((typeof(sn.hif) != "undefined") && (sn.hif != null))
  125. {
  126. var hif = sn.hif;
  127. sn.hifName = "__hifSmartNav" + (new Date()).getTime();
  128. frames["__hifSmartNav"].name = sn.hifName;
  129. sn.hifDoc = hif.contentWindow.document;
  130. if (sn.ie5)
  131. hif.parentElement.removeChild(hif);
  132. window.setTimeout(sn.restoreFocus,0);
  133. }
  134. if (typeof(window.onload) == "string")
  135. {
  136. try { eval(window.onload) } catch (e) {};
  137. }
  138. else if ((typeof(window.onload) != "undefined") && (window.onload != null))
  139. {
  140. try { window.onload() } catch (e) {};
  141. }
  142. sn._savedOnLoad = null;
  143. sn.attachForm();
  144. };
  145. window.__smartNav.restoreFocus = function()
  146. {
  147. if (window.__smartNav.inPost == true) return;
  148. var curAe = document.activeElement;
  149. var sAeId = window.__smartNav.ae;
  150. if (((typeof(sAeId) == "undefined") || (sAeId == null)) ||
  151. (typeof(curAe) != "undefined") && (curAe != null) && (curAe.id == sAeId || curAe.name == sAeId))
  152. return;
  153. var ae = document.all(sAeId);
  154. if ((typeof(ae) == "undefined") || (ae == null)) return;
  155. try { ae.focus(); } catch(e){};
  156. }
  157. window.__smartNav.saveHistory = function()
  158. {
  159. if ((typeof(window.__smartNav.hif) != "undefined") && (window.__smartNav.hif != null))
  160. window.__smartNav.hif.removeNode();
  161. if ((typeof(window.__smartNav.sHif) != "undefined") && (window.__smartNav.sHif != null)
  162. && (typeof(document.all[window.__smartNav.siHif]) != "undefined")
  163. && (document.all[window.__smartNav.siHif] != null)) {
  164. document.all[window.__smartNav.siHif].insertAdjacentElement(
  165. "BeforeBegin", window.__smartNav.sHif);
  166. }
  167. }
  168. window.__smartNav.stopHif = function()
  169. {
  170. document.detachEvent("onstop", window.__smartNav.stopHif);
  171. var sn = window.__smartNav;
  172. if (((typeof(sn.hifDoc) == "undefined") || (sn.hifDoc == null)) &&
  173. (typeof(sn.hif) != "undefined") && (sn.hif != null))
  174. {
  175. try {sn.hifDoc = sn.hif.contentWindow.document;}
  176. catch(e){sn.hifDoc=null}
  177. }
  178. if (sn.hifDoc != null)
  179. {
  180. try {sn.hifDoc.execCommand("stop");} catch (e){}
  181. }
  182. }
  183. window.__smartNav.init = function()
  184. {
  185. var sn = window.__smartNav;
  186. window.__smartNav.form.__smartNavPostBack.value = 'true';
  187. document.detachEvent("onstop", sn.stopHif);
  188. document.attachEvent("onstop", sn.stopHif);
  189. try { if (window.event.returnValue == false) return; } catch(e) {}
  190. sn.inPost = true;
  191. if ((typeof(document.activeElement) != "undefined") && (document.activeElement != null))
  192. {
  193. var ae = document.activeElement.id;
  194. if (ae.length == 0)
  195. ae = document.activeElement.name;
  196. sn.ae = ae;
  197. }
  198. else
  199. sn.ae = null;
  200. try {document.selection.empty();} catch (e) {}
  201. if ((typeof(sn.hif) == "undefined") || (sn.hif == null))
  202. {
  203. sn.hif = document.all("__hifSmartNav");
  204. sn.hifDoc = sn.hif.contentWindow.document;
  205. }
  206. if ((typeof(sn.hifDoc) != "undefined") && (sn.hifDoc != null))
  207. try {sn.hifDoc.designMode = "On";} catch(e){};
  208. if ((typeof(sn.hif.parentElement) == "undefined") || (sn.hif.parentElement == null))
  209. document.body.appendChild(sn.hif);
  210. var hif = sn.hif;
  211. hif.detachEvent("onload", sn.update);
  212. hif.attachEvent("onload", sn.update);
  213. window.__smartNav.fInit = true;
  214. };
  215. window.__smartNav.submit = function()
  216. {
  217. window.__smartNav.fInit = false;
  218. try { window.__smartNav.init(); } catch(e) {}
  219. if (window.__smartNav.fInit) {
  220. window.__smartNav.form._submit();
  221. }
  222. };
  223. window.__smartNav.attachForm = function()
  224. {
  225. var cf = document.forms;
  226. for (var i=0; i<cf.length; i++)
  227. {
  228. if ((typeof(cf[i].__smartNavEnabled) != "undefined") && (cf[i].__smartNavEnabled != null))
  229. {
  230. window.__smartNav.form = cf[i];
  231. window.__smartNav.form.insertAdjacentHTML("beforeEnd", "<input type='hidden' name='__smartNavPostBack' value='false' />");
  232. break;
  233. }
  234. }
  235. var snfm = window.__smartNav.form;
  236. if ((typeof(snfm) == "undefined") || (snfm == null)) return false;
  237. var sft = snfm.target;
  238. if (sft.length != 0 && sft.indexOf("__hifSmartNav") != 0) return false;
  239. var sfc = snfm.action.split("?")[0];
  240. var url = window.location.href.split("?")[0];
  241. if (url.charAt(url.length-1) != '/' && url.lastIndexOf(sfc) + sfc.length != url.length) return false;
  242. if (snfm.__formAttached == true) return true;
  243. snfm.__formAttached = true;
  244. snfm.attachEvent("onsubmit", window.__smartNav.init);
  245. snfm._submit = snfm.submit;
  246. snfm.submit = window.__smartNav.submit;
  247. snfm.target = window.__smartNav.hifName;
  248. return true;
  249. };
  250. window.__smartNav.hifName = "__hifSmartNav" + (new Date()).getTime();
  251. window.__smartNav.ie5 = navigator.appVersion.indexOf("MSIE 5") > 0;
  252. var rc = window.__smartNav.attachForm();
  253. var hif = document.all("__hifSmartNav");
  254. if ((typeof(snSrc) == "undefined") || (snSrc == null)) {
  255. if (typeof(window.dialogHeight) != "undefined") {
  256. snSrc = "IEsmartnav1";
  257. hif.src = snSrc;
  258. } else {
  259. snSrc = hif.src;
  260. }
  261. }
  262. if (rc)
  263. {
  264. var fsn = frames["__hifSmartNav"];
  265. fsn.name = window.__smartNav.hifName;
  266. window.__smartNav.siHif = hif.sourceIndex;
  267. try {
  268. if (fsn.document.location != snSrc)
  269. {
  270. fsn.document.designMode = "On";
  271. hif.attachEvent("onload",window.__smartNav.update);
  272. window.__smartNav.hif = hif;
  273. }
  274. }
  275. catch (e) { window.__smartNav.hif = hif; }
  276. window.attachEvent("onbeforeunload", window.__smartNav.saveHistory);
  277. }
  278. else
  279. window.__smartNav = null;
  280. }