﻿ICE={};ICE.useConfig=true;(function(){var a=parent==window||parent!=window&&!/ide\.htm/i.test(parent.location.href);if(a){ICE.DEFAULT_LOGIN_PC="CTRL+E";ICE.DEFAULT_LOGIN_MAC="CMD+E";ICE.getSiteRoot=function(){var h="includes/ice/ice.js",a=null,g="",d=document.getElementsByTagName("script");for(var c=0;c<d.length;c++){g=d[c].src.toLowerCase();if(typeof g!="undefined")if(g.indexOf(h)!=-1){a=d[c].src;break}}a=a.substring(0,a.length-h.length);if(!/http/i.test(a)){var j=a.match(/\.\.\//g),k=j?j.length:0,b=window.location,e=b.pathname.replace(/\/([^\/]*)$/,"/"),f=e.split("/"),i=f.length-k-1;f.length=i>=0?i:0;e=f.join("/")+"/";a=b.protocol+"//"+b.hostname+(b.port?":"+b.port:"")+e}return a};ICE.getConfig=function(){var a=document.createElement("SCRIPT");a.type="text/javascript";var c=document.getElementsByTagName("HEAD")[0];c.appendChild(a);a.onreadystatechange=a.onload=function(a){a=a||event;if(a.type=="readystatechange"){if(typeof this.jsloaded=="undefined"&&this.readyState=="complete"){this.jsloaded=true;ICE.attachKeyEvent()}}else ICE.attachKeyEvent()};var b=ICE.getSiteRoot();a.src=b+"includes/ice/ice.conf.js"};ICE.startEdit=function(){var f=ICE.getSiteRoot(),i=f.replace(/\/$/gi,"").split("/"),a=window.location.href,e=window.location.pathname,h=["#"," ","&"],g=new RegExp("("+h.join("|")+")","gi"),c=e.replace(g,function(b,a){return escape(a)});if(c!=e){var b=window.location;a=b.protocol+"//"+b.host+c+b.search+b.hash}var d=a.split("/");d.splice(0,i.length);a=d.join("/");a=f+"includes/ice/ide.html#page="+encodeURIComponent(a);window.location.href=a};ICE.attachKeyEvent=function(){var b=navigator.userAgent.match(/mac/i)?"MAC":"PC",a=ICE["DEFAULT_LOGIN_"+b];if(typeof ICE["USER_LOGIN_"+b]=="string")a=ICE["USER_LOGIN_"+b];if(a!==""&&a.indexOf("+")!=-1){ICE.shortcut={ctrlKey:a.indexOf("CTRL+")!=-1,altKey:a.indexOf("ALT+")!=-1,metaKey:a.indexOf("CMD+")!=-1,shiftKey:a.indexOf("SHIFT+")!=-1,keyCode:a.slice(-1).charCodeAt(0),platform:b};ICE.isShortcutPressed=function(b){var a=true;a=a&&(ICE.shortcut.ctrlKey?b.ctrlKey:!b.ctrlKey);if(ICE.shortcut.platform=="MAC")a=a&&(ICE.shortcut.metaKey?b.metaKey:!b.metaKey);a=a&&(ICE.shortcut.altKey?b.altKey:!b.altKey);a=a&&(ICE.shortcut.shiftKey?b.shiftKey:!b.shiftKey);a=a&&ICE.shortcut.keyCode==b.keyCode;return a};ICE.onkeydown=function(a){a=a||event;if(ICE.isShortcutPressed(a)){try{a.cancelBubble=true}catch(b){}try{a.returnValue=false}catch(b){}try{a.stopPropagation()}catch(b){}try{a.preventDefault()}catch(b){}ICE.startEdit();return false}};if(document.addEventListener)document.addEventListener("keydown",ICE.onkeydown,false);else if(document.attachEvent)document.attachEvent("onkeydown",ICE.onkeydown);else document.onkeydown=ICE.onkeydown}};if(ICE.useConfig)ICE.getConfig();else ICE.attachKeyEvent()}})()
