/****************************************
 * Numeric Analytics tagging framework
 * v 1.0
****************************************/
try{
var _numeric_ = new Object;

// ****************** START CONFIG *********************************
_numeric_.config=new Object;
_numeric_.config.openScrpt = '<scr' + 'ipt language="JavaScript" type="text/javascript" src="';
_numeric_.config.closeScrpt = '"></scr' + 'ipt>';
_numeric_.config.baseUrl ="//"+location.hostname+"/scripts/webAnalytics/";
_numeric_.date = new Date();
if(! _numeric_.config.pnPrefix) _numeric_.config.pnPrefix="";

// ****************** END CONFIG *********************************

// ****************** START UTILS *********************************
_numeric_.utils=new Object;
_numeric_.setProperty = function(pName,pValue){
	this[pName] = pValue;
}
_numeric_.getProperty = function(pName){
	if(this[pName]){return this[pName];}else{return "";}
}
_numeric_.utils.getEventTarget = function(e){
	try {
		var targ;
		if (!e) {
			var e = window.event;
		}
		if (e.target) {
			targ = e.target;
		}
		else if (e.srcElement) {
			targ = e.srcElement;
		}
		if (targ.nodeType == 3) {
			targ = targ.parentNode;
		}
		return targ;
		} catch(e) {}
}
_numeric_.utils.getEventTargetName = function(e){
	try {
		var targ;
		if (!e) {
			var e = window.event;
		}

		if (e.target) {
			targ = e.target;
		}
		else if (e.srcElement) {
			targ = e.srcElement;
		}

		if (targ.nodeType == 3) {
			targ = targ.parentNode;
		}
		return targ.tagName;
		} catch(e) {}
}
_numeric_.utils.addOnClickEvent = function(func, El){
	try{
		if(El.attachEvent){
			El.attachEvent("onclick",func);
		}
		if(El.addEventListener){
			El.addEventListener("click",func,false);
		}
		return this;
	}catch(e){}
}
_numeric_.utils.addOnSubmitEvent = function(func, El){
	try{
		if(El.attachEvent){
			El.attachEvent("onsubmit",func);
		}
		if(El.addEventListener){
			El.addEventListener("submit",func,false);
		}
		return this;
	}catch(e){}
}
_numeric_.utils.loadScriptLibrary = function(src, targetElement, olFunction) {
	try{
		if (_numeric_.scriptElement == null) {
			_numeric_.scriptElement = document.createElement('script');

			_numeric_.scriptElement.setAttribute('type', 'text/javascript');
			_numeric_.scriptElement.setAttribute('language', 'javascript');
			_numeric_.scriptElement.setAttribute('src', src);
			_numeric_.scriptElement.setAttribute('id', src);

		}
		if (targetElement == null){
			if (_numeric_.headElement == null)
				_numeric_.headElement = document.getElementsByTagName('body')[0];
			targetElement = _numeric_.headElement;
		}
		var library = _numeric_.scriptElement.cloneNode(true);
		library.src = src;
		if(typeof olFunction == 'function'){			
			if(! _numeric_.isIE){
				library.addEventListener("load",olFunction,false);
			}else{
				olFunIE = olFunction.toString();	
				if(olFunIE.indexOf('function ')!= -1){	
					olFunIE = olFunIE.substr('function '.length);
					olFunIE = olFunIE.substr(0, olFunIE.indexOf(')')+1);
				}else{
					olFunIE = olFunIE.substr(olFunIE.indexOf('{')+1, olFunIE.lastIndexOf('}')-(olFunIE.indexOf('{')+1));
				}
				library.onreadystatechange = function () {					
					if (library.readyState == 'complete'  || library.readyState == 'loaded') {
						eval(olFunIE);
					}
				}				
			}		
		}

		targetElement.appendChild(library);
	}catch(e){}
}
_numeric_.utils.addOnloadEvent = function(func, El){
		try{
			if(typeof El == "undefined"){
				El = window;
			}
			if(El.attachEvent){
					El.attachEvent("onload",func);
			}
			if(El.addEventListener){
				El.addEventListener("load",func,false);
			}
			return this;
		}catch(e){}
	}
_numeric_.utils.queryStringToHash = function(str){
		try{
			var qs=[];
			var a=str.indexOf("?")>-1?str.split("?")[1].split("&"):str.split("&");
			for(var x=0;x<a.length;x++){
				var b=a[x].split("=");
				qs[b[0].toLowerCase()]=b[1];
			}
			return qs;
		}catch(e){}
	}
_numeric_.utils.readCookie = function(name){
		try{
			var name=name+"=";
			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(name)==0){return c.substring(name.length,c.length)};
			}
			return null;
		}catch(e){}
	}
_numeric_.utils.setCookie = function(name,value){
		try{
			document.cookie=name+"="+value+"; path=/";
		}catch(e){}
	}
