/*
 * Modified vs.js code to migrate tracking to comScore sitestat
 * - Includes key functionality and wrappers
 * - Does not include video tracking
 */

var _VT={
	SET:function(B,A,C) {},
	SEND:function(A,B) {}
};
var _JT={
	SET:function(B,A,C) {},
	SEND:function(A,B) {}
};

// Create cookie
var comScoreCCookie = function(name,value,days,domain) {
	var expires = "";
	if(!domain) {
		domain = document.domain;
	}
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	document.cookie = name+"="+value+expires+"; path=/; domain="+domain;
}

// Read cookie, return null for non-existing
var comScoreRCookie = function (name) {
	var nameEQ = name + "=",
		ca = document.cookie.split(';'),
		c;
	for(var i=-1,l=ca.length;++i<l;) {
		c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) === 0)  {
			return c.substring(nameEQ.length,c.length);
		}
	}
	return null;
}
//Custom Code
var pt = pt === undefined ? {} : pt,
	tmsec_str = '',
	tmsec = tmsec !== undefined ? tmsec : [];
if(tmsec!==undefined){
	for (var i=-1,l=tmsec.length;++i<l;){ 
		if (tmsec[i].indexOf("<") === -1) {
			tmsec_str +="/"+tmsec[i].split("=")[1];
		}
	} 
}

