// -----------------------------------------------------------------------------------
// echonetGRID v 0.1 - 2007-12-19
// by Norbert Adenberger - adenberger@echonet.at
// Sindre Wimberger - wimberger@echonet.at
//
// -----------------------------------------------------------------------------------
//
// EchonetGRID.init(x1);
//
// Configuration
// x1 || CustomerID
// -----------------------------------------------------------------------------------
var EchonetGRID = {
css: "http://grid.echonet.at/assets/style/default.css",
iframe: "http://grid.echonet.at/iframe/8/start",
init: function() {
if(!EchonetGRID.$('echonetgrid')) {
EchonetGRID.browserCheck();
EchonetGRID.CSSload();
EchonetGRID.create();
}
},
// Insert style tag into header
CSSload: function() {
var headTag = document.getElementsByTagName("head")[0];
var tag = document.createElement("link");
tag.rel = "stylesheet";
tag.type = "text/css";
tag.href = EchonetGRID.css;
headTag.appendChild(tag);
},
create: function() {
// The rest of this code inserts html at the bottom of the page that looks similar to this:
//
//
//
var objBody = document.getElementsByTagName("body").item(0);
var objBodyClass = objBody.className;
objBody.setAttribute('class',objBodyClass+' echonetgrid');
var objGrid = document.createElement("div");
objGrid.setAttribute('id','echonetgrid');
var objGridIframe = document.createElement("iframe");
objGridIframe.setAttribute('src',EchonetGRID.iframe);
objGridIframe.setAttribute('name','echonetgridiframe');
objGridIframe.setAttribute('scrolling','no');
objGridIframe.setAttribute('frameBorder','0');
objGridIframe.setAttribute('width','100%');
objGridIframe.setAttribute('height','24');
objGrid.appendChild(objGridIframe);
objBody.appendChild(objGrid);
},
addEvent:function( obj, type, fn ) {
if (obj.addEventListener)
obj.addEventListener( type, fn, false );
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] );
}
},
browserCheck:function(){
EchonetGRID.isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
EchonetGRID.isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
EchonetGRID.isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
},
$:function(strId){
return document.getElementById(strId);
}
};
EchonetGRID.addEvent(window, 'load', function(){ EchonetGRID.init(); });