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.rossfraser.ca/"; Site.Align(null,0,0,'',''); } else { window.setTimeout('Site.Initialize()',10); } } } function foundation_screensize() { with (this) { if (loaded == 1) { if (document.body) { screen['width'] = document.body.clientWidth; screen['height'] = document.body.clientHeight; } else { window.setTimeout('Site.Initialize()',10); } } } } function foundation_align(d,y,x,v,h) { with (this) { if (loaded == 1) { Site.ScreenSize(); if (d) { if (!items[d.id]) { items[d.id] = new Array(y,x,v,h); } d.style.top = 0; d.style.left = 0; d.style.top = (v == "bottom" ? (screen['height']-y) : (v == "middle" ? ((screen['height']/2)+y) : y)); d.style.left = (h == "right" ? (screen['width']-x) : (h == "center" ? ((screen['width']/2)+x) : (h == "layout" ? (((screen['width']/2)-(layout_w/2))+x) : x))); if (h == "layout" && screen['width'] <= layout_w) { d.style.left = x; } } else { for (i in items) { if ($(i)) { $(i).style.top = 0; $(i).style.left = 0; $(i).style.top = (items[i][2] == "bottom" ? (screen['height']-items[i][0]) : (items[i][2] == "middle" ? ((screen['height']/2)+items[i][0]) : items[i][0])); $(i).style.left = (items[i][3] == "right" ? (screen['width']-items[i][1]) : (items[i][3] == "center" ? ((screen['width']/2)+items[i][1]) : (items[i][3] == "layout" ? (((screen['width']/2)-(layout_w/2))+items[i][1]) : items[i][1]))); if (items[i][3] == "layout" && screen['width'] <= layout_w) { $(i).style.left = items[i][1]; } } } } } } } function foundation_bubble(d,item,s,top,left) { var z = new Array("hidden","none"); with (this) { if (loaded == 1) { if (d && $('layout_bubble') && $('layout_bubble_'+item)) { if (s == 1) { d.style.cursor = "pointer"; z = new Array("visible","inline"); } $('layout_bubble').style.visibility = z[0]; $('layout_bubble').style.display = z[1]; $('layout_bubble_'+item).style.visibility = z[0]; $('layout_bubble_'+item).style.display = z[1]; Align($('layout_bubble'),top,left,'top','layout'); } } } } function foundation_display(item) { var z = new Array("hidden","none"); with (this) { if (loaded == 1) { if ($(item)) { if (!$(item).style.visibility || $(item).style.visibility == "hidden") { z = new Array("visible","inline"); } $(item).style.visibility = z[0]; $(item).style.display = z[1]; } } } } function foundation_lightwindow(url,title,w,h,r,s) { var bg; var win; var winsubs; var sub; var opening = "layout_lightwin"; var z; var temp; var nf = 0; // not found var x = 1; with (this) { if (loaded == 1) { bg = $('layout_lightwin_bg'); win = $('layout_lightwin'); winsubs = $('layout_lightwin_subs'); sub = $('layout_lightwin_sub_'+s); opening += (s > 0 ? "_sub_"+s : ""); if (win && winsubs && bg) { if (s > 1) { if (!$('layout_lightwin_sub_'+s)) { temp = document.createElement('DIV'); temp.id = "layout_lightwin_sub_"+s; temp.style.position = "absolute"; temp.style.zIndex = (1000002+(s-1)); temp.style.visibility = "hidden"; temp.style.display = "none"; temp.style.top = 0; temp.style.left = 0; temp.style.width = "100%"; temp.style.height = "100%"; winsubs.insertBefore(temp,null); sub = $('layout_lightwin_sub_'+s); } } if ((s > 0 && sub) || s == 0) { if (s > 0) { if (title != "") { winsubs.style.visibility = "visible"; winsubs.style.display = "inline"; } else if (r == 0 && s < 2) { winsubs.style.visibility = "hidden"; winsubs.style.display = "none"; } } if (s > 0 && sub.innerHTML == "") { sub.innerHTML = win.innerHTML.replace(/layout_lightwin/gi,"layout_lightwin_sub_"+s); sub.innerHTML = sub.innerHTML.replace(/Site.LightWin\('','',0,0,1,0\)/gi,"Site.LightWin('','',0,0,1,"+s+")"); sub.innerHTML = sub.innerHTML.replace(/Site.LightWin\('','',0,0,0,0\)/gi,"Site.LightWin('','',0,0,0,"+s+")"); } z = (s > 0 ? sub : win); if (r == 1) { $(opening+'_page').src = $(opening+'_page').src; } else if (url != "") { if (s == 0) { bg.style.visibility = "visible"; bg.style.display = "inline"; bg.style.height = document.body.scrollHeight; } $(opening+'_title').innerHTML = (title == "" ? " " : title); $(opening+'_title').style.width = (w < 100 ? 80 : (w-20)); $(opening+'_body').style.width = (w < 100 ? 100 : w); $(opening+'_body').style.height = (h < 100 ? 100 : h); $(opening+'_page').src = url; z.style.visibility = "visible"; z.style.display = "inline"; if (s == 0) { while (nf == 0) { if (!$('layout_lightwin_sub_'+x)) { nf = 1; } else { LightWin('','',0,0,0,x); } x++; } } else { x = (s+1); while (nf == 0) { if (!$('layout_lightwin_sub_'+x)) { nf = 1; } else { LightWin('','',0,0,0,x); } x++; } } } else { if (s == 0) { bg.style.visibility = "hidden"; bg.style.display = "none"; } z.style.visibility = "hidden"; z.style.display = "none"; $(opening+'_title').innerHTML = ""; $(opening+'_page').src = ""; if (s == 0) { while (nf == 0) { if (!$('layout_lightwin_sub_'+x)) { nf = 1; } else { LightWin('','',0,0,0,x); } x++; } winsubs.style.visibility = "hidden"; winsubs.style.display = "none"; } else { LightWin('','',0,0,1,(s-1)); x = (s+1); while (nf == 0) { if (!$('layout_lightwin_sub_'+x)) { nf = 1; } else { LightWin('','',0,0,0,x); } x++; } } } } } } } } 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.rossfraser.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.rossfraser.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); } } } } function foundation_isarray(x) { return (typeof(x) == 'object' && (x instanceof Array)); } Foundation.prototype.Initialize = foundation_initialize; Foundation.prototype.ScreenSize = foundation_screensize; Foundation.prototype.Align = foundation_align; Foundation.prototype.Bubble = foundation_bubble; Foundation.prototype.Display = foundation_display; Foundation.prototype.LightWin = foundation_lightwindow; Foundation.prototype.Calendar = foundation_calendar; Foundation.prototype.CalendarResult = foundation_calendarresult; Foundation.prototype.isArray = foundation_isarray; var Site = new Foundation(); Site.Initialize();