// Sitestat technical stats, once per visit per domain
(function (window, document) {
var comScoreCookieName = 'comScoreCheck',
	domainParts = document.domain.split('.').reverse(),
	domainMain = '.'+domainParts[1]+'.'+domainParts[0];
if(typeof(window['comScoreRCookie']) === 'function' && typeof(window['comScoreCCookie']) === 'function') { 
	if(!comScoreRCookie(comScoreCookieName)) {
		// Copyright (c) 1999-2004 Nedstat B.V.
		// All rights reserved.
		// By using this software, you are agreeing to be bound by the
		// terms of this license: http://www.nedstat.com/terms.html
var ns_scriptversion="132";// 2004-05-24
function ns_14(){var ns_02 = navigator.appVersion;var ns_00 = parseInt(ns_02.substring(ns_02.indexOf("MSIE")+5, ns_02.indexOf("MSIE")+6));if (ns_00 > 0) ns_02 = 0;else ns_02 = parseInt(ns_02);return ns_02;}function ns_22(){var ns_02 = navigator.appVersion;var ns_01 = parseInt(ns_02.substring(ns_02.indexOf("MSIE")+5, ns_02.indexOf("MSIE")+6));if(ns_01>0) ns_02=ns_01;else ns_02=0;return ns_02;}function ns_pluginNetscape(){var ns_pluglength = navigator.plugins.length;var ns_08 = "";if(ns_pluglength>0){ns_08 = "&ns_java="+navigator.javaEnabled()+"&ns_plugins=";for(ns_24 = 0 ; ns_24 < ns_pluglength ; ns_24++){var ns_29 = false;for(ns_23 = 0 ; ns_23 < ns_24 ; ns_23++)ns_29 = (navigator.plugins[ns_24].description == navigator.plugins[ns_23].description);if(!ns_29)ns_08 += escape(navigator.plugins[ns_24].description +"|");}}return ns_08;}function ns_10(){var ns_15 = navigator.mimeTypes;var ns_17 = ns_15.length;if(ns_17>0){ns_08 = "&ns_mimetypes=";for(ns_24=0;ns_24<ns_17;ns_24++){ns_29 = false;for(ns_23=0;ns_23<ns_24;ns_23++)if(ns_15[ns_24].enabledPlugin == ns_15[ns_23].enabledPlugin)ns_29 = true;if(!ns_29)ns_08 += escape(ns_15[ns_24].description + "|")}}return ns_08;}function ns_12(){if(!document.body){document.write('<body>');}var ns_33=document.body;var ns_13 = 0;var ns_34 = 1;ns_11=new Array("47F67D00-9E55-11D1-BAEF-00C04FC2D130","7790769C-0471-11D2-AF11-00C04FA35D02","283807B5-2C60-11D0-A31D-00AA00B92C03","9381D8F2-0288-11D0-9501-00AA00B911A5","5A8D6EE0-3E18-11D0-821E-444553540000","630B1DA0-B465-11D1-9948-00C04F98BBC9","45EA75A0-A269-11D1-B5BF-0000F8051515","76C19B50-F0C8-11CF-87CC-0020AFEECF20","D27CDB6E-AE6D-11CF-96B8-444553540000","2A202491-F00D-11CF-87CC-0020AFEECF20","08B0E5C0-4FCB-11CF-AAA5-00401C608500","3AF36230-A269-11D1-B5BF-0000F8051515","3BF42070-B3B1-11D1-B5C5-0000F8051515","90A7533D-88FE-11D0-9DBE-0000C0411FC3","10072CEC-8CC1-11D1-986E-00A0C955B42F","4F645220-306D-11D2-995D-00C04F98BBC9","1CDEE860-E95B-11CF-B1B0-00AA00BBAD66","73FA19D0-2D75-11D2-995D-00C04F98BBC9","23064720-C4F8-11D1-994D-00C04F98BBC9","22D6F312-B0F6-11D0-94AB-0080C74C7E95","CA8A9784-280D-11CF-A24D-444553540000","CA8A9780-280D-11CF-A24D-444553540000","B801CA65-A1FC-11D0-85AD-444553540000");ns_33.addBehavior("#default#clientcaps");for(var ns_18=0;ns_18<ns_11.length;ns_18++)
{if(ns_11[ns_18])if(ns_33.isComponentInstalled("{"+ns_11[ns_18]+"}","ComponentID"))ns_13|=ns_34;ns_34*=2;}return ns_13;}function ns_26(ns_l7){var ns_31 = "";for(var i = 0; i < ns_l7.elements.length ; i++){var ns_28 = ns_l7.elements[i];if(ns_28.name){if(ns_28.type == "select-multiple") {for(var j = 0 ; j < ns_28.options.length ; j++)if(ns_28.options[j].selected)ns_31 += ns_28.name+";";}else if(ns_28.type == "select-one") {ns_31 += ns_28.name+";";}else if(ns_28.type == "checkbox" || ns_28.type == "radio") {if(ns_28.checked)ns_31 += ns_28.name+";";}else ns_31  += ns_28.name+";";}}return ns_31.substring(0,ns_31.lastIndexOf(";"));}function sitestatForm(ns_30, ns_pixelUrl, ns_03){if (ns_03 == null)ns_03 = ns_26(ns_30);if(ns_14() >=4 || ns_22() >= 4){var ns_07 = ns_03.split(";");ns_07_length = ns_07.length;ns_pixelUrl += '&ns_type=submit&ns__t=' + parseInt((new Date()).getTime());for(var ns_24=0;ns_24<ns_30.elements.length;ns_24++){var ns_32 = ns_30.elements[ns_24];var ns_04;ns_16 = false;if(ns_03){for(ns_t = 0; ns_t < ns_07_length; ns_t++)if(ns_32.name == ns_07[ns_t])ns_16 = true;}else{if(ns_32.name)ns_16 = true;}if(ns_16){if(ns_32.type == 'select-multiple'){for(var ns_j=0;ns_j<ns_32.options.length;ns_j++)if(ns_32.options[ns_j].selected)ns_pixelUrl = ns_pixelUrl + "&ns_f_" + escape(ns_32.name) + "=" + escape(ns_32.options[ns_j].value);}else{if(ns_32.type == 'select-one')ns_04 = ns_32.options[ns_32.selectedIndex].value;else{if(ns_32.type == 'checkbox' || ns_32.type == 'radio')if(!ns_32.checked)continue;ns_04 = ns_32.value;}ns_pixelUrl = ns_pixelUrl + "&ns_f_" + escape(ns_32.name) + "=" + escape(ns_04);}}}ns_30.onsubmit = null;var ns_21 = new Image();ns_21.ns_30 = ns_30;ns_21.onload = ns_1O;ns_21.onerror = ns_1O;ns_21.onabort = ns_1O;document.sitestatForm = ns_30;ns_21.timerID = setTimeout(ns_19, 5000);ns_21.src = ns_pixelUrl;}}function ns_1O(){this.onload = null;this.onerror = null;this.onabort = null;clearTimeout(this.timerID);this.ns_30.submit();}function ns_19(){var ns_30 = document.sitestatForm;ns_30.onload = null;ns_30.onerror = null;ns_30.onabort = null;ns_30.submit();}function ns_25()
{ns_pixelUrl+="&ns_type=hidden&ns_ver="+ns_scriptversion;if(ns_14() >=3) {ns_pixelUrl+=ns_pluginNetscape();ns_pixelUrl+=ns_10();}if(ns_14() >=4 || ns_22() >= 4){var ns_screen=screen;if(parent.innerWidth) {ns_pixelUrl+= "&ns_innersize="+parent.innerWidth+"x"+parent.innerHeight+ "&ns_offset="+parent.pageXOffset+"x"+parent.pageYOffset;}ns_pixelUrl +=  "&ns_availscreen="+ns_screen.availWidth+"x"+ns_screen.availHeight;if(ns_screen)ns_pixelUrl += "&ns_screen="+ns_screen.width+"x"+ns_screen.height+"&ns_colordepth="+ns_screen.colorDepth;}if(document.images)	{ns_pixel= new Image();ns_pixel.src=ns_pixelUrl;}}function ns_09(){if(typeof (ns_loadingtime2) != "undefined"){var ns_html_loading_time=(ns_loadingtime2 - ns_loadingtime1)/1000;var ns_full_loading_time=((new Date()).getTime() - ns_loadingtime1)/1000;ns_pixelUrl += "&ns_html_loading_time="+ns_html_loading_time+"&ns_full_loading_time="+ns_full_loading_time;ns_25();}if (typeof (ns_05)!="undefined")ns_06();}document.cookie = "ns_cookietest=true";if(document.cookie.indexOf("ns_cookietest",0)>=0){if(document.cookie.indexOf("ns_session",0)<0){document.cookie = "ns_session=true";if (typeof(ns_pixelUrl) != "undefined" ) {if (ns_22() >= 5 && navigator.appVersion.indexOf("Mac")<0) {ns_pixelUrl+="&ns_p="+ns_12();}if (typeof (ns_loadingtime1) == "undefined" || ns_22() < 4)ns_25();else {if (document.body.onload) {ns_05 = 1;ns_06 = document.body.onload;}document.body.onload = ns_09;}}}}
comScoreCCookie(comScoreCookieName, 'true', null, domainMain);
}}})(window, window.document);

