// Retrieve element by ID // -------------------------- function $(id) { return document.getElementById(id); } function $$(id) { return parent.document.getElementById(id); } var Axe = new Object(); Axe.pageLoaded = 0; Axe.IE = ""; Axe.root = "http://www.cranberrycampground.ca/"; Axe.img = "http://x.cranberrycampground.ca/"; Axe.body_width = 0; Axe.body_height = 0; Axe.httpRequest; Axe.httpCheck = ""; Axe.httpText = []; Axe.wingroups = []; Axe.listings = []; Axe.Dashboard = 1; // 0 - no dashboard Axe.Access = []; Axe.Access['type'] = ''; Axe.Access['user'] = ''; Axe.Access['exit'] = ''; Axe.Access['key'] = new Array("1329943910","542"); Axe.access_exit = []; Axe.Load = function () { if ($('loaded')) { this.pageLoaded = 1; this.Initiate(); } else { window.setTimeout('Axe.Load()',5); } } Axe.BodyPixels = function () { if (this.pageLoaded == 1 && document.body) { this.body_width = document.body.clientWidth; this.body_height = document.body.clientHeight; } } Axe.Initiate = function () { this.BodyPixels(); // Load site specific elements } Axe.Retrieve = function (obj,url) { function getHTTP() { if (typeof XMLHttpRequest != 'undefined') { return new XMLHttpRequest(); } try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } return false; } var result = ""; if (obj && url) { if (!(this.httpText[obj]) || (this.httpText[obj] && url == "-")) { var httpRequest = getHTTP(); if (httpRequest !== false) { var d = document.createElement('DIV'); d.id = "httpRequest-"+obj; d.name = "1"; d.innerHTML = ""; d.style.visibility = "hidden"; d.style.display = "none"; document.body.insertBefore(d,null); this.httpText[obj] = 1; httpRequest.open("GET",url,true); httpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8"); httpRequest.onreadystatechange = function () { if (httpRequest.readyState == 4) { Axe.httpText[obj] = 4; $('httpRequest-'+obj).name = "4"; $('httpRequest-'+obj).innerHTML = httpRequest.responseText; } } httpRequest.send(null); //if (this.httpCheck == "") { this.httpCheck = window.setTimeout('Axe.CheckRetrieve()',5); } window.setTimeout('Axe.CheckRetrieve()',5); } } } } Axe.CheckRetrieve = function () { var num = 0; var updated = 0; for (i in this.httpText) { num++; if ($('httpRequest-'+i).name == "4") { if ($(i).innerHTML == "") { $(i).innerHTML = $('httpRequest-'+i).innerHTML; } updated++; } } if (updated != num) { window.setTimeout('Axe.CheckRetrieve()',5); } } Axe.Display = function (item) { var z = new Array("hidden","none"); if (this.pageLoaded == 1 && item) { if (!item.style.visibility || item.style.visibility == "hidden") { z = new Array("visible","inline"); } item.style.visibility = z[0]; item.style.display = z[1]; } } Axe.MenuItem = function (i,s) { i.style.cursor = (s == 1 ? "pointer" : ""); i.style.color = (s == 1 ? "#FFFFFF" : "#3A4C6C"); i.style.backgroundColor = (s == 1 ? "#19447E" : "#EDEDED"); } Axe.isArray = function(x) { return (typeof(x) == 'object' && (x instanceof Array)); } Axe.GroupDisplay = function (group,item) { var x = 0; var found = false; if (this.pageLoaded == 1 && item) { if (this.wingroups[group]) { if (this.wingroups[group].length == 0) { this.wingroups[group] = new Array(item.id); } else { for (var i = 0; i < this.wingroups[group].length; i++) { if (this.wingroups[group][i] == item.id) { found = true; } } if (found === false) { x = this.wingroups[group].length; this.wingroups[group][x] = item.id; } } if (item.style.visibility == "hidden") { for (var i = 0; i < this.wingroups[group].length; i++) { $(this.wingroups[group][i]).style.visibility = "hidden"; $(this.wingroups[group][i]).style.display = "none"; } } Axe.Display(item); } else { this.wingroups[group] = new Array(item.id); if (item.style.visibility == "hidden") { for (var i = 0; i < this.wingroups[group].length; i++) { $(this.wingroups[group][i]).style.visibility = "hidden"; $(this.wingroups[group][i]).style.display = "none"; } } Axe.Display(item); } } } Axe.Lists = function (opt,name) { var num = ""; var exist = false; var add = ""; var new_entry; if (this.pageLoaded == 1 && $(name+'_insert') && $(name+'_field') && $(name+'_previous')) { switch (opt) { case "insert": if (this.listings[name]) { if ($(name+'_insert').value != "") { if (this.listings[name].length > 0) { for (var i = 0; i < this.listings[name].length; i++) { if ($(name+'_insert').value == this.listings[name][i]) { exist = true; } } if (exist === false) { num = this.listings[name].length; this.listings[name][num] = $(name+'_insert').value; add = this.listings[name][num]; } } else { this.listings[name] = new Array($(name+'_insert').value); add = this.listings[name][0]; } } } else { if ($(name+'_insert').value != "") { this.listings[name] = new Array($(name+'_insert').value); add = this.listings[name][0]; } } if (add != "") { $(name+'_field').value = $(name+'_field').value+add+", "; new_entry = document.createElement('OPTION'); new_entry.text = add; new_entry.value = add; $(name+'_previous').options.add(new_entry); } $(name+'_insert').value = ""; break; case "add": if (this.listings[name] && $(name+'_previous').options.length > 0) { num = $(name+'_previous').selectedIndex; if ($(name+'_previous').options[num].value != "") { } } break; case "remove": break; case "clear": $(name+'_field').value = ""; this.listings[name] = new Array(); break; } } } // Initiate // ---------------------- Axe.Load();