// PATENT PENDING function _vs_popup(url, wid, ht){ var win; ht = ht || 600; wid = wid || 650; win = window.open(url, 'VSPOPUP', "toolbar=no,status=no,location=no,menubar=no,"+ "resizable=yes,scrollbars=yes,height=" + ht + ",width=" + wid, 'yes'); win.opener = self; win.focus(); win.location = url; } var _vsrkpd = { R: /(\(?)(\d*)(\d{3})([\s\)\.\-]*)(\d{3})([\s\.\-]*)(\d{4})(\d*)/, dbg: document.URL.match(/\?.*_vsdebug/), esc: function(txt){ if(typeof encodeURIComponent=="function"){ return encodeURIComponent(txt) }else{ return escape(txt) } }, unesc: function(txt){ if(typeof decodeURIComponent=="function"){ return decodeURIComponent(txt) }else{ return unescape(txt) } }, arg: function(p, v){ if( v ){ return p + '=' + this.esc(v) + ';'; }else{ return ''; } }, alert: function(m){ if( this.dbg ){ alert(m); } }, set_cookie: function(name, val, exp){ var ck = name + "=" + this.esc( val ) + ";path=/"; if(exp){ var now = new Date(); exp = new Date( now.getTime + exp ); ck = ck + ";expires=" + exp.toGMTString(); } document.cookie = ck; }, get_cookie: function(n){ var c = document.cookie; var s = c.indexOf( n + '=' ); if( s == -1 ) return null; if( s && c.charAt(s-1) != ' ' ) return null; var e = c.indexOf(';', s); if( e == -1 ) e = c.length; return this.unesc(c.substring( s + n.length + 1, e )); }, get_number_data: function(){ var n = 'rkpd_' + vs_account_id; var d = this.get_cookie(n); var ignck = document.URL.match(/\?.*_vsignck/); if( d && !ignck ){ this.alert( "cookie[" + n + "]: " + d); eval(d); // json-cookie this.rewrite_document(); }else{ // fetch data var url = "http://adtrack.voicestar.com/euinc/getnumdata.js?" + this.arg('var', '_vsrkpd.d') + this.arg('acc', window.vs_account_id) + this.arg('cky', n) + this.arg('ign', (ignck ? 1 : 0)) + this.arg('ref', document.referrer) + this.arg('url', document.URL); this.alert( "no cookie[" + n + "] fetch: " + url); document.write(''); // next script will run replace_numbers } }, rewrite_number: function(m){ // (, x, 111, ), 555, -, 1234, x if( m[2] != '' || m[8] != '' ){ return null; } var num = '' + m[3] + m[5] + m[7]; var pd = this.d; var rw,lk,na,nb,nc,rwtxt; var nr = pd.length; var i; for(i=0; i text, number, text var n2 = node.splitText( m.index ); var n3 = n2.splitText( m[0].length ); if( ! rw ) return; // number unchanged n2.nodeValue = rw.text; if( ! rw.href ) return; // no ctc var a = document.createElement('A'); node.parentNode.replaceChild(a, n2); a.appendChild(n2); a.href = '#'; a.className = 'vsctcnumber'; if( this.dbg ){ a.title = 'cmp:' + rw.cmp; }else{ a.title = 'Click To Call'; } a.onclick = function(){ _vs_popup( rw.href, 300,200 ); }; // ... }, replace_all_numbers: function(node){ if( ! node ) return; // skip certain types? if( node.nodeName == 'SCRIPT' || node.nodeName == 'STYLE' ) return; // handle special spans? if( node.className == 'vsnotnumber' ) return; // rewrite this node text if( node.nodeName == '#text' ){ this.rewrite_text_node( node ); } // walk children nodes var nn, i; for(i=0; i