/****************************************
 * Numeric Analytics tagging framework
 * v 1.5  Oct 30th 2009
 * Updated 2/16/2010
****************************************/
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>';
if (location.hostname == "hettest4.harrahs.org")
	_numeric_.config.baseUrl ="//hettest4.harrahs.org/javascript_includes/numeric/";
else
	_numeric_.config.baseUrl ="//www.harrahs.com/javascript_includes/numeric/";
_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.addEvent = function(func, El, evt){
	try{
		if(El.attachEvent){
			El.attachEvent("on"+evt.toLowerCase(),func);
		}
		if(El.addEventListener){
			El.addEventListener(evt.toLowerCase(),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.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; });
}
// ******************  END UTILS *********************************
//******************  DOM UTILS *********************************

String.prototype.toProperCase = function(){
	return this.toLowerCase().replace(/\w+/g,function(s){
	return s.charAt(0).toUpperCase() + s.substr(1);
	})
	}
document.getElementsByClassName = function(cl) {
	var retnode = new Array();
	var myclass = new RegExp('\\b'+cl+'\\b');
	var elem = document.getElementsByTagName('*');
	if(elem.length ==0){if(document.all){elem =document.all;}}
	for (var i = 0; i < elem.length; i++) {
	var classes = elem[i].className;
	if (myclass.test(classes)) retnode.push(elem[i]);
	}
	return retnode;
	}; 
//******************  DOM UTILS *********************************
if(!omniWidgetFilename)
	var omniWidgetFilename = "omniWidget.js";
_numeric_.analyticsCallBack = function() {
	try{
		//load vendor widgets
		//Omniture
		_numeric_.utils.loadScriptLibrary(_numeric_.config.baseUrl + omniWidgetFilename,  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){}