// Standard sitestat measurement function
function sitestat(k){
	var e,
		d,
		j=document,
		f=j.location;
	ns_pixelUrl=k+"&ns__t="+(new Date().getTime());
	k=ns_pixelUrl+"&ns_c="+((j.characterSet)?j.characterSet:j.defaultCharset)+"&ns_ti="+escape(j.title)+"&ns_jspageurl="+escape(f&&f.href?f.href:j.URL)+"&ns_referrer="+escape(j.referrer);
	if(k.length>2000&&k.lastIndexOf("&")){
		k=k.substring(0,k.lastIndexOf("&")+1)+"ns_cut="+k.substring(k.lastIndexOf("&")+1,k.lastIndexOf("=")).substring(0,40)
	}
	ns_=typeof ns_!="undefined"?ns_:{};
	ns_.pipeline=typeof ns_.pipeline!="undefined"?ns_.pipeline:[];

	var sti = document.createElement('img');
	sti.style.height = '1px';
	sti.style.width = '1px';
	sti.style.border = '0 none';
	sti.style.display = 'none';
	sti.src = k;
	var st = document.getElementsByTagName('body')[0];
	st.appendChild(sti);
};
// Multipurpose tracking function for sitestat
/*
 * pageName - Name for page, exluding tmsec values, which are automatically added. Can be left empty, defaults to document.title
 * type - Tracking type, either "page" (normal) or "link" (event tracking)
 * parameters - An array of JSON-style parameter objects to pass "mtv3_"-custom parameters, can also be passed as a global variable named "comScoreParameters" (lower priority)
 * account - Measurement account (site) override, defaults to tmsec1 in lowercase, setting any value will override the automatic value for "site" and "category"
 *
 * parameters item format: {'name': 'varname', 'value': 'var value'}
 *
 * All values are automatically scaped
 */
