/*legacy support*/ _cq_analytics = function(){ return new _sw_analytics(); }; _sw_analytics = function (){ return { id:null, d:document, hit: new _sw_hit_info(), cookie: new _sw_cookie(), user: new _sw_user_info(), transaction: null, get_domain: function() { if(this.hit.domain!=null){ return this.hit.domain; }else{ return this.d.domain; } }, get_page: function() { if(this.hit.page!=null){ return this.hit.page; }else{ return this.d.location.href; } }, set_goal: function(goalId){ this.hit.set_goal(goalId); }, get_os: function(){ try{ var ua = navigator.userAgent; var re = new RegExp(/\([^\)]*\)/gi); var os = re.exec(ua)[0]; os = os.replace(/(\(|\))/gi, ''); os = os.split('; '); if(ua.toLowerCase().indexOf('opera') > -1){ osv = os[0]; }else{ osv = os[2]; } return(osv); }catch(e){ return '-'; } }, get_browser: function(){ var ua = navigator.userAgent; var re = new RegExp(/\([^\)]*\)/gi); var pl = re.exec(ua); if(pl){ uapl = pl[0].replace(/(\(|\))/gi, '').split('; '); if(uapl){ if(uapl[1].toLowerCase()=='u' | uapl[1].toLowerCase()=='i' | uapl[1].toLowerCase()=='n'){ enctype=uapl[1]; }else{ enctype='-'; } if(ua.toLowerCase().indexOf('msie') > -1){ vers=uapl[1]; } oa = ua.replace(pl,''); oa = oa.replace(/(\(|\))/gi, ''); oa = oa.replace(/\s{2,}/gi,' '); if(oa){ oa = oa.split(' '); if(oa.length > 2){ vers = oa[2]; } if(ua.toLowerCase().indexOf('safari') > -1) { vers = oa[6]; } if(ua.toLowerCase().indexOf('opera') > -1){ vers=oa[0]; } } } } else { vers = 'unknown'; } return(vers); }, get_flash: function(){ var fver='0'; var flash; if (navigator.plugins && navigator.plugins.length) { for (var v=0;v < navigator.plugins.length;v++) { if (navigator.plugins[v].name.indexOf('Shockwave Flash')!=-1) { fver=navigator.plugins[v].description.split('Shockwave Flash ')[1]; break; } } } else if (window.ActiveXObject) { for (var v=10;v >= 2;v--) { try { flash=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + v + "');"); if (flash) { fver=v + '.0'; break; } } catch(e) {} } } return fver; }, get_java: function(){ var jver = 0; /*try{ if(navigator.userAgent.toLowerCase().indexOf('msie')== -1 ){ if(navigator.javaEnabled){ if(typeof(java) != 'undefined'){ jver = java.lang.System.getProperty("java.version"); } } } }catch(e){} try{ for(var j=0; j < navigator.plugins.length; j++){ var desc = navigator.plugins[j].description; if(desc.toLowerCase().indexOf('java plug-in') > -1) { if(desc.toLowerCase().indexOf('apple java plug-in') > -1) { jver = 0; }else{ jver = desc.split(' ')[2]; } } } }catch(e){ }*/ return jver; }, get_referrer: function(){ var ref = this.d.referrer; if(ref && ref != ''){ //if(ref.indexOf('?') > -1){ // return( ref.substring(0,ref.indexOf('?')) ); //}else{ return ref; //} }else{ return('-'); } }, register_page_view: function(){ var id = '_sw_id=' + this.id; id += '&_sw_uid=' + this.user.get_sw_uid(); id += '&_sw_dat='; var ser = ((navigator.cookieEnabled?1:0)) + '|';/*0 - cookies enabled?*/ ser += this.get_domain() + '|';/*1 - domain*/ ser += this.get_page() + '|';/*2 - page*/ ser += ((navigator.browserLanguage!=null)?navigator.browserLanguage:navigator.language) + '|';//3 - language ser += screen.width + '|';/*4 - width*/ ser += screen.height + '|';/*5 - height*/ ser += screen.colorDepth + '|';/*6 - color depth(bits)*/ ser += this.get_browser() + '|';/*7 - browser name*/ ser += this.get_os() + '|';/*8 - operating system*/ ser += ((this.get_java()!=-1)?1:0) + '|';//9 - has java?*/ ser += this.get_java() + '|';/*10 - java version */ ser += ((this.get_flash()!=-1)?1:0) + '|';/*11 - has flash?*/ ser += this.get_flash() + '|';/*12 - flash version*/ ser += this.get_referrer() + '|';/*13 - referer*/ ser += this.user.get_site_unique_id() + '|'; /*14 - known user*/ ser += this.hit.goal; var __cqd = new Date(); var qs = id + b6.e(ser); if(this.transaction!=null){ qs+=this.transaction.get_transaction_b6(); } qs+='&to=' + __cqd.getMilliseconds(); this.user.set_sw_uid(this.user.get_sw_uid()); var i = new Image(1,1); _dp = window.location.protocol; var src= 'analytics.sitewit.com/images/cq_blank.gif?' switch(_dp){ case 'http:': i.src = 'http://' + src + qs; break; case 'https:': i.src = 'https://' + src + qs; break; } i.onload = function() {i.onload=null;} }, create_transaction:function(orderid,affiliation,subtotal,tax,city,state,country){ this.transaction = new _sw_transaction(); this.transaction.orderid = orderid; this.transaction.affiliation = affiliation; this.transaction.subtotal = subtotal; this.transaction.tax = tax; this.transaction.city = city; this.transaction.state = state; this.transaction.country = country; return this.transaction; } } }; _sw_cookie = function() { return { me:null, _sw_cookie:function(){ me=this; }, write: function(key,val,d){ if (d) { var dt = new Date(); dt.setTime(dt.getTime()+(d*24*60*60*1000)); var x = '; expires='+dt.toGMTString(); } else var x = ''; var dm = location.hostname; var dma = dm.split('.'); if(dma.length>2) dm = dma[dma.length-2] + '.' + dma[dma.length-1]; document.cookie = key+'='+val+x+'; path=/; domain='+dm; }, read: function(key){ var nEQ = key + '='; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' '){c = c.substring(1,c.length);} if (c.indexOf(nEQ) == 0){return c.substring(nEQ.length,c.length);} } return ''; }, clear: function(key){ this.write(key,''); } } }; _sw_user_info = function(){ return { c: new _sw_cookie(), get_sw_uid: function(){ var u = this.c.read('_swa_u'); if(u==''){ return '265a4149-914b-45c7-8bd7-d1d6f0eddad7'; }else{ return u; } }, get_site_unique_id: function(){ return b6.d(this.c.read('_swa_su')); }, set_site_unique_id: function(val){ this.c.write('_swa_su',b6.e(val),1000); }, set_sw_uid: function(val){ this.c.write('_swa_u',val,1000); } } }; _sw_hit_info = function(){ return { page: null, domain: null, goal: "", set_page: function(p){ this.page = p; }, set_domain: function(d){ this.domain = d; }, set_goal: function(g){ this.goal=g; } } }; _sw_item = function() { return { orderid: null, sku: null, productname: null, category: null, price: null, quantity: null } }; _sw_transaction = function() { return { orderid: null, affiliation: null, subtotal: null, tax: null, city: null, state: null, country: null, items: new Array(), add_item: function(sku,name,category,price,quantity){ itm = new _sw_item; itm.orderid=this.orderid; itm.sku=sku; itm.name=name; itm.category=category; itm.price=price; itm.quantity=quantity; this.items.push(itm); }, get_transaction_b6: function(){ var t = this.orderid + "|" + this.affiliation + "|" + this.subtotal + "|" + this.tax + "|" + this.city + "|" + this.state + "|" + this.country; t = b6.e(t); var i = ""; for(x=0;x < this.items.length;x++){ itm = this.items[x] i += itm.orderid + "|" + itm.sku + "|" + itm.name + "|" + itm.category + "|" + itm.price + "|" + itm.quantity; } i=b6.e(i); return '&_sw_trans=' + t + '&_sw_itms=' + i; } }; }; var b6 = { _k : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", e : function (input) { var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = b6.ue(input); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + this._k.charAt(enc1) + this._k.charAt(enc2) + this._k.charAt(enc3) + this._k.charAt(enc4); } return output; }, d : function (input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = this._k.indexOf(input.charAt(i++)); enc2 = this._k.indexOf(input.charAt(i++)); enc3 = this._k.indexOf(input.charAt(i++)); enc4 = this._k.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); } } output = b6.ud(output); return output; }, ue : 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; }, ud : function (utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while ( i < utftext.length ) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; } };