var SimpleCMS = SimpleCMS || {}; SimpleCMS.Ajax = { XMLHttpFactories: [ function () {return new XMLHttpRequest()}, function () {return new ActiveXObject("Msxml2.XMLHTTP")}, function () {return new ActiveXObject("Msxml3.XMLHTTP")}, function () {return new ActiveXObject("Microsoft.XMLHTTP")} ], sendRequest: function (url, callback, postData) { var req = this.createXMLHTTPObject(); var method = (postData) ? "POST" : "GET"; if (!req) { return; } req.open(method, url, true); req.setRequestHeader('User-Agent', 'XMLHTTP/1.0'); req.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); if (postData) { req.setRequestHeader('Content-type','application/x-www-form-urlencoded'); } req.onreadystatechange = function () { if (req.readyState != 4) { return; } if (req.status != 200 && req.status != 304) { return; } callback(req); } if (req.readyState == 4) { return; } req.send(postData); }, createXMLHTTPObject: function () { var xmlhttp = false; for (var i = 0; i < this.XMLHttpFactories.length; i++) { try { xmlhttp = this.XMLHttpFactories[i](); } catch (e) { continue; } break; } return xmlhttp; }, get: function (url, container_id) { this.sendRequest(url, function (req) { document.getElementById(container_id).innerHTML = req.responseText; }); }, post: function (url, container_id, postData) { this.sendRequest(url, function (req) { document.getElementById(container_id).innerHTML = req.responseText; }, postData); } }; SimpleCMS.Utils = { importCss: function (cssFile) { if (document.createStyleSheet) { document.createStyleSheet(cssFile); } else { var styles = "@import url(" + cssFile + ");"; var newSS = document.createElement('link'); newSS.rel = 'stylesheet'; newSS.href = 'data:text/css,' + escape(styles); document.getElementsByTagName("head")[0].appendChild(newSS); } }, getElementsByClass: function (searchClass, node, tag) { var classElements = new Array(); if (node == null) { node = document; } if (tag == null) { tag = '*'; } var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); for (var i = 0, j = 0; i < elsLen; i++) { if (pattern.test(els[i].className)) { classElements[j] = els[i]; j++; } } return classElements; }, addEvent: function (obj, type, fn) { if (obj.addEventListener) { obj.addEventListener( type, fn, false ); SimpleCMS.Utils.eventCache.add(obj, type, fn); } else if (obj.attachEvent) { obj["e"+type+fn] = fn; obj[type+fn] = function() { obj["e"+type+fn]( window.event ); } obj.attachEvent( "on"+type, obj[type+fn] ); SimpleCMS.Utils.eventCache.add(obj, type, fn); } else { obj["on"+type] = obj["e"+type+fn]; } }, eventCache: function () { var listEvents = []; return { listEvents : listEvents, add : function (node, sEventName, fHandler) { listEvents.push(arguments); }, flush : function () { var i, item; for (i = listEvents.length - 1; i >= 0; i = i - 1) { item = listEvents[i]; if(item[0].removeEventListener) { item[0].removeEventListener(item[1], item[2], item[3]); }; if(item[1].substring(0, 2) != "on"){ item[1] = "on" + item[1]; }; if(item[0].detachEvent){ item[0].detachEvent(item[1], item[2]); }; item[0][item[1]] = null; }; } }; }(), serialize: function(form) { if (!form || form.nodeName !== "FORM") { return; } var i, j, q = []; for (i = form.elements.length - 1; i >= 0; i = i - 1) { if (form.elements[i].name === "") { continue; } switch (form.elements[i].nodeName) { case 'INPUT': switch (form.elements[i].type) { case 'text': case 'hidden': case 'password': case 'button': case 'reset': case 'submit': q.push(form.elements[i].name + "=" + encodeURIComponent(form.elements[i].value)); break; case 'checkbox': case 'radio': if (form.elements[i].checked) { q.push(form.elements[i].name + "=" + encodeURIComponent(form.elements[i].value)); } break; case 'file': break; } break; case 'TEXTAREA': q.push(form.elements[i].name + "=" + encodeURIComponent(form.elements[i].value)); break; case 'SELECT': switch (form.elements[i].type) { case 'select-one': q.push(form.elements[i].name + "=" + encodeURIComponent(form.elements[i].options[form.elements[i].selectedIndex].value)); break; case 'select-multiple': for (j = form.elements[i].options.length - 1; j >= 0; j = j - 1) { if (form.elements[i].options[j].selected) { q.push(form.elements[i].name + "=" + encodeURIComponent(form.elements[i].options[j].value)); } } break; } break; case 'BUTTON': switch (form.elements[i].type) { case 'reset': case 'submit': case 'button': q.push(form.elements[i].name + "=" + encodeURIComponent(form.elements[i].value)); break; } break; } } return q.join("&"); } }; SimpleCMS.Front = {};document.writeln('
'); settings = { URL: "http://www.stjosephsport.co.nz/script/", installFolder: "/script/", id: "24" } SimpleCMS.Ajax.get("/script/frontend/include/load_page.php?1=1&id=24", "scms_wrapper_24");