
/// <reference path="jquery.js" />
  
var _udn		="auto";	// (auto|none|domain) set the domain name for cookies
var _utimeout	="1800";   // set the inactive session timeout in seconds
var _ugifpath	="https://trailer.mymarketing.co.il/Step/__utm.gif"//"/__utm.gif";	// set the web path to the __utm.gif file
var _utsp		="|";		// transaction field separator
var _ucid		="details";	//campaign details
var _us			=0;			//flag to update tracker server
var _uu;					//rundom number for seesion 

var _qsDmn		="dmn";		//domain query
var _strCk		="ck";		//start cookie with
var _qsPg		="pg";		//page query





//-- **** Don't modify below this point ***
var _udh,_udt,_udo="",_ust=0,_ubd=document,_udl=_ubd.location,_utcp="/";





function activetrailTraker(page) {
 if (_udl.protocol=="file:") return;

 var dc=_ubd.cookie;
 _uu=_uGuid();//Math.round(Math.random()*2147483647);

 _udh=_uDomain();

 _udt=new Date();
 _ust=Math.round(_udt.getTime()/1000);

 if (_udn && _udn!="") { _udo=" domain="+_udn+";"; }

 _uInfo(page);
}



function _uInfo(page) {
 var p,s="",pg=_udl.pathname+_udl.search;
 if (page && page!="") pg=_uES(page,1);

 s+=_uCInfo();
 if (_udl.hostname && _udl.hostname!="") s+= _qsDmn + "="+_uES(_udl.hostname);

 s+="&" + _qsPg + "=" + pg;

 if (_us && _ubd.cookie!="") {
	//debugger
	var i2=new Image(1,1);
	i2.src=_ugifpath+"?"+s+"&" + _uGCS();
	i2.onload=function() { _uVoid(); }
 }
 return;
}


function _uGCS() {
 var t,c="",dc=_ubd.cookie;
 if ((t=_uGC(dc,"ck="+_udh,";"))!="-") c+=_uES("ck="+t+";+");
 if (c.charAt(c.length-1)=="+") c=c.substring(0,c.length-1);
 return c;
}


function _uVoid() { return; }


function _uCInfo() {
//debugger;
 var c="",t="-",i=0,z="-",s="";
 s+=_udl.search;
 var x=new Date(_udt.getTime()+(_utimeout*1000));
 var dc=_ubd.cookie;
 x=" expires="+x.toGMTString()+";";

 z=dc.indexOf(_udh);
 if (z>-1) { z=_uGC(dc,_udh,";"); }
 else { z="-"; }
 t=_uGC(s,_ucid+"=","&");
 if (t!="-" && t!="") {
	c+=  _uu  + "." + _uEC(t);
 }

 //Cookie doesn't exist and _Session.User enters from email with details
 if(z=="-" && c!=""){
	_us=1;
	_ubd.cookie= _strCk + "=" + _udh + "." + _ust + "." + c + "; path=" + _utcp + ";" + x + _udo; 
 }
 //Cookie exists and _Session.User enters with details to update
 if(z!="-" && c!="" && z.indexOf(c)<0){
	_us=1;
	_ubd.cookie= _strCk + "=" + _udh +  "." + _ust + "." + c + "; path=" + _utcp + ";" + x + _udo; 
 }
  //Cookie exists
 if(z!="-"){
	_us=1;
 }
 return "";
}


function _uGuid()
{
    var g="";
    for(var i = 0; i < 32; i++)
		g += Math.floor(Math.random() * 0xF).toString(0xF) + (i == 8 || i == 12 || i == 16 || i == 20 ? "-" : "")
    return g;
}



function _uGC(l,n,s) {
 if (!l || l=="" || !n || n=="" || !s || s=="") return "-";
 var i,i2,i3=0,c="-";
 i=l.indexOf(n);
 if(n.toString().indexOf("=")>-1){
	 i3=n.indexOf("=")+1;
 }
 if (i > -1) {
  i2=l.indexOf(s,i); if (i2 < 0) { i2=l.length; }
  c=l.substring((i+i3),i2);
 }
 return c;
}


function _uDomain() {
 if (!_udn || _udn=="" || _udn=="none") { _udn=""; return 1; }
 if (_udn=="auto") {
  var d=_ubd.domain;
  if (d.substring(0,4)=="www.") {
   d=d.substring(4,d.length);
  }
  _udn=d;
 }
  return _uHash(_udn);
}


function _uHash(d) {
 if (!d || d=="") return 1;
 var h=0,g=0;
 var r=0;
 for (var i=d.length-1;i>=0;i--) {
  var c=parseInt(d.charCodeAt(i));
  h=((h << 6) & 0xfffffff) + c + (c << 14);  
  if ((g=h & 0xfe00000)!=0) h=(h ^ (g >> 21));
 }
 return h;
}

function _uEC(s) {
  var n="";
  if (!s || s=="") return "";
  for (var i=0;i<s.length;i++) {if (s.charAt(i)==" ") n+="+"; else n+=s.charAt(i);}
  return n;
}

function _uES(s,u) {
 if (typeof(encodeURIComponent) == 'function') {
  if (u) return encodeURI(s);
  else return encodeURIComponent(s);
 } else {
  return escape(s);
 }
}

