var Portal = new Object(); Portal.pageWidth = 970; Portal.pageItems = []; Portal.screen = []; Portal.windex = 50000; Portal.mindex = 500000; Portal.winspecs = []; Portal.winloaded = []; Portal.winurl = new Array(); Portal.Load = function () { if (Axe.pageLoaded) { this.Initiate(); } else { window.setTimeout('Portal.Load()',5); } } Portal.Initiate = function () { this.ScreenSize(); } Portal.ScreenSize = function () { if (Axe.pageLoaded == 1) { if (document.body) { this.screen['width'] = document.body.clientWidth; this.screen['height'] = document.body.clientHeight; } else { window.setTimeout('Portal.ScreenSize()',10); } } } Portal.Align = function (d,y,x,v,h) { if (Axe.pageLoaded == 1) { this.ScreenSize(); if (d) { if (!this.pageItems[d.id]) { this.pageItems[d.id] = new Array(y,x,v,h); } d.style.top = "0px"; d.style.left = "0px"; d.style.top = (v == "bottom" ? (this.screen['height']-y) : (v == "middle" ? ((this.screen['height']/2)+y) : y))+"px"; d.style.left = (h == "right" ? (this.screen['width']-x) : (h == "center" ? ((this.screen['width']/2)+x) : (h == "layout" ? (((this.screen['width']/2)-(this.pageWidth/2))+x) : x)))+"px"; if (h == "layout" && this.screen['width'] <= this.pageWidth) { d.style.left = x+"px"; } } else { for (i in this.pageItems) { if ($(i)) { $(i).style.top = "0px"; $(i).style.left = "0px"; $(i).style.top = (this.pageItems[i][2] == "bottom" ? (this.screen['height']-this.pageItems[i][0]) : (this.pageItems[i][2] == "middle" ? ((this.screen['height']/2)+this.pageItems[i][0]) : this.pageItems[i][0]))+"px"; $(i).style.left = (this.pageItems[i][3] == "right" ? (this.screen['width']-this.pageItems[i][1]) : (this.pageItems[i][3] == "center" ? ((this.screen['width']/2)+this.pageItems[i][1]) : (this.pageItems[i][3] == "layout" ? (((this.screen['width']/2)-(this.pageWidth/2))+this.pageItems[i][1]) : items[i][1])))+"px"; if (this.pageItems[i][3] == "layout" && this.screen['width'] <= this.pageWidth) { $(i).style.left = this.pageItems[i][1]+"px"; } } } } } } // "specs" is an array in the following order: opt,name,url,title,w,h // ----------------------------------- Portal.Window = function (specs) { if (Axe.pageLoaded == 1) { switch (specs[0]) { case "load": this.windex = this.windex+1; if (!$('win_'+specs[1])) { var x = document.createElement('DIV'); x.style.position = "fixed"; x.style.overflow = "visible"; x.style.bottom = "27px"; x.id = "win_"+specs[1]; x.style.zIndex = this.windex; x.style.visibility = "visible"; x.style.display = "inline"; x.style.left = "13px"; x.style.align = "left"; document.body.insertBefore(x,null); Axe.Retrieve('win_'+specs[1],Axe.root+"x/inc/window.php"); this.winspecs[specs[1]] = new Array(0,specs); window.setTimeout('Portal.WindowFill()',5); } else { $('win_'+specs[1]).style.zIndex = this.windex; $('win_'+specs[1]).style.visibility = "visible"; $('win_'+specs[1]).style.display = "inline"; } break; case "show": if ($('win_'+specs[1])) { if ($('win_'+specs[1]).style.visibility == "hidden") { this.windex = this.windex+1; $('win_'+specs[1]).style.zIndex = this.windex; } } Axe.Display($('win_'+specs[1])); break; case "refresh": if ($('win_'+specs[1]+'_page')) { $('win_'+specs[1]+'_page').src = $('win_'+specs[1]+'_page').src; } break; } } } Portal.WindowFill = function () { if (Axe.pageLoaded == 1) { var unfill = 0; var filled = 0; for (i in this.winspecs) { if (this.winspecs[i][0] == 0) { unfill++; if ($('httpRequest-win_'+i)) { if ($('httpRequest-win_'+i).name == "4") { if ($('win_'+i)) { if ($('win_'+i).innerHTML != "") { $('win_'+i).innerHTML = $('win_'+i).innerHTML.replace(/#X#/g,Axe.img); $('win_'+i).innerHTML = $('win_'+i).innerHTML.replace(/#TWID#/g,(this.winspecs[i][1][4]-32)); $('win_'+i).innerHTML = $('win_'+i).innerHTML.replace(/#TITLE#/g,this.winspecs[i][1][3]); $('win_'+i).innerHTML = $('win_'+i).innerHTML.replace(/#NAME#/g,this.winspecs[i][1][1]); $('win_'+i).innerHTML = $('win_'+i).innerHTML.replace(/#WIDTH#/g,this.winspecs[i][1][4]); $('win_'+i).innerHTML = $('win_'+i).innerHTML.replace(/#HEIGHT#/g,this.winspecs[i][1][5]); } } this.winurl[this.winurl.length] = new Array(i,this.winspecs[i][1][2]); this.WindowURLLoad(); this.Window(['refresh',i]); //$('win_'+i+'_page').src = this.winspecs[i][1][2]; //this.WindowLoaded(this.winspecs[i][1][1],this.winspecs[i][1][3]); this.winspecs[i][0] = 1; filled++; } } } } if (filled != unfill) { window.setTimeout('Portal.WindowFill()',5); } } } Portal.WindowURLLoad = function (name,url) { var total = 0; var done = 0; var empty = 0; if (this.winurl.length > 0) { for (var i = 0; i < this.winurl.length; i++) { total++; if (this.winurl[i][0] == "") { empty++; } else { if ($('win_'+this.winurl[i][0]+'_page')) { $('win_'+this.winurl[i][0]+'_page').src = this.winurl[i][1]; this.winurl[i] = new Array("",""); done++; } } } if ((empty+done) < total) { window.setTimeout('Portal.WindowURLLoad()',5); } } } Portal.WindowLoaded = function (name,title) { if (Axe.pageLoaded == 1) { var total = 0; var start = ['Recent Windows','---------------']; var new_entry; if ($('loaded_windows')) { this.winloaded[name] = title; if ($('loaded_windows').options.length > 0) { total = $('loaded_windows').options.length; for (i = total; i > -1; i--) { $('loaded_windows').remove(i); } } for (i in start) { new_entry = document.createElement('OPTION'); new_entry.text = start[i]; new_entry.value = ""; new_entry.label = ""; $('loaded_windows').options.add(new_entry); } for (i in this.winloaded) { new_entry = document.createElement('OPTION'); new_entry.text = this.winloaded[i]; new_entry.value = i; new_entry.label = ""; $('loaded_windows').options.add(new_entry); } } } } Portal.Menus = function (opts) { if (Axe.pageLoaded) { var name = "portal_menu_"+opts[1]; var l = ((opts[2]+85)*1)+"px"; if (opts[1] != "") { this.mindex++; switch (opts[0]) { case "load": if (!$(name)) { var x = document.createElement('DIV'); x.style.position = "fixed"; x.style.overflow = "visible"; x.style.bottom = "27px"; x.id = name; x.style.zIndex = this.mindex; x.style.visibility = "visible"; x.style.display = "inline"; x.style.left = l; x.style.align = "left"; document.body.insertBefore(x,null); Axe.Retrieve(name,Axe.root+"x/inc/menus/"+opts[1]+".php"); } else { this.Menus(['show',opts[1]]); } break; case "show": $(name).zIndex = this.mindex; Axe.Display($(name)); break; } } } } Portal.Load(); // -------------------------------------- function $(id) { return document.getElementById(id); } function Foundation() { this.load = $('loaded'); this.loaded = 0; this.root = ""; this.layout_w = 970; this.screen = []; this.items = []; this.calendar_data = new Array("",0,0,-1); // field to return value too, sub-window, open (1)/closed (0), sub-window (1)/primary (0) } function foundation_initialize() { with (this) { load = $('loaded'); if (load) { loaded = 1; root = "http://www.cranberrycampground.ca/"; Portal.Align(null,0,0,'',''); } else { window.setTimeout('Site.Initialize()',10); } } } function foundation_calendar(field,opt,sec,v) { var onoff = new Array("hidden","none","",0); var cal; var frame; var result; var f; var r; with (this) { if (loaded == 1) { switch (sec) { case "sub": if (opt == "open") { parent.$('layout_calendar').style.top = 20; parent.$('layout_calendar').style.left = (parent.document.body.scrollWidth - (182+30)); parent.$('layout_calendar').style.visibility = "visible"; parent.$('layout_calendar').style.display = "inline"; parent.$('layout_calendar_frame').src = "http://www.cranberrycampground.ca/x/utility/calendar.php"; parent.Site.calendar_data[0] = field; parent.Site.calendar_data[2] = 1; parent.Site.calendar_data[3] = 1; window.setTimeout('Site.CalendarResult()',50); } break; case "cal": switch (opt) { case "selected": parent.Site.Calendar(parent.Site.calendar_data[0],'selected','',v); CalendarResult(); break; case "blank": parent.Site.Calendar(parent.Site.calendar_data[0],'blank','',''); CalendarResult(); break; case "close": parent.Site.Calendar(parent.Site.calendar_data[0],'close','',''); break; } break; default: switch (opt) { case "open": $('layout_calendar').style.top = 20; $('layout_calendar').style.left = (document.body.scrollWidth - (182+30)); $('layout_calendar').style.visibility = "visible"; $('layout_calendar').style.display = "inline"; $('layout_calendar_frame').src = "http://www.cranberrycampground.ca/x/utility/calendar.php"; calendar_data[0] = field; calendar_data[2] = 1; calendar_data[3] = 0; window.setTimeout('Site.CalendarResult()',50); break; case "selected": $('layout_calendar_value').value = v; $('layout_calendar').style.visibility = "hidden"; $('layout_calendar').style.display = "none"; $('layout_calendar_frame').src = ""; calendar_data[2] = 0; break; case "blank": $('layout_calendar_value').value = ""; $('layout_calendar').style.visibility = "hidden"; $('layout_calendar').style.display = "none"; $('layout_calendar_frame').src = ""; calendar_data[2] = 0; break; case "close": $('layout_calendar').style.top = 0; $('layout_calendar').style.left = 0; $('layout_calendar').style.visibility = "hidden"; $('layout_calendar').style.display = "none"; $('layout_calendar_frame').src = ""; calendar_data[2] = 0; break; } } } } } function foundation_calendarresult() { with (this) { if (loaded == 1) { switch (calendar_data[3]) { case -1: if (parent.Site.calendar_data[0].id && parent.$('layout_calendar_value')) { parent.Site.calendar_data[0].value = parent.$('layout_calendar_value').value; } break; case 0: if (calendar_data[0].id && $('layout_calendar_value')) { calendar_data[0].value = $('layout_calendar_value').value; } break; } if (calendar_data[2] == 1) { window.setTimeout('Site.CalendarResult()',50); } } } } Foundation.prototype.Initialize = foundation_initialize; Foundation.prototype.Calendar = foundation_calendar; Foundation.prototype.CalendarResult = foundation_calendarresult; var Site = new Foundation(); Site.Initialize();