// -- Revision 2.1 -->
// -- Copyright (c) 2007-2010 e-dynamics GmbH  All rights reserved. -->
// -- $DateTime: 2010/06/23 16:09:00 $ -->
function Supermap(){           
    // configure
	this.collectData = true; // tracking on/off
	this.randomtracking = 1;  // 1 = every user
	this.dom = 'upi.e-heat.de';
	this.accountID = 'eh303039_6161';
	this.maxHeight = 5000; // maximum height
	this.interval = 1000; // time between clicks in milliseconds
	this.startPointID = 'page_margins'; // 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.bind=function(_2){_1.getClick(_2);};this.win.document.attachEvent?this.win.document.attachEvent("onmousedown",this.bind):this.win.document.addEventListener("mousedown",this.bind,false);};
Supermap.prototype.removeEvent=function(){this.win.document.attachEvent?this.win.document.detachEvent("onmousedown",this.bind):this.win.document.removeEventListener("mousedown",this.bind,false);};
Supermap.prototype.getClick=function(e){e=e||this.win.event;if((e.which&&e.which==3)||(e.button&&e.button==2)){return;}var _3=new Date();if(_3.getTime()-this.timeDiff<this.interval){return;}this.timeDiff=_3.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 _4=this.getOffset(0,0);this.x+=_4[0];this.y+=_4[1];this.request();};
Supermap.prototype.request=function(){var _5="http"+(this.win.location.protocol.indexOf("https:")===0?"s":"")+"://"+this.dom+"/"+this.accountID+"/img.gif?";_5+="x="+this.x+"&y="+this.y+"&t="+(this.timeDiff-this.time)+"&w="+this.getWidth()+"&p="+encodeURIComponent(this.getPage());_5+=this.getSegments()?this.getSegments():"";if(this.debug){alert(decodeURIComponent(_5));}else{this.sendRequest(_5);}};
Supermap.prototype.sendRequest=function(_6){if(this.win.document.images){this.images[this.index]=new Image();this.images[this.index].src=_6;this.index++;}else{this.win.document.write("<img alt=\"\" border=\"0\" name=\"heatimage\" width=\"1\" height=\"1\" src=\""+_6+"\">");}};
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.deleteMap=function(){for(var m in this.myMaps){if(typeof (this.myMaps.hasOwnProperty)!==undefined&&this.myMaps.hasOwnProperty(m)){this.myMaps[m].deleteMap();delete this.myMaps[m];}}if(this.win.document!==null){this.removeEvent();}};
Supermap.prototype.defSegment=function(_7,_8){if(this.segm){this.segm[_7]=_8;}};
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 _9=this;if(this.win.document.addEventListener){this.win.document.addEventListener("DOMContentLoaded",function(){_9.win.document.removeEventListener("DOMContentLoaded",arguments.callee,false);_9.init();},false);}else{if(this.win.document.attachEvent){this.win.document.attachEvent("onreadystatechange",function(){if(_9.win.document.readyState==="complete"){_9.win.document.detachEvent("onreadystatechange",arguments.callee);_9.init();}});}}};
Supermap.prototype.init=function(){var _a=this.win.document.getElementsByTagName("frame");var _b=this.win.document.getElementsByTagName("iframe");this.intervalID=0;var _c=0;var _d=this;for(var j=0;j<_a.length;j++){this.myframes[_c]=_a[j];_c++;}for(var i=0;i<_b.length;i++){this.myframes[_c]=_b[i];_c++;}if(this.IE){for(i=0;i<this.myframes.length;i++){this.myMaps[i]=new Childmap(this.myframes[i],this);}}else{this.intervalID=setInterval(function(){_d.checkWindow(_d.myframes);},10);this.timeoutID=setTimeout(function(){clearInterval(_d.intervalID);},50000);}};
Supermap.prototype.checkWindow=function(_e){for(var i=0;i<_e.length;i++){if(_e[i].contentWindow===undefined||_e[i].contentWindow.document===undefined||_e[i].contentWindow.document.URL===undefined||_e[i].contentWindow.document.URL.indexOf("about:blank")===0){return;}}clearInterval(this.intervalID);clearTimeout(this.timeoutID);for(i=0;i<_e.length;i++){this.myMaps[i]=new Childmap(_e[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=top.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.init();};
Heatmap.prototype.getPage=function(){return this.pagename;};
Heatmap.prototype.getSegments=function(){var _f="";for(var s in this.segm){if(typeof (this.segm.hasOwnProperty)!="undefined"&&this.segm.hasOwnProperty(s)){_f+="&s_"+s+"="+encodeURIComponent(this.segm[s]);}}return _f;};
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);};

