/*@cc_on @*/
var pragma_once;
if (pragma_once != null) {
alert('Debug assertion failed: tracker.js.php is included more than once\nDouble inclusion prevented\nFor more information refer to Sales-n-Stats integration manual');
} else if (document.getElementsByTagName('BODY')[0] == null) {
alert('Debug assertion failed: tracker.js.php cannot find BODY element\ntracker.js.php script must be located inside BODY element\nFor more information refer to Sales-n-Stats integration manual');
} else {
pragma_once = true;
/*@if
(@_jscript_version>4)
try
{@end @*/
var trackerMouseMoved = false;
var trackerFormSubmitted = false;
var trackerTimeInterval = 30000;
var eventPumpDelay = 15000;
var trackerReactionDelay = 3000;
var trackerScriptName = "http://www.thetoyfederation.com/sns/click.php";
var eventScriptName = "http://www.thetoyfederation.com/sns/eventpump.js.php";
var trackerDirName = "http://www.thetoyfederation.com/sns";
var eventPumpInterval = 15000;
var trackerWindowActive = true;
var trackerScriptId = "trackerScript";
var trackerStopTime = 10800000 + new Date().getTime();
// } /// -------- [/tracker]
function trackerSubmitEvent1()
{
return trackerSubmitEvent(this, false);
}
function trackerSubmitEvent2()
{
return trackerSubmitEvent(this, true);
}
function trackerSubmitEvent(form, onSubmitEvent)
{
/*@if
(@_jscript_version>4)
try
{@end @*/
var action = form.action;
if (form.attributes && form.attributes['action'])
{
action = form.attributes['action'].value;
}
trackerSetCookie("httpAction", action);
var first = true;
var cookieData = "";
for(var i=0; i
256) {
name = name.substring(0, 255) + "...";
}
if (value.length > 256) {
value = value.substring(0, 255) + "...";
}
cookieData += (first ? "" : "&") + escape(element.name) + "=" + escape(value)
first = false;
}
}
trackerSetCookie("postdata", cookieData);
for (var i=0;i4)
} catch (err) {}
@end @*/
}
function getSpanTagValues()
{
return"";
var spanTags = "";
var elements = document.getElementsByTagName('*');
var first = true;
for (i = 0; i < elements.length; i++) {
var some = elements[i];
if (some.tagName.toUpperCase() != "SPAN") {
continue;
}
var tagId = some.id;
if (!tagId) {
tagId = some.name;
}
if (!tagId) {
continue;
}
matched = false;
for (j = 0; j < spanPrefixes.length; j++) {
if (("" + tagId).indexOf(spanPrefixes[j]) == 0) {
matched = true;
break;
}
}
if (!matched) {
continue;
}
var content = some.innerHTML;
if (!content || content == "") {
content = some.innerText;
}
spanTags += (first ? "" : "&") + escape(tagId) + "=" + escape(content);
if (first) {
first = false;
}
}
return spanTags;
}
var trackerIFrameObj;
function snsShowTrackerIFrame(url)
{
var IFrameDoc;
try {
if (trackerIFrameObj.contentDocument) {
// For NS6
IFrameDoc = trackerIFrameObj.contentDocument;
} else if (trackerIFrameObj.contentWindow) {
// For IE5.5 and IE6
IFrameDoc = trackerIFrameObj.contentWindow.document;
} else if (trackerIFrameObj.document) {
// For IE5
IFrameDoc = trackerIFrameObj.document;
}
IFrameDoc.write("");
IFrameDoc.close();
} catch (err) {
alert("Error: "+err.description);
}
}
var stop_tracking_external = false;
function trackerLoadScript(url)
{
if (window.top.location.protocol == "file:"
|| new Date().getTime() > trackerStopTime
|| stop_tracking_external) {
return;
}
doc = window.top.document;
body = doc.body;
scriptTag = doc.getElementById(trackerScriptId);
if (scriptTag) {
scriptTag.parentNode.removeChild(scriptTag);
}
// safari/ie on macos
if (navigator.userAgent.indexOf("Safari") != -1 || navigator.userAgent.indexOf("Mac_PowerPC") != -1 || navigator.userAgent.indexOf("Konqueror") != -1) {
var id;
id = trackerScriptId;
var tempIFrame=window.top.document.createElement('iframe');
tempIFrame.setAttribute('id',id);
tempIFrame.style.border='0px';
tempIFrame.style.position = 'absolute';
tempIFrame.style.top = 0;
tempIFrame.style.left = 0;
tempIFrame.style.width = 0;
tempIFrame.style.height = 0;
tempIFrame.style.zIndex = 0;
tempIFrame.style.visibility = "hidden";
tempIFrame.frameBorder = "no";
tempIFrame.marginWidth = 0;
tempIFrame.marginHeight = 0;
trackerIFrameObj = window.top.document.body.appendChild(tempIFrame);
if (window.top.document.frames && navigator.userAgent.indexOf("Mac_PowerPC") != -1) {
trackerIFrameObj = window.top.document.frames[id];
}
// we have to give fraction of a second
// to recognize the new IFrame
setTimeout('snsShowTrackerIFrame("'+url+'")',200);
} else {
scriptTag = doc.createElement('SCRIPT');
scriptTag.type = 'text/javascript';
scriptTag.id = trackerScriptId;
scriptTag.src = url;
body.appendChild(scriptTag);
}
}
var trackerClickSent = false;
function trackerActivityPing(isClick)
{
if (isClick && trackerClickSent) {
return;
}
setTimeout('trackerActivityPing(false)', trackerTimeInterval);
trackerClickSent = true;
if (!(isClick || trackerWindowActive)) {
// inactive ping
return;
}
url = trackerScriptName + trackerQueryString();
if (! (trackerFormSubmitted || isClick)) {
url += "&ping=1";
}
if (trackerFormSubmitted) {
trackerFormSubmitted = false;
}
if (isClick) {
trackerSetCookie("postdata", "");
trackerSetCookie("personal_client_id", "739080043");
trackerSetCookie("httpAction", "");
}
trackerLoadScript(url);
}
function trackerReactionCheck()
{
trackerLoadScript(eventScriptName+"?"+new Date().getTime());
setTimeout('trackerReactionCheck()', eventPumpInterval);
}
function trackerWindowActivate() {
/*@if
(@_jscript_version>4)
try
{@end @*/
trackerWindowActive = true;
if (windowOnFocusHandler) windowOnFocusHandler();
/*@if (@_jscript_version>4)
} catch (err) {}
@end @*/
}
function trackerWindowMouseMove(evt) {
/*@if
(@_jscript_version>4)
try
{@end @*/
if (!trackerMouseMoved) {
trackerWindowActive = true;
if (windowOnMouseMoveHandler) windowOnMouseMoveHandler();
// trackerMouseMoved = true;
}
/*@if (@_jscript_version>4)
} catch (err) {}
@end @*/
}
function trackerWindowDeactivate() {
/*@if
(@_jscript_version>4)
try
{@end @*/
trackerWindowActive = false;
if (windowOnBlurHandler) windowOnBlurHandler();
/*@if (@_jscript_version>4)
} catch (err) {}
@end @*/
}
function trackerWindowOnLoad()
{
/*@if
(@_jscript_version>4)
try
{@end @*/
submitEvents = new Array();
onsubmitEvents = new Array();
for (var i=0;i < document.forms.length;i++) {
try {
submitEvents[i] = document.forms[i].submit;
onsubmitEvents[i] = document.forms[i].onsubmit;
document.forms[i].onsubmit = trackerSubmitEvent2;
document.forms[i].submit = trackerSubmitEvent1;
} catch (err) {
// just swallow the error
// browser caps don't allow us to capture form submit
}
}
windowOnBlurHandler = window.onblur;
window.onblur = trackerWindowDeactivate;
windowOnFocusHandler = window.onfocus;
window.onfocus = trackerWindowActivate;
windowOnMouseMoveHandler = document.onmousemove;
document.onmousemove = trackerWindowMouseMove;
trackerWindowActive = false;
setTimeout('trackerReactionCheck()', trackerReactionDelay);
// document.write("");
if (navigator.appName == "Microsoft Internet Explorer") {
if (windowOnLoadHandler) windowOnLoadHandler();
setTimeout("trackerActivityPing(true);", 10);
} else {
trackerActivityPing(true);
if (windowOnLoadHandler) windowOnLoadHandler();
}
/*@if (@_jscript_version>4)
} catch (err) {
}
@end @*/
}
function trackerSetCookie(cookieName, cookieValue)
{
document.cookie = cookieName + "=" + escape(cookieValue) + "; path=/";
}
function trackerGetCookie(cookiename) {
/*@if
(@_jscript_version>4)
try
{@end @*/
var cookiestring=""+document.cookie;
var index1=cookiestring.indexOf(cookiename+"=");
if (index1==-1) return "";
var index2=cookiestring.indexOf(';',index1);
if (index2==-1) index2=cookiestring.length;
return cookiestring.substring(index1+cookiename.length+1,index2);
/*@if (@_jscript_version>4)
} catch (err) {}
@end @*/
}
function trackerQueryString()
{
/*@if
(@_jscript_version>4)
try
{@end @*/
var postdata = trackerGetCookie("postdata");
if (postdata!="") {
postdata = "postdata="+escape(postdata) + "&";
}
var httpAction = trackerGetCookie("httpAction");
if (httpAction!="") {
httpAction = "httpAction="+escape(httpAction) + "&";
}
return "?" + postdata + httpAction + "url=" + escape(escape(document.location)) + "&time=" + new Date().getTime() + "&referrer=" + escape(escape(document.referrer)) + "&spanTags=" + escape(getSpanTagValues()) + "&title=" + escape(window.top.document.title);
/*@if (@_jscript_version>4)
} catch (err) {alert('error: '+err.description);}
@end @*/
}
/*@if (@_jscript_version>4)
} catch (err) {}
@end @*/
windowOnLoadHandler = window.onload;
window.onload = trackerWindowOnLoad;
}
function snsStopTracking()
{
stop_tracking_external = true;
}
/*@cc_off @*/