/*
octane8.js
copyright 2004, Octigon, LLC
created on 1/16/04
*** If you need to modify this file, you should always create a backup first. ***
This file contains functions that are used by the Octane8 template engine and should be handled with care.
You can overide any of these functions by placing the code either directly into the template (for a template-specific functionality), or you can place code directly into the meta manager for a given page (for page pecific functionality). This file should be used for Global defaults.
*/
function x8windowOpener(what){
 var popupWin = window.open(""+what+"", "window", "width=700,height=600,location=0,toolbar=0,scrollbars=0,scrollbars=yes,resizable=yes");
}
/*this code is for inline editing. DO NOT ALTER */
var x8_session = getCookie("OCTANE8=LOGIN_AUTH");
var theEditor;
window.document.onkeydown = checkHandles;
function checkHandles(e){e=e||window.event;if(((e.ctrlKey)&&(e.keyCode==56 || e.keyCode==88))){if(x8_session){doHandles()}else{doLogin()}}}
function getCookieVal(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1){endstr=document.cookie.length;}return unescape(document.cookie.substring(offset,endstr));}
function getCookie(name){var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen){var j=i+alen;if(document.cookie.substring(i,j)==arg){return (getCookieVal(j));}i=document.cookie.indexOf(" ",i)+1;if(i==0){break;}}return(null);}
function doLogin(){popupWin=window.open("admin/x8login.html","Octane8","width=800,height=600,left=100,top=100,resizable");}
function doHandles(){if(getCookie("x8handles")=="off" || getCookie("x8handles")=="" || getCookie("x8handles")=="undefined"){document.cookie="x8handles=on";showHide="block";}else{document.cookie="x8handles=off";showHide="none";}var widgets = getElementsByClassName("x8editHandle");for(i = 0;i<widgets.length;i++){widgets[i].style.display = ""+showHide+"";}}
function doHandlesOn(){window.location.reload();document.cookie="x8handles=on";var widgets = getElementsByClassName("x8editHandle");for(i = 0;i<widgets.length;i++){widgets[i].style.display = "block";}}
function doHandlesInit(){var showHide;if(getCookie("x8handles")=="off"){showHide="none";}else if (getCookie("x8handles")=="on"){showHide="block";}else{showHide="none";}var widgets = getElementsByClassName("x8editHandle");for(i = 0;i<widgets.length;i++){widgets[i].style.display = ""+showHide+"";}}
function getElementsByClassName(c) {var ret = new Array();var j = 0;var objs = document.all ? document.all : document.getElementsByTagName("*");for(i = 0;i<objs.length;i++){if(objs[i].className == c){ret[j] = objs[i];j++;}}return ret;} 
function doEdit(pagetype, contentid){if(pagetype=="0"){action="sidebar"}else if(pagetype=="1"){action="webpage"}if(pagetype=="0" || pagetype=="1") /*content edit*/	{if(document.all && document.URLUnencoded){/*IE*/theEditor = "aspx/editor_ie.aspx?action="+action+"&contentid="+contentid+"";popupWin=window.open("admin/x8inlineEdit.htm","Octane8","width=800,height=600,left=100,top=100,resizable");}else if(document.designMode){/*MOZ*/theEditor = "aspx/editor_moz.aspx?action="+action+"&contentid="+contentid+"";popupWin=window.open("admin/x8inlineEdit.htm","Octane8","width=800,height=600,left=100,top=100,resizable");}else{/*TEXT*/	theEditor = "aspx/editor_text.aspx?action="+action+"&contentid="+contentid+"";popupWin=window.open("admin/x8inlineEdit.htm","Octane8","width=800,height=600,left=100,top=100,resizable");}}else if (pagetype="4" || pagetype=="6")/*application edit*/{popupWin=window.open(""+contentid+"","Octane8","width=800,height=600,left=100,top=100,resizable");}}
var devLoad = window.onload;
window.onload = function(){if(devLoad){devLoad();}if(x8_session){doHandlesInit()};}
/* end inline editing code*/
