// global javascripts
// popup window settings; see button for window sizers
var popupparams = 'resizable=yes,toolbar=no,scrollbars=yes,status=no,';
var	screenwidth = screen.availWidth;
var	screenheight = screen.availHeight;
// base functions for users not logged in
function isEditMode() { if (typeof rtuserid == "undefined") rtuserid = 0; if(getCookie("editmode") == "on" && rtuserid > 0) return true; else return false; }
function setCookie(name, value, expires, path, domain, secure) { document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : "; expires=" + expires.toGMTString()) + ((path == null) ? "" : "; path=" + path) + ((domain == null) ? "" : "; domain=" + domain) + ((secure == null) ? "" : "; secure");}
function getCookie(name){ var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); }} return null; }
function delCookie (name,path,domain) { if (getCookie(name)) { document.cookie = name + "=" + ((path == null) ? "" : "; path=" + path) + ((domain == null) ? "" : "; domain=" + domain) + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; }}
function rollOnEdit(region,id) { if (isEditMode()){ eval("imageobj = document.images.editmodeediticon_"+region+"_"+id); showIcons(); switchEditImg(imageobj, editiconalt, id, '/icons/editicon_on.gif'); } }
function rollOutEdit(region,id) { window.status = ''; return true; }
function editModeEditIcon(id, layout, targetframe, targetregion, controller, method, module, view, path, region, params) { window.location.reload(); }
function editModePermIcon(id, tableid, layout, targetframe, targetregion) {	window.location.reload(); }
function hideIcons(){ for (i = 0; i < document.images.length; i++) { if(document.images[i].name.indexOf("editmode") > -1) { document.images[i].src = rtimagepath + "/icons/shim.gif"; editmodemsgs[i] = document.images[i].alt; document.images[i].alt = ''; }}}
function rollOnPerm(region,id) { if (isEditMode()){ eval("imageobj = document.images.editmodepermicon_"+region+"_"+id); showIcons(); switchEditImg(imageobj, deliconalt, id, '/icons/permicon_on.gif'); }}
function rollOutPerm(region,id){ window.status = ''; return true; }
function rollOnProp(region,id) { if (isEditMode()){ eval("imageobj = document.images.editmodepropicon_"+region+"_"+id); showIcons(); switchEditImg(imageobj, propiconalt, id, '/icons/editregion_on.gif'); }} 
function rollOutProp(region,id) { window.status = ''; return true; }
function getPopupCalendarFor(src,now) { var newhref = editmodenullpagelink + 'layout=ps&main.view=calendar.popcal&main.src_field=' + escape(src.form.name + '.' + src.name); if(now != null) newhref += '&main.now=' + now; window.open(newhref,'popupCal',getAllPopupWinSizeParams(145,180)); }
function getPopupWinTopPos(h) {	return ((screenheight - h - 30) * .5); }
function getPopupWinLeftPos(w) { return ((screenwidth - w - 10) * .5); }
function getPopupWinSizeParams(h,w) { return 'width='+w+',height='+h+',left='+getPopupWinLeftPos(w)+',top='+getPopupWinTopPos(h); }
function getAllPopupWinSizeParams(h,w,resizable,toolbar,scrollbars,status) { if (!resizable) resizable = 'yes';	if (!toolbar) toolbar = 'no'; if (!scrollbars) scrollbars = 'auto'; if (!status) status = 'no'; var popupparams = 'resizable=' + resizable + ',toolbar=' + toolbar + ',scrollbars=' + scrollbars + ',status=' + status + ','; return popupparams+getPopupWinSizeParams(h,w); }

if (!isEditMode()) setTimeout('hideIcons()',600);
if (!editmodemsgs) var editmodemsgs = new Array();

function toggletext(textonly) { if(textonly) { expiration = new Date(); expiration.setFullYear(expiration.getFullYear() + 10); setCookie("toggle_text", textonly, expiration, getcontextpath); } else { expiration = new Date(); expiration.setFullYear(expiration.getFullYear() - 10); setCookie("toggle_text", textonly, expiration, getcontextpath); } window.location.href = editmodelink; }