var comScoreTrack = function(pageName, type, parameters, account) {
	var comScoreType = type !== undefined ? type : 'page', // Measurement type, either "page" or "link", defaults to page
		continueTracking = true,
		mtv3_tmsec = window.tmsec !== undefined ? window.tmsec : [], // Use tmsec from tns metrics code
		mtv3_pt = window.pt !== undefined ? window.pt : {}, // pt object for in-page custom variables
		// Array of accounts, each account is an array: first element is the match phrase and the second is the DAx "site" value
		mtv3_account_list = [['mtv3_etusivu', 'mtv3-etusivu'],['uutiset', 'uutiset'],['saa', 'saa'],['urheilu','urheilu'],['viihde', 'viihde'],['katsomo', 'katsomo'],['ohjelmat','ohjelmat'],['helmi','helmi'],['koti', 'koti'],['makuja', 'makuja'],['matkailu', 'matkailu'],['luukku', 'luukku'],['juniori', 'juniori'],['studio55', 'studio55'],['kimppadiili', 'kimppadiili'],['keventajat', 'keventajat'],['jokakoti', 'jokakoti'],['pelit', 'pelit'],['kanavapaketti', 'kanavapaketti'],['canalplus', 'canalplus'],['store', 'store'],['leijonakauppa', 'leijonakauppa'],['eat', 'eat'],['seoikea', 'seoikea'],['keskustelut', 'keskustelut'],['subtv', 'subtv'],['nettitv','nettitv']],
		URLVars = {};
	if(comScoreType !== 'page' && comScoreType !== 'link') {
		// Non-recognized page type, discard tracking
		continueTracking = false;
	}
	if(location.search) {
		var parts = location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
			URLVars[key] = value;
		});
	}
	// Must be accepted type and sitestat must be a function. tmsec array must have at least one element (necessary for account information)
	if(continueTracking && typeof(sitestat) === 'function') { 
		parameters = typeof(parameters) === 'object' ? parameters : []; // Read parameters
		var	mtv3_charset = document.characterSet ? document.characterSet : document.defaultCharset,
			mtv3_vars,
			mtv3_cmp = URLVars.cmp !== undefined ? URLVars.cmp : '',
			mtv3_pagename = (pageName !== undefined && pageName) ? escape(pageName.replace(/(\&|\=|\/|\\|\<|\>|\+|\()/g, '|')) : escape(document.title.replace(/(\&|\=|\/|\\|\<|\>|\+|\()/g, '|')), // Set and encode page name, default document.title
			mtv3_tmsecstr = '', // tmsec string for page name (not the same as tmsec_str)
			mtv3_tmsecnew = ['', '', ''], // Fixed tmsec order parameter, order tmsec1, tmsec, tmsec2
			tempTmsecVal, // Place holder for tmsec value looping
			mtv3_site, // Site (account) place holder
			mtv3_defaultsite = 'muut', // Default site
			comScorePrefix = 'mtv3_', // Custom variable prefix
			mtv3_loadingtime1 = mtv3_loadingtime1 !== undefined ? mtv3_loadingtime1 : 0, // If loadingtime1 is found, set it
			mtv3_loadingtime2 = mtv3_loadingtime2 !== undefined ? mtv3_loadingtime2 : 0, // If loadingtime2 is found, set it
			comScoreURL = location.protocol+"//fi.sitestat.com/mtv3/%site%/s?%mtv3tmsec_str%."+mtv3_pagename+"."+comScoreType; // URL Base to use for measurement call
		if(typeof(window.comScoreParameters) === 'object') {
			mtv3_vars = parameters;
			for(var x = -1, y = window.comScoreParameters.length;++x<y;) {
				mtv3_vars.push({'name': window.comScoreParameters[x].name, 'value': window.comScoreParameters[x].value});
			}
		} else {
			mtv3_vars = parameters;
		}
		if(typeof(mtv3_pt) === 'object') {
			for(var A in mtv3_pt){
				if((typeof(mtv3_pt[A]) === 'string' || typeof(mtv3_pt[A]) === 'number') && A !== 'tmsec') {
					mtv3_vars.push({'name': A.toString(), 'value': mtv3_pt[A]});
				}
			}
		}
		if(comScoreType === 'link') { 
			comScoreURL += '&ns_type=hidden'; // Additional URL parameter to indicate event tracking (links etc.)
		}
		for(var i=-1,l=mtv3_tmsec.length;++i<l;) { // Loop tmsec and set for page naming and account
			if(mtv3_tmsec[i] !== undefined) { 
				tempTmsecVal = mtv3_tmsec[i].replace(/^tmsec.?\=/g, '');
				if(/^tmsec1\=/.test(mtv3_tmsec[i])) {
					mtv3_tmsecnew[0] = tempTmsecVal;
				} else if(/^tmsec\=/.test(mtv3_tmsec[i])) {
					mtv3_tmsecnew[1] = tempTmsecVal;
				} else if(/^tmsec2\=/.test(mtv3_tmsec[i])) {
					mtv3_tmsecnew[2] = tempTmsecVal;
				}
			}
		}
		// Set site. Defaults to the following order: tmsec1 - tmsec - tmsec2 - mtv3_defaultsite
		mtv3_site = (mtv3_tmsecnew[0] !== '' ? mtv3_tmsecnew[0] : (mtv3_tmsecnew[1] !== '' ? mtv3_tmsecnew[1] : (mtv3_tmsecnew[2] !== '' ? mtv3_tmsecnew[2] : mtv3_defaultsite)));
		mtv3_site = mtv3_site.replace(/^tmsec.?\=/g, '');
		mtv3_tmsecstr = mtv3_site !== mtv3_defaultsite ? mtv3_site : 'error';

		// Use the default site if the tmsec value is not on the list
		var validAccount = false;
		var acctMatch;
		for (var iz = -1, jz = mtv3_account_list.length; ++iz < jz;) {
			acctMatch = new RegExp('^'+mtv3_account_list[iz][0]+'($|\_)', 'i');
	        if (acctMatch.test(mtv3_site.toLowerCase())) { 
		        validAccount = true;
		        mtv3_site = mtv3_account_list[iz][1];
		    }
	    }
		if(!validAccount) {
			mtv3_site = mtv3_defaultsite;
		}

		if(account !== undefined) { // Override automatic account detection if parameter found
			mtv3_site = account;
		}

		// Category parameter, same as "site"-name
		comScoreURL += "&category="+mtv3_tmsecstr; 

		// Replace _ in site name with -
		mtv3_site = mtv3_site.replace(/\_/g, '-');

		// Add custom campaign ID
		if(mtv3_cmp !== '') {
			mtv3_vars.push({'name': 'campaign', 'value': mtv3_cmp});
		}

		if(tmsec !== undefined) { 
			mtv3_vars.push({'name': 'tmsec', 'value': mtv3_tmsecnew.join('.').replace(/(\.+$|^\.+)/g, '').replace(/\.{2,}/g, '.')}); // Add tmsec string as URL parameter, dot separated, leading, ending and duplicate dots removed
		} else {
			mtv3_vars.push({'name': 'tmsec', 'value': 'error'}); // If tmsecs are not set, use "error"
		}

		// These defaults can be overwritten by giving them as parameter values to the function, below are defaults
		if(pageName === undefined || !pageName) {
			mtv3_vars.push({'name': 't', 'value': document.title}); // Add title to parameters
		} else {
			mtv3_vars.push({'name': 't', 'value': pageName}); // Add title to parameters
		}
		mtv3_vars.push({'name': 'r', 'value': document.referrer}); // Add referrer to parameters
		if(mtv3_loadingtime1 !== 0 && mtv3_loadingtime2 !== 0) { // Page loadtime, if found
			mtv3_vars.push({'name':'ltime', 'value': (mtv3_loadingtime2-mtv3_loadingtime1)});
		}
		comScoreURL = comScoreURL.replace(/\%site\%/, mtv3_site.toLowerCase()).replace(/\%mtv3tmsec_str\%/, mtv3_tmsecstr); // Replace account and pagename place holders with real values
		for(var z=-1,v=mtv3_vars.length;++z<v;) { // Loop and add parameters to string (and URI encode them)
			comScoreURL += '&'+comScorePrefix+mtv3_vars[z].name+'='+escape(mtv3_vars[z].value);
		}
		sitestat(comScoreURL); // Send tracking call
	}
};
function OmnsendPage(OmnpageName) { 
	if(typeof(comScoreTrack) === 'function') {
		comScoreTrack(OmnpageName, 'page');
	}
}
function sendPage(pageName) {
	if(typeof(comScoreTrack) === 'function') {
		comScoreTrack(pageName, 'page');
	}
}
function trackFlashClick(obj) {
	if(obj!==undefined && obj.value!==undefined){
		if(typeof(comScoreTrack) === 'function') {
			comScoreTrack('', 'link', [{'name': 'link', 'value': obj.value}]);
		}
	}
}
function sendLinkClick(name) {
	if(name) {
		if(typeof(name) === 'object') {
			if(typeof(trackFlashClick) === 'function') {
				trackFlashClick(name);
			}
		} else if(typeof(comScoreTrack) === 'function') {
			comScoreTrack('', 'link', [{'name': 'link', 'value': name}]);	
		}
	}
}
function sendPageView(pageName) {
    if(typeof(comScoreTrack) === 'function') {
	    comScoreTrack(pageName, 'page');
	}
}

function OmnsendUID(OmnpageName, OmnUID) { 
	if(typeof(comScoreTrack) === 'function') {
		comScoreTrack(OmnpageName, 'page', [{'name':'userid', 'value':OmnUID}, {'name': 't', 'value': OmnpageName}]);
	}
}
// Link click handler
function comScoreLinkTrack(obj) {
	var title,
		isImage = false,
		objName,
		sendData = true,
		typeTest,
		type,
		alt,
		link;
	// Text links all browsers
	// Image links all except IE
	if(obj !== undefined && typeof(comScoreTrack) === 'function') {
		type = (obj.name !== undefined && obj.name) ? 'other' : false; // Text link or non-IE image link

		if(!type) {
			if(typeof(obj.parentNode) !== 'undefined') {
				if(typeof(obj.parentNode.name) !== 'undefined') {
					if(obj.parentNode.name) {
						if(obj.tagName.toLowerCase() === 'img' && obj.parentNode.tagName.toLowerCase() === 'a') { // Is image and the parent is an anchor element
							type = 'ieimg';
							objName = obj.parentNode.name;
						}
					}
				}
			}
		} else {
			objName = obj.name;
		}
		link = obj.href !== undefined ? obj.href : 'no-href';

		if(type) {
			switch(type) {
				case 'other': // Text links and non-IE image links check
					if (obj.tagName.toLowerCase() === 'a') { // Is anchor element
						var c = obj.childNodes; // Get link child nodes
						for (var i=-1,l=c.length; ++i<l;) { // Loop child nodes
							if (c[i].tagName !== undefined && c[i].tagName.toLowerCase() === 'img') { // If tagName exists and is an img-tag
								isImage = true; // We have an image
								if (c[i].getAttribute('title') !== undefined) { // Has a title-attribute
									alt = c[i].getAttribute('title');
								} else if(c[i].getAttribute('alt') !== undefined) { // Has an alt-attribute
									alt = c[i].getAttribute('alt');
								} else if(c[i].getAttribute('src') !== undefined) { // Not attributes, get img src
									alt = c[i].getAttribute('src').replace(/.*\//g, '');
								} else { // This means image has no alt, title or src
									sendData = false;
								}
								if(sendData) { // If we have an image and we're sending it, this loop is done
									break;
								}
							}
						}

						if(!isImage && obj.innerHTML !== undefined) { // If we have a text link, remove all tags
							title = obj.innerHTML.replace(/<\/?[^>]+(>|$)/g, "");
						}
					}
					break;
				case 'ieimg': // IE image link
					if (obj.tagName.toLowerCase() === 'img' && obj.parentNode.tagName.toLowerCase() === 'a') { 
						isImage = true; // We have an image
						if (obj.getAttribute('title') !== undefined) { // Has a title-attribute
							alt = obj.getAttribute('title');
						} else if(obj.getAttribute('alt') !== undefined) { // Has an alt-attribute
							alt = obj.getAttribute('alt');
						} else if(obj.getAttribute('src') !== undefined) { // Not attributes, get img src
							alt = obj.getAttribute('src').replace(/.*\//g, '');
						} else { // Not attributes, skip
							sendData = false;
						}
					}
					break;
				default:
					sendData = false;
			}
		}
		if(alt) {
			title = 'kuva: ' + alt; // If we have an image, add identifier
		}
		if (title && sendData && type) {
			title = title.replace(/[\r\n\t\v\0]+/g, ""); // Remove line breaks from value
			var mtv3_parameters = [{'name': 'link', 'value': objName}, {'name': 'link_text', 'value': title}, {'name': 'link_url', 'value': link}];
			comScoreTrack('', 'link', mtv3_parameters);
		}
	}
}
var comScoreBindEvent = function(element, type, handler) { 
	if(element.addEventListener) { 
		element.addEventListener(type, handler, false); 
	} else { 
		element.attachEvent('on'+type, handler); 
	} 
};
var _JTOnLink = function(obj) {
	if(typeof(comScoreLinkTrack) === 'function') {
		comScoreLinkTrack(obj);
	}
};
var comScoreLinkTracker = function() {
	var a = document.getElementsByTagName('a');
	for(var i=-1,l=a.length;++i<l;){
		if(a[i].protocol !== "javascript:") {
			comScoreBindEvent(a[i], 'click', function() { comScoreLinkTrack(this); });
		}
	}
};

(function (window,document) {
	var noHitPageVar = 'comScoreNoTrack';
	if(typeof(window[noHitPageVar]) === 'undefined' || window[noHitPageVar] === false) {
		comScoreTrack();
	}
})(window,window.document);
comScoreLinkTracker();
