_vsForceMDAPgID = ''; function printTLID() { if(isCookieSet('_vstl') && getCookie('_vstl') > 0){ return getCookie('_vstl'); } else{ return 0; } } function setCookie(c_name,value,expiredays){ var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())+ ";path=/"+ ";domain=" + _getDomain(); } function _getDomain() { var d = document.domain; if (d.substring(0,4)=="www.") { d=d.substring(4,d.length); } d=d.toLowerCase(); return d; } function getCookie(c_name){ if (document.cookie.length>0){ c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1){ c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } function isCookieSet(cookieName){ cookieVal = getCookie(cookieName); if (cookieVal != null && cookieVal != "") return true; return false; } function u_timestamp(){ return parseInt(new Date().getTime().toString().substring(0, 10)); } function _dummyVoid(){return;} function isNewVisit(){ return !isCookieSet('_vsvis'); } function parseVisitorID(){ return getCookie('_vsvis').split('.')[0]; } function parseSessionNumber(){ return parseInt(getCookie('_vsvis').split('.')[1]); } function updateVisitorCookie(visitorID,visitNumber){ setCookie('_vsvis',visitorID + '.' + visitNumber ,365*5); } function generateVisitorID(){ return hashString(uniqid()); } function hashString(s) { if (!s || s=="") return 1; var h=0,g=0; for (var i=s.length-1;i>=0;i--) { var c=parseInt(s.charCodeAt(i)); h=((h << 6) & 0xfffffff) + c + (c << 14); if ((g=h & 0xfe00000)!=0) h=(h ^ (g >> 21)); } return h; } function uniqid(){ var result, i, j; result = ''; for(j=0; j<32; j++){ if( j == 8 || j == 12|| j == 16|| j == 20) result = result; i = Math.floor(Math.random()*174174).toString(16).toUpperCase(); result = result + i; } return result; } function GetVisitorIDFromDB(){ return 0; } function GetSPIDFromDB(){ if(isCookieSet('_cpid')){ return getCookie('_cpid'); } else{ return 0; } } function trackPage(){ sourcePageID = GetSPIDFromDB(); isReload = 0; _vstl = '93'; try{ if(_vssale) blah=1/0; }catch(e){_vssale=0;} if (sourcePageID == _vspg){ sourcePageID = ''; isReload=1; } var newvisitor = null; var visitorIDDB = GetVisitorIDFromDB(); if (isNewVisit()) { newvisitor = 1; if(visitorIDDB == 0) visitorID = generateVisitorID(); else visitorID = visitorIDDB; sessionNumber = 1; setCookie('_vstl',_vstl,750); }else{ newvisitor = 2; if(visitorIDDB == 0) visitorID = parseVisitorID(); else visitorID = visitorIDDB; sessionNumber = parseSessionNumber(); setCookie('_vstl',_vstl,750); } vreferrer = null; if (document.referrer != '') vreferrer = document.referrer; else vreferrer = getCookie('_hrv'); updateVisitorCookie(visitorID,sessionNumber); setCookie('_cpid',_vspg,365*5); var i=new Image(1,1); if(_vssale !=null){ i.src='http://www.visiolo.com/visiolo.php?newvisitor=' + newvisitor + '&p=' + _vspg + '&vid=' + visitorID + '&spid=' + sourcePageID + '&vstl=' + getCookie('_vstl') + '&mdaPgID=' + _vsForceMDAPgID + '&isr=' + isReload + '&vssale=' + _vssale + '&referrer=' + vreferrer + '&url=' + document.location.href; } else{ i.src='http://www.visiolo.com/visiolo.php?newvisitor=' + newvisitor + 'p=' + _vspg + '&vid=' + visitorID + '&spid=' + sourcePageID + '&vstl=' + getCookie('_vstl') + '&mdaPgID=' + _vsForceMDAPgID + '&isr=' + isReload + '&referrer=' + vreferrer + '&url=' + document.location.href; } i.onload=function() { _dummyVoid(); } } function _vsForceSrcPg(pgid){_vsForceMDAPgID = pgid;} function forceSetPgID(pgid) {_vsForceSrcPg(pgid);} var Url = { encode : function (string) { return escape(this._utf8_encode(string)); }, _utf8_encode : function (string) { string = string.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; } }