/* ********************** LICENSE ******************************
 Matriceo Google Analytics Conversion Tracker by Resoneo
 Author   :     http://www.resoneo.com , TL, Olivier Vit; tracking@resoneo.com
 Date     :     June 2010
 Version  :     2010/06/25 12:00 - v5
 License terms :   CC  Attribution-Noncommercial-Share Alike 3.0 Unported
 http://creativecommons.org/licenses/by-nc-sa/3.0/ */
if(!this.GAJSON){this.GAJSON={};}(function(){function f(n){return n<10?"0"+n:n;}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key);}if(typeof rep==="function"){value=rep.call(holder,key,value);}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null";}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null";}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v;}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v);}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v;}}if(typeof GAJSON.stringify!=="function"){GAJSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" ";}}else{if(typeof space==="string"){indent=space;}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("GAJSON.stringify");}return str("",{"":value});};}if(typeof GAJSON.parse!=="function"){GAJSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}return reviver.call(holder,key,value);}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4);});}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j;}throw new SyntaxError("GAJSON.parse");};}}());
/** GACT LIBRARY **/
function r_gact(){var e=[];var c={};var a=5;var d=null;var b=15768000;var g=86400;var f=Math.round((new Date()).getTime()/1000);this.getAllSources=function(){return e;};this.getDomainName=function(){if(d!==null){return d;}else{var h=document.domain;if(0===h.indexOf("www.")){h=h.substring(3);}return h;}};this.getNbSources=function(){return e.length;};this.getLastSource=function(){return e[e.length-1];};this.getTimeLastSource=function(){if(this.getNbSources()>0){return e[e.length-1].da;}else{return f;}};this.checkTimeLastSource=function(){if((this.getTimeLastSource()+g)>f){return this.getTimeLastSource();}else{return f;}};this.getLastDirectStatus=function(){if(this.getNbSources()>0){return e[this.getNbSources()-1].d;}else{return 0;}};this.getTopLevel=function(){if(this.getNbSources()>0){return e[this.getNbSources()-1].lv;}else{return 0;}};this.getUrlVariable=function(j){var k=location.href.substring(location.href.indexOf("?")+1,location.href.length)+"&";if(k.indexOf("#")!=-1){k=k.substring(0,k.indexOf("#"))+"&";}var i=null;j=j+"=";var h=j.length;if(k.indexOf(j)!=-1){i=k.substring(k.indexOf(j)+h,k.length).substring(0,k.substring(k.indexOf(j)+h,k.length).indexOf("&"));}return i;};this.getTarget=function(){var h=this.readCookie("__utmmatch");if(h!==null){return h;}else{return"";}};this.checkTargetUrl=function(){var h=this.getUrlVariable("utm_match");if(h!==null){var i=b/24/60/60;this.createCookie("__utmmatch",h,i);c.ta=this.getTarget();}else{if(this.isNewSource(c)||this.isNewVisit()){if(this.getNbSources()>0){if(this.checkIfDirectAcces()===false){this.eraseCookie("__utmmatch");c.ta="";}}}}};this.isNewSource=function(h){return(GAJSON.stringify(h)!=GAJSON.stringify(this.getLastSource()));};this.compareSource=function(i){var h=this.getLastSource();return(i.cn==h.cn&&i.ta==h.ta&&i.ct==h.ct&&i.d==h.d&&i.lv==h.lv&&i.md==h.md&&i.sr==h.sr&&i.tr==h.tr);};this.isNewVisit=function(){if(typeof(_gat)!="undefined"){var h=this.readCookie("__utmb").split(".");return(h[1]==1);}return false;};this.addSource=function(){c.lv+=1;c.da=f;e.push(c);this.createCookie("r_gact_session",f,null);};this.checkIfDirectAcces=function(){var h=document.referrer;if(this.readCookie("r_gact_session")===null&&(h===null||h===""||h.indexOf(this.getDomainName().substr(1,this.getDomainName().length))>=0)&&this.compareSource(c)){return true;}else{if(this.readCookie("r_gact_session")!==null&&(parseInt(this.readCookie("r_gact_session"),10)+g)<f&&(h===null||h===""||h.indexOf(this.getDomainName().substr(1,this.getDomainName().length))>=0)&&this.compareSource(c)){return true;}}return false;};this.updateSourcesLog=function(){var i=this.readCookie("__utma").split(".");var j={};j.id=i[0]+"."+i[1];j.vs=this.getAllSources();var h=GAJSON.stringify(j);this.createCookie("r_gact",h,730);};this.createCookie=function(j,k,l){var h;if(l){var i=new Date();i.setTime(i.getTime()+(l*24*60*60*1000));h="; expires="+i.toGMTString();}else{h="";}document.cookie=j+"="+k+h+"; path=/"+"; domain="+this.getDomainName();};this.readCookie=function(m){var k=m+"=";var h=document.cookie.split(";");for(var j=0;j<h.length;j++){var l=h[j];while(l.charAt(0)===" "){l=l.substring(1,l.length);}if(l.indexOf(k)===0){return l.substring(k.length,l.length);}}return null;};this.eraseCookie=function(h){this.createCookie(h,"",-1);};this.getUtm=function(m){var o="";try{o=this.decodeValue(this.readCookie("__utmz"));try{o=this.decodeValue(o);}catch(r){}}catch(k){o=this.readCookie("__utmz");}var h=o.indexOf("utm");var j=o.substring(h);var p=j.split("|");var q="";for(var l=0;l<p.length;l++){if(p[l].indexOf("utm"+m)>=0){q=p[l];}}var n=q.indexOf("=");return this.encodeValue(q.substring(n+1));};this.encodeValue=function(h){if(typeof(encodeURIComponent)=="function"){return encodeURIComponent(h);}else{return escape(h);}};this.decodeValue=function(h){if(typeof(decodeURIComponent)=="function"){return decodeURIComponent(h);}else{return unescape(h);}};this.getUrlParam=function(i){i=i.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var h="[\\?&]"+i+"=([^&#]*)";var k=new RegExp(h);var j=k.exec(window.location.href);if(j===null){return null;}else{return this.decodeValue(j[1]);}};this.linkByPost=function(i,h){h.action=this.getLink(h.action);i._linkByPost(h);};this.getLink=function(i){var l=i.indexOf("?");var j=i.indexOf("#");var k="r_gact="+this.encodeValue(this.readCookie("r_gact")+"EOV");var h=i;if(l==-1&&j==-1){h=i+"?"+k;}else{if(j==-1){h=i+"&"+k;}else{if(l==-1){h=i.substring(0,j)+"?"+k+i.substring(j);}else{h=i.substring(0,j)+"&"+k+i.substring(j);}}}return h;};this.receiver=function(){var i=this.getUrlParam("r_gact");if(i!==null&&(i.match("EOV$")=="EOV")){var h=i.indexOf("EOV");i=i.substring(0,h);this.createCookie("r_gact",i,730);}};this.setVisitSessionTimeout=function(h){g=parseInt(h,10);};this.setCookieTimeout=function(h){b=parseInt(h,10);};this.setDomainName=function(h){d=h;};this.setMaxLevel=function(h){a=parseInt(h,10);};this.trackSource=function(){if(this.readCookie("r_gact")!==null){var k=this.readCookie("r_gact").indexOf("utmcmd");if(k==-1){var j=GAJSON.parse(this.readCookie("r_gact"));e=j.vs;}else{this.eraseCookie("r_gact");}}c.da=this.checkTimeLastSource();c.lv=this.getTopLevel();c.cn=this.getUtm("ccn");c.sr=this.getUtm("csr");c.tr=this.getUtm("ctr");c.md=this.getUtm("cmd");c.ct=this.getUtm("cct");c.ta=this.getTarget();c.d=this.getLastDirectStatus();c.ts=[];this.checkTargetUrl();if(this.getNbSources()>0){if(this.isNewSource(c)){if(this.checkIfDirectAcces()===true){c.d=1;}else{c.d=0;}this.addSource();}if(this.getNbSources()>a){var h=[];h.push(e[0]);for(var l=1;l<=a-1;l++){h[a-l]=e[this.getNbSources()-l];}e=h;}}else{this.addSource();}this.updateSourcesLog();};this.getSourcesLog=function(i,o,p,m,j){if(e.length>0){var l=e;if(p===true){p="1";}else{p="0";}var n={id:i.split(".").join("_"),tt:o.split(".").join(","),ty:m.split(".").join(","),cl:j.split(".").join(","),ok:p};l[e.length-1].ts.push(n);var h=this.readCookie("__utma").split(".");var k={};k.id=h[0]+"."+h[1];k.vs=l;return GAJSON.stringify(k);}return"";};}
