// -- Revision 2.1 -->
// -- Copyright (c) 2007-2009 e-dynamics GmbH  All rights reserved. -->
// -- $DateTime: 2009/10/23 17:56:00 $ -->
function Supermap(){           
    // configure
	this.collectData = true; // tracking on/off
	this.randomtracking = 1;  // 1 = every user
	this.dom = 'upi.e-heat.de';
	this.accountID = 'eh303036_6161';
	this.maxHeight = 5000; // maximum height
	this.interval = 1000; // time between clicks in milliseconds
	this.startPointID = 'positioner'; // id of the upper left corner
	
	this.debug = false; // debugging on (no requests will be send)
}
// define global segments
Supermap.prototype.globalSegments = function(){
    //this.defSegment('p_name1','p_value1');
    //this.defSegment('p_name2','p_value2');    
}
Supermap.prototype.loadEvent=function(){var _1=this;this.win.document.attachEvent?this.win.document.attachEvent("onmousedown",function(_2){_1.getClick(_2);}):this.win.document.addEventListener("mousedown",function(_3){_1.getClick(_3);},false);};
Supermap.prototype.getClick=function(e){e=e||this.win.event;if((e.which&&e.which==3)||(e.button&&e.button==2)){return;}var _4=new Date();if(_4.getTime()-this.timeDiff<this.interval){return;}this.timeDiff=_4.getTime();this.x=(e.pageX||(e.clientX+(this.win.pageXOffset||this.win.document.documentElement.scrollLeft||this.win.document.body.scrollLeft)));this.y=(e.pageY||(e.clientY+(this.win.pageYOffset||this.win.document.documentElement.scrollTop||this.win.document.body.scrollTop)));if(this.x>this.getInnerWidth()||this.y>this.maxHeight){return;}var _5=this.getOffset(0,0);this.x+=_5[0];this.y+=_5[1];this.request();};
Supermap.prototype.request=function(){var _6="http"+(this.win.location.protocol.indexOf("https:")==0?"s":"")+"://"+this.dom+"/"+this.accountID+"/img.gif?";_6+="x="+this.x+"&y="+this.y+"&t="+(this.timeDiff-this.time)+"&w="+this.getWidth()+"&p="+encodeURIComponent(this.getPage());_6+=this.getSegments()?this.getSegments():"";if(this.debug){alert(decodeURIComponent(_6));}else{this.sendRequest(_6);}};
Supermap.prototype.sendRequest=function(_7){if(this.win.document.images){this.images[this.index]=new Image();this.images[this.index].src=_7;this.index++;}else{this.win.document.write("<img alt=\"\" border=\"0\" name=\"heatimage\" width=\"1\" height=\"1\" src=\""+_7+"\">");}};
Supermap.prototype.go=function(){this.images=[];this.index=0;this.myframes=[];this.myMaps=[];this.IE=(navigator.appName=="Microsoft Internet Explorer")?true:false;this.loadEvent();};
Supermap.prototype.defSegment=function(_8,_9){if(this.segm){this.segm[_8]=_9;}};
Supermap.prototype.getInnerWidth=function(){return this.IE?this.win.document.body.clientWidth:this.win.innerWidth;};
Supermap.prototype.getInnerHeight=function(){return this.IE?this.win.document.body.clientHeight:this.win.innerHeight;};
Supermap.prototype.getWidth=function(){return this.IE?this.win.document.body.clientWidth:this.win.innerWidth;};
Supermap.prototype.onload=function(){var _a=this;if(this.win.document.addEventListener){this.win.document.addEventListener("DOMContentLoaded",function(){_a.win.document.removeEventListener("DOMContentLoaded",arguments.callee,false);_a.init();},false);}else{if(this.win.document.attachEvent){this.win.document.attachEvent("onreadystatechange",function(){if(_a.win.document.readyState==="complete"){_a.win.document.detachEvent("onreadystatechange",arguments.callee);_a.init();}});}}};
Supermap.prototype.init=function(){var _b=this.win.document.getElementsByTagName("frame");var _c=this.win.document.getElementsByTagName("iframe");this.intervalID=0;var _d=0;var _e=this;for(var j=0;j<_b.length;j++){this.myframes[_d]=_b[j];_d++;}for(var i=0;i<_c.length;i++){this.myframes[_d]=_c[i];_d++;}if(this.IE){for(var i=0;i<this.myframes.length;i++){this.myMaps[i]=new Childmap(this.myframes[i],this);}}else{this.intervalID=setInterval(function(){_e.checkWindow(_e.myframes);},10);this.timeoutID=setTimeout(function(){clearInterval(_e.intervalID);},50000);}};
Supermap.prototype.checkWindow=function(_f){for(var i=0;i<_f.length;i++){if(_f[i].contentWindow==undefined||_f[i].contentWindow.document==undefined||_f[i].contentWindow.document.URL==undefined||_f[i].contentWindow.document.URL.indexOf("about:blank")==0){return;}}clearInterval(this.intervalID);clearTimeout(this.timeoutID);for(var i=0;i<_f.length;i++){this.myMaps[i]=new Childmap(_f[i],this);}};
Supermap.prototype.setPos=function(o){this.offX=this.offY=0;if(o.offsetParent){do{this.offX+=o.offsetLeft;this.offY+=o.offsetTop;}while(o=o.offsetParent);}else{if(o.x){this.offX+=o.x;this.offY+=o.y;}}};
Supermap.prototype.getOffset=function(oX,oY){this.setPos(this.startPoint);return [oX-this.offX,oY-this.offY];};
Heatmap.prototype=new Supermap;
Heatmap.prototype.constructor=Heatmap;function Heatmap(){Supermap.call(this);this.win=window;this.startPoint=this.win.document.getElementById(this.startPointID);if(!this.pagename){this.pagename=this.win.location.pathname;}if(this.collectData===true){this.go();}};
Heatmap.prototype.go=function(){var z=Math.random()*this.randomtracking;if(z>1){return;}Supermap.prototype.go.call(this);this.segm={};this.timeDiff=new Date();this.time=this.timeDiff=this.timeDiff.getTime();if(!this.pagename){this.pagename=this.win.location.pathname;}if(!this.startPoint){this.startPoint=this.win.document.getElementsByTagName("body")[0].childNodes[1];}this.globalSegments();this.onload();};
Heatmap.prototype.getPage=function(){return this.pagename;};
Heatmap.prototype.getSegments=function(){var ret="";for(var s in this.segm){if(typeof (this.segm.hasOwnProperty)!="undefined"&&this.segm.hasOwnProperty(s)){ret+="&s_"+s+"="+encodeURIComponent(this.segm[s]);}}return ret;};
Childmap.prototype=new Supermap;
Childmap.prototype.constructor=Childmap;function Childmap(fr,d){Supermap.call(this);this.frm=fr;this.win=fr.contentWindow;this.daddy=d;if(this.collectData===true){this.go();}};
Childmap.prototype.go=function(){Supermap.prototype.go.call(this);this.time=this.timeDiff=this.daddy.time;this.init();};
Childmap.prototype.getPage=function(){return this.daddy.getPage();};
Childmap.prototype.defSegment=function(_10,_11){this.daddy.defSegment(_10,_11);};
Childmap.prototype.getSegments=function(){return this.daddy.getSegments();};
Childmap.prototype.getWidth=function(){return this.daddy.getWidth();};
Childmap.prototype.getOffset=function(oX,oY){var ref=this.frm;if(this.IE){oX+=2;oY+=2;}oX+=(ref.offsetWidth-ref.clientWidth)/2;oY+=(ref.offsetHeight-ref.clientHeight)/2;this.setPos(ref);return this.daddy.getOffset(this.offX+oX,this.offY+oY);};

