/**
 * (smt)2 simple mouse tracking - auxiliary functions
 * Copyleft (cc) 2006-2009 Luis Leiva
 * Release date: February 21th 2010
 * http://smt.speedzinemedia.com
 */

var smt2fn={overrideTrackingOptions:function(b,a){for(var c in b){if(a.hasOwnProperty(c)&&a[c]!==null){b[c]=a[c]}}},allowTrackingOnFlashObjects:function(){var f=document.getElementsByTagName("object");for(var e=0,d=f.length;e<d;++e){var g=document.createElement("param");g.setAttribute("name","wmode");g.setAttribute("value","opaque");f[e].appendChild(g)}var h=document.getElementsByTagName("embed");for(var c=0,b=h.length;c<b;++c){h[c].setAttribute("wmode","opaque");if(!/MSIE/i.test(navigator.userAgent)){var a=h[c].cloneNode(true);h[c].parentNode.replaceChild(a,h[c])}}},log:function(){if(!window.console){return false}console.log(arguments)},onDOMload:function(c){if(arguments.callee.done){return}arguments.callee.done=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",c,false)}else{if(document.attachEvent){try{document.write("<script id=__ie_onload defer=true src=//:><\/script>");var a=document.getElementById("__ie_onload");a.onreadystatechange=function(){if(this.readyState==="complete"){c()}}}catch(b){}}else{this.addEvent(window,"load",c)}}},reloadPage:function(){window.location.replace(window.location.href)},loadNextMouseTrail:function(c){if(typeof c.api==="undefined"){c.api="js"}var a=this.array.indexOf(c.trails,c.currtrail);if(a<c.trails.length-1){var b=c.trailurl+"?id="+c.trails[a+1]+"&api="+c.api;if(c.autoload){window.location.href=b}else{if(confirm("This user also browsed more pages.\nDo you want to replay the next log?")){window.location.href=b}}}else{alert("There are no more browsed pages for this user.")}},findPos:function(a){var b=curtop=0;if(a&&a.offsetParent){do{b+=a.offsetLeft;curtop+=a.offsetTop}while(a=a.offsetParent)}return{x:b,y:curtop}},getStyle:function(a,b){var c="";if(document.defaultView&&document.defaultView.getComputedStyle){c=document.defaultView.getComputedStyle(a,"").getPropertyValue(b)}else{if(a.currentStyle){b=b.replace(/\-(\w)/g,function(d,e){return e.toUpperCase()});c=a.currentStyle[b]}}return c},getWindowSize:function(){var c=document;var a=(window.innerWidth)?window.innerWidth:(c.documentElement&&c.documentElement.clientWidth)?c.documentElement.clientWidth:(c.body&&c.body.clientWidth)?c.body.clientWidth:0;var b=(window.innerHeight)?window.innerHeight:(c.documentElement&&c.documentElement.clientHeight)?c.documentElement.clientHeight:(c.body&&c.body.clientHeight)?c.body.clientHeight:0;return{width:a,height:b}},getWindowOffset:function(){var b=document;var a=(window.pageXOffset)?window.pageXOffset:(b.documentElement&&b.documentElement.scrollLeft)?b.documentElement.scrollLeft:(b.body&&b.body.scrollLeft)?b.body.scrollLeft:0;var c=(window.pageYOffset)?window.pageYOffset:(b.documentElement&&b.documentElement.scrollTop)?b.documentElement.scrollTop:(b.body&&b.body.scrollTop)?b.body.scrollTop:0;return{x:a,y:c}},getDocumentSize:function(){var c=document;var a=(window.innerWidth&&window.scrollMaxX)?window.innerWidth+window.scrollMaxX:(c.body&&c.body.scrollWidth>c.body.offsetWidth)?c.body.scrollWidth:(c.body&&c.body.offsetWidth)?c.body.offsetWidth:0;var b=(window.innerHeight&&window.scrollMaxY)?window.innerHeight+window.scrollMaxY:(c.body&&c.body.scrollHeight>c.body.offsetHeight)?c.body.scrollHeight:(c.body&&c.body.offsetHeight)?c.body.offsetHeight:0;return{width:a,height:b}},getPageSize:function(){var d=this.getWindowSize(),c=this.getDocumentSize();var a=(c.width<d.width)?d.width:c.width;var b=(c.height<d.height)?d.height:c.height;return{width:a,height:b}},getHardcorePageSize:function(){var d=0,h=0,c=0,g=0,b=0,f=0,a=0,e=0,i=document.documentElement,l=document.body;if(window.innerHeight){d=window.innerWidth;h=window.innerHeight;if(window.scrollMaxY){d+=window.scrollMaxY;h+=window.scrollMaxY}}if(i&&i.offsetHeight){c=i.offsetWidth;g=i.offsetHeight}if(l&&l.scrollHeight){b=l.scrollWidth;f=l.scrollHeight}if(l&&l.offsetWidth){a=l.offsetWidth;e=l.offsetHeight;if(l.offsetLeft){a+=l.offsetLeft;e+=l.offsetTop}}var k=Math.max(h,g,f,e);var j=Math.max(d,c,b,a);return{width:j,height:k}},getNextHighestDepth:function(g){var f=0;var c=0;var b=[];if(document.getElementsByTagName){b=document.getElementsByTagName("*")}else{if(g.getElementsByTagName){b=document.getElementsByTagName("*")}}for(var d=0,a=b.length;d<a;++d){if(b[d].currentStyle){c=parseFloat(b[d].currentStyle.zIndex)}else{if(window.getComputedStyle){c=parseFloat(document.defaultView.getComputedStyle(b[d],null).getPropertyValue("z-index"))}}if(c>f){f=c}}return f+1},getBase:function(){var a=window.location.href;var b=a.split("/");delete b[b.length-1];return b.join("/")},addEvent:function(c,b,a){if(c.addEventListener){c.addEventListener(b,a,false)}else{if(c.attachEvent){c["e"+b+a]=a;c[b+a]=function(){c["e"+b+a](window.event)};c.attachEvent("on"+b,c[b+a])}}},roundTo:function(a,b){if(!b){b=2}var c=100;return Math.round(c*a)/c},doScroll:function(b){var c=this.getWindowOffset();var a=Math.round(b.xpos-b.width)+b.width/2;var d=Math.round(b.ypos-b.height)+b.height/2;window.scrollBy(a-c.x,d-c.y)},createXMLHTTPObject:function(){var c=false;var a=[function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];for(var b=0;b<a.length;++b){try{c=a[b]()}catch(d){continue}break}return c},sendAjaxRequest:function(a){var b=(a.xmlhttp)?a.xmlhttp:this.createXMLHTTPObject();if(!b){return}var c=(a.postdata)?"POST":"GET";b.open(c,a.url,true);if(a.postdata){b.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}b.onreadystatechange=function(){if(b.readyState==4&&typeof a.callback==="function"){a.callback(b.responseText)}};b.send(a.postdata)},cookies:{setCookie:function(e,f,a,c){var g=c||"/";var b="";if(a){var d=new Date();d.setTime(d.getTime()+(a*24*60*60*1000));b="; expires="+d.toGMTString()}document.cookie=e+"="+escape(f)+b+"; path="+g},getCookie:function(a){var b,c;if(document.cookie.length>0){b=document.cookie.indexOf(a+"=");if(b!=-1){b=b+a.length+1;c=document.cookie.indexOf(";",b);if(c==-1){c=document.cookie.length}return unescape(document.cookie.substring(b,c))}}return false},checkCookie:function(a){var b=this.getCookie(a);return(b)},deleteCookie:function(a){if(this.checkCookie(a)){this.setCookie(a,null,-1)}}},widget:{findDOMElement:function(c,d){if(!c){c=window.event}var b=c.target||c.srcElement;if(b.nodeType==3){b=b.parentNode}var a=(b.id)?this.getID(b):this.getParents(b);if(a){d(a)}},getID:function(a){if(a.nodeName=="HTML"||a.nodeName=="BODY"){return null}return a.nodeName+"#"+a.id},getClass:function(a){if(a.nodeName=="HTML"||a.nodeName=="BODY"){return null}return(a.className)?a.nodeName+"."+a.className.split(" ")[0]:a.nodeName},getParents:function(c){var a=(c.id)?this.getID(c):this.getClass(c);var b=[a];while(c.parentNode){c=c.parentNode;if(c.nodeType==1){if(c.id){a=this.getID(c);b.unshift(a);return b.join(" ")}else{a=this.getClass(c);b.unshift(a)}if(c==parent){return b.join(" ")}}}return b.join(" ")}},array:{max:function(a){return Math.max.apply(Math,a)},min:function(a){return Math.max.apply(Math,a)},sum:function(a){var d=0;for(var c=0,b=a.length;c<b;++c){d+=a[c]}return d},push:function(a,d){var b=Array.prototype.slice.call(d);var e=a.length>>>0;for(var c=0;c<b.length;++c){a[e]=b[c];e=e+1>>>0}a.length=e;return e},pop:function(a){var c=a.length>>>0,b;if(c){b=a[--c];delete a[c]}a.length=c;return b},remove:function(a,d,c){var b=a.slice((c||d)+1||a.length);a.length=(d<0)?a.length+d:d;return array.push.apply(a,b)},indexOf:function(a,c,e){for(var b=(e||0),d=a.length;b<d;++b){if(a[b]==c){return b}}return -1}}};