_numeric_.utils.decode = function( $str ){
	try{
		var $entities = [ ['%f8','%20'], ['%a0', '%20'],  ['%3e','%20'], ['%3c','%20'],  ['%26','%20'],  ['%22','%20'] ];
		var $ii = 0;
		var $estr = escape( $str );
		$estr = $estr.toLowerCase();
			while ($ii < $entities.length){
				$estr = $estr.replace(new RegExp($entities[$ii][0], "g"), $entities[$ii][1] );
				$ii++;
			}
		return unescape($estr);
	}catch(e){return $str;}
}
_numeric_.utils.getText = function(nodeOrig){
	try{
	 var rtn= "";
	 var t=0;
	 var fcn = function(node){
	 	if(t < 100){
		 	for(var c=0;c<node.childNodes.length;c++){
				var childnode=node.childNodes[c];
				switch(childnode.nodeType){
					case 3:
						rtn += _numeric_.utils.decode (childnode.nodeValue);
						break;
					case 1:
						t++;
						fcn(childnode);
						break;
					};
				}
	 		}
		 }
		 fcn(nodeOrig);
	return rtn;
	}catch(e){return "";}
	}


_numeric_.isIE = (window.navigator.userAgent.indexOf("MSIE") > 0);
if (!  _numeric_.isIE ) {
  HTMLElement.prototype.__defineGetter__("innerText",
              function () { return(this.textContent); });
  HTMLElement.prototype.__defineSetter__("innerText",
              function (txt) { this.textContent = txt; });
}
//utility function to return the current version of flash the client browser is running
_numeric_.flashDetection = function(){
	/*
	Copyright (c) Copyright (c) 2007, Carl S. Yestrau All rights reserved.
	Code licensed under the BSD License: http://www.featureblend.com/license.txt
	Version: 1.0.4
	*/
	var FlashDetect = new function(){
	    var self = this;
	    self.installed = false;
	    self.raw = "";
	    self.major = -1;
	    self.minor = -1;
	    self.revision = -1;
	    self.revisionStr = "";
	    var activeXDetectRules = [
	        {
	            "name":"ShockwaveFlash.ShockwaveFlash.7",
	            "version":function(obj){
	                return getActiveXVersion(obj);
	            }
	        },
	        {
	            "name":"ShockwaveFlash.ShockwaveFlash.6",
	            "version":function(obj){
	                var version = "6,0,21";
	                try{
	                    obj.AllowScriptAccess = "always";
	                    version = getActiveXVersion(obj);
	                }catch(err){}
	                return version;
	            }
	        },
	        {
	            "name":"ShockwaveFlash.ShockwaveFlash",
	            "version":function(obj){
	                return getActiveXVersion(obj);
	            }
	        }
	    ];
	    /**
	     * Extract the ActiveX version of the plugin.
	     * 
	     * @param {Object} The flash ActiveX object.
	     * @type String
	     */
	    var getActiveXVersion = function(activeXObj){
	        var version = -1;
	        try{
	            version = activeXObj.GetVariable("$version");
	        }catch(err){}
	        return version;
	    };
	    /**
	     * Try and retrieve an ActiveX object having a specified name.
	     * 
	     * @param {String} name The ActiveX object name lookup.
	     * @return One of ActiveX object or a simple object having an attribute of activeXError with a value of true.
	     * @type Object
	     */
	    var getActiveXObject = function(name){
	        var obj = -1;
	        try{
	            obj = new ActiveXObject(name);
	        }catch(err){
	            obj = {activeXError:true};
	        }
	        return obj;
	    };
	    /**
	     * Parse an ActiveX $version string into an object.
	     * 
	     * @param {String} str The ActiveX Object GetVariable($version) return value. 
	     * @return An object having raw, major, minor, revision and revisionStr attributes.
	     * @type Object
	     */
	    var parseActiveXVersion = function(str){
	        var versionArray = str.split(",");//replace with regex
	        return {
	            "raw":str,
	            "major":parseInt(versionArray[0].split(" ")[1], 10),
	            "minor":parseInt(versionArray[1], 10),
	            "revision":parseInt(versionArray[2], 10),
	            "revisionStr":versionArray[2]
	        };
	    };
	    /**
	     * Parse a standard enabledPlugin.description into an object.
	     * 
	     * @param {String} str The enabledPlugin.description value.
	     * @return An object having raw, major, minor, revision and revisionStr attributes.
	     * @type Object
	     */
	    var parseStandardVersion = function(str){
	        var descParts = str.split(/ +/);
	        var majorMinor = descParts[2].split(/\./);
	        var revisionStr = descParts[3];
	        return {
	            "raw":str,
	            "major":parseInt(majorMinor[0], 10),
	            "minor":parseInt(majorMinor[1], 10), 
	            "revisionStr":revisionStr,
	            "revision":parseRevisionStrToInt(revisionStr)
	        };
	    };
	    /**
	     * Parse the plugin revision string into an integer.
	     * 
	     * @param {String} The revision in string format.
	     * @type Number
	     */
	    var parseRevisionStrToInt = function(str){
	        return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
	    };
	    /**
	     * Is the major version greater than or equal to a specified version.
	     * 
	     * @param {Number} version The minimum required major version.
	     * @type Boolean
	     */
	    self.majorAtLeast = function(version){
	        return self.major >= version;
	    };
	    /**
	     * Is the minor version greater than or equal to a specified version.
	     * 
	     * @param {Number} version The minimum required minor version.
	     * @type Boolean
	     */
	    self.minorAtLeast = function(version){
	        return self.minor >= version;
	    };
	    /**
	     * Is the revision version greater than or equal to a specified version.
	     * 
	     * @param {Number} version The minimum required revision version.
	     * @type Boolean
	     */
	    self.revisionAtLeast = function(version){
	        return self.revision >= version;
	    };
	    /**
	     * Is the version greater than or equal to a specified major, minor and revision.
	     * 
	     * @param {Number} major The minimum required major version.
	     * @param {Number} (Optional) minor The minimum required minor version.
	     * @param {Number} (Optional) revision The minimum required revision version.
	     * @type Boolean
	     */
	    self.versionAtLeast = function(major){
	        var properties = [self.major, self.minor, self.revision];
	        var len = Math.min(properties.length, arguments.length);
	        for(i=0; i<len; i++){
	            if(properties[i]>=arguments[i]){
	                if(i+1<len && properties[i]==arguments[i]){
	                    continue;
	                }else{
	                    return true;
	                }
	            }else{
	                return false;
	            }
	        }
	    };
	    /**
	     * Constructor, sets raw, major, minor, revisionStr, revision and installed public properties.
	     */
	    self.FlashDetect = function(){
	        if(navigator.plugins && navigator.plugins.length>0){
	            var type = 'application/x-shockwave-flash';
	            var mimeTypes = navigator.mimeTypes;
	            if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
	                var version = mimeTypes[type].enabledPlugin.description;
	                var versionObj = parseStandardVersion(version);
	                self.raw = versionObj.raw;
	                self.major = versionObj.major;
	                self.minor = versionObj.minor; 
	                self.revisionStr = versionObj.revisionStr;
	                self.revision = versionObj.revision;
	                self.installed = true;
	            }
	        }else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
	            var version = -1;
	            for(var i=0; i<activeXDetectRules.length && version==-1; i++){
	                var obj = getActiveXObject(activeXDetectRules[i].name);
	                if(!obj.activeXError){
	                    self.installed = true;
	                    version = activeXDetectRules[i].version(obj);
	                    if(version!=-1){
	                        var versionObj = parseActiveXVersion(version);
	                        self.raw = versionObj.raw;
	                        self.major = versionObj.major;
	                        self.minor = versionObj.minor; 
	                        self.revision = versionObj.revision;
	                        self.revisionStr = versionObj.revisionStr;
	                    }
	                }
	            }
	        }
	    }();
	};
	FlashDetect.JS_RELEASE = "1.0.4";
	return(FlashDetect.raw);
	
}
_numeric_.utils.sendEvent = function(el,event, vars, vals, type){
		try{
			s=s_gi(s_account);
			var tmp = new Array;
			if(typeof vars == "undefined" || vars == "" || vars == null){
			 //add vars with correlations
				s.linkTrackVars ="events";
				s.linkTrackEvents =event;
				s.events=event;
			}else{
			 //add vars with correlations
				s.linkTrackVars ="events"+vars;
				s.linkTrackEvents =event;
				if(event != "None"){
					s.events=event;
				}
				tmp = vars.split(',');
				var tmp1 = vals.split(',');
				for(i=0;i<tmp.length;i++){
					s[tmp[i]]= tmp1[i]; 
				}				
			}
			if(typeof type == "undefined"){
				s.tl(el, 'o');
			}else{
				s.tl(el, type);
			}
			for(i=0;i<tmp.length;i++){
					s[tmp[i]]= ""; 
				}
			s.linkTrackVars ="None"
			s.linkTrackEvents ="None";
			
		}catch(e){}
	}	
// ******************  END UTILS *********************************

_numeric_.analyticsCallBack = function() {
	try{
		//load vendor widgets
		//Omniture
		_numeric_.utils.loadScriptLibrary(_numeric_.config.baseUrl +"omniWidget.js",  document.getElementsByTagName('head')[0]);
		//Google Analytics
		//_numeric_.utils.loadScriptLibrary(_numeric_.config.baseUrl + "gaWidget.js",  document.getElementsByTagName('head')[0]);

	}catch(e){}
}

//Call vender code
//Omniture
_numeric_.utils.loadScriptLibrary(_numeric_.config.baseUrl +"s_code.js",  document.getElementsByTagName('head')[0], metricTranslation);

//Google Analytics
//_numeric_.utils.loadScriptLibrary(_numeric_.config.baseUrl +"ga.js",  document.getElementsByTagName('head')[0]);

}catch(e){}
