function OmniVar() {
	pageID = "";
	ALWAYS_DEBUG = false;
	DEBUG_ZONES = [ 'http://129.228.130.141:8080/','localhost:8080', 'dev.sho.com', 'qa.sho.com', 'posting.sho.com' ];
	RSID = "cbsshocom";
	TRACK_CLICKS_AS_SPROPS = false;
	PREFIX_CLICKS_W_PAGEDATA = true;
	UNDEFINED_PAGE_PREFIX = '!UNDEFINED';
}
function sCodePresent() {
	if( typeof s == "undefined") { 
		alert("Fatal Error: no s object found!\nPlease ensure that s_code.js is included in document body."); 
		return false; 
	}
	else {
		return true;
	}
}
function metaTagPresent() {
	if (!jQuery('meta[name=page-tracking]').length > 0) {	
		alert('Fatal Error: <meta name="page-tracking" /> not found!'); 
		return false; 
	}
	else {
		return true;
	}
}
function trackPage() {
	// safety checks
	if (!sCodePresent()) {
		 return;
	}
	if (!metaTagPresent()) {
		return;
	} 
	// read tracking id from meta tag
	pageID = jQuery('meta[name=page-tracking]').attr("content");
	// set path & hierarchy
	s.pageName = pageID;   
	s.hier1 = pageID[0];
	// set  insight vars (sprops) 1-9 
	var d=0;
	tagarray = pageID.split(' : ');
	jQuery.each(tagarray, function(intIndex) { 
		if (d < tagarray.length) {
			d++;
		}
		s[ 'prop'+(d+1)] = tagarray[d];
	});
	// look for custom s props
	if (jQuery('meta[nmae=page-tracking-props]').length == 1) { 
		var sprops = jQuery('meta[name=page-tracking-props]').attr("content");  
		sprops.split('&').each( function(str) {
			var key, val; 
			xx = str.split("=");
			key = xx[0];
			val = xx[1];
			if (!isNaN(Number(key))) {
				s[ 'prop'+key ] = val;
			}
		});
	}
	// make impression
	var s_code=s.t();
	if (s_code) {
		document.write(s_code);
	}
	// show impression data
	trace(pageID);
}
function trackClick( linkID ) {
	if (!sCodePresent()) { 
		return;
	}
	if (!metaTagPresent()) { 
		return;
	}
	// always load pageid from meta...		
	pageID = jQuery('meta[name=page-tracking]').attr("content");
	var s=s_gi(RSID);	
	// set custom insight vars 21-30 [s-props]
	if( TRACK_CLICKS_AS_SPROPS ) { 
		var props = linkID.split(' : ');
		for( var d=0; d<props.length; d++) {
			s['prop'+(d+21)] = props[d];
		}
	}		
	// prefix link w/ page location
	if (PREFIX_CLICKS_W_PAGEDATA) {
		if( pageID === null || typeof pageID == 'undefined' || pageID == '' ) {
			// if page location is bad, use url instead
			linkID = UNDEFINED_PAGE_PREFIX + ' : ' + document.location.pathname + ' : ' + linkID;
		} 
		else {
			linkID = pageID +':'+linkID;
		}
	}
	s.tl ( true, 'o', linkID );
	trace(linkID);
}
function trackVideo(hierarchy, id) {
	if (!sCodePresent()) {
		return;
	}
	pageID = hierarchy + id;
	// set path & hierarchy
	s.pageName=pageID;   
	s.hier1=pageID;
	// make impression
	var s_code=s.t();
	if (s_code) {
		document.write(s_code);
	}
// show impression data
	trace(pageID);
}	
function trace(s) {	
	if (!ALWAYS_DEBUG && (DEBUG_ZONES.join(' ').indexOf( window.location.host ) == -1 )) { 
		return;
	}
	if (jQuery('#omni-help-output').length < 1) { 
		drawTerminal(); 
	}
	jQuery('#omni-help-output').html(s);
}		
function drawTerminal() {
	var css = [
		'position:fixed',
		'bottom:0',
		'z-index:999999',
		'padding:4px 8px 4px 8px',
		'font-family:\'Courier New\', Courier, monospace',
		'font-size:11px',
		'background:#e1e1e1',
		'color:#000',
		'width:100%',
		'height:1em',
		'line-height:1em',
		'text-align:left',
		'border-top:1px solid #CCC'
	];
	jQuery('body').append('<div id="omni-help-output" style="' + css.join(' !important; ') + '"></div>'); 
}