var runningAdsenseAdCount = 0;

// JavaScript Document

// WINDOW EVENT MANAGEMENT FUNCTIONS
// <function name="addLoadEvent">
function addLoadEvent(func) 
{
	var oldOnload = window.onload;
	if (typeof(func) == 'string')
	{
		eval("func = function(){"+func+";}");
	}
	if( typeof(oldOnload) != 'function' )
	{
		window.onload = func;
	}
	else 
	{
		window.onload = function() 
		{
			oldOnload();
			func();
	  	}
	}
}
// </function>

// <function name="addUnloadEvent">
function addUnloadEvent(func) 
{
	var oldUnload = window.onunload;
	if (typeof(func) == 'string')
	{
		eval("func = function(){"+func+";}");
	}
	if( typeof(oldUnload) != 'function' )
	{
		window.onunload = func;
	}
	else 
	{
		window.onunload = function() 
		{
			oldUnload();
			func();
	  	}
	}
}
// </function>

// <function name="addResizeEvent">
function addResizeEvent(func) 
{
	var oldResize = window.onresize;
	if (typeof(func) == 'string')
	{
		eval("func = function(){"+func+";}");
	}
	if( typeof(oldResize) != 'function' )
	{
		window.onresize = func;
	}
	else 
	{
		window.onresize = function() 
		{
			oldResize();
			func();
	  	}
	}
}
// </function>


//ADDS ALLBUSINESS.COM TO THE USERS FIREFOX SEARCH BAR (AKA installing Sherlock plugin)
function addABEngine(engineURL, iconURL, suggestedName, suggestedCategory)
{
	if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function"))
	{ 
		window.sidebar.addSearchEngine(engineURL, iconURL, suggestedName, suggestedCategory);
	}
	else
	{
		alert("Sorry, you need a Mozilla-based browser to add AllBusiness.com to your Internet Search Bar.");
	} 
}
//ADDS ALLBUSINESS.COM TO THE USERS IE7 SEARCH BAR (AKA installing OpenSearch plugin)
function addABOpenEngine(engineURL)
{
	if ((typeof window.external == "object"))
	{ 
		window.external.AddSearchProvider(engineURL);
	}
	else
	{
		alert("Sorry, you need Internet Explorer v7 or any OpenSearch compliant browser,\nto add AllBusiness.com to your Internet Search Bar.");
	} 
}

function openNewWindow(theUrl,winParams)
{
	var theWin = window.open(theUrl,'', winParams);
	theWin.focus();
}

function formPostPrep(formId,compId,nextStep)
{
	var form = document.getElementById("formWrapper_"+formId);
	var compIdInput = form["formPostCompId"];
	var nextInput = form["formPostNext"];
	compIdInput.value = compId;
	nextInput.value = nextStep;
}

function changeDisplay( elementId, setTo ) {
	if( document.getElementById ) { var theElement = document.getElementById( elementId ); } else {
		if( document.all ) { var theElement = document.all[ elementId ]; } else { var theElement = new Object(); } }
	if( !theElement ) { return; }
	if( theElement.style ) { theElement = theElement.style; }
	if( typeof( theElement.display ) == 'undefined' && !( window.ScriptEngine && ScriptEngine().indexOf( 'InScript' ) + 1 ) ) { window.alert( 'Nothing works in this browser.' ); return; }
	theElement.display = setTo;
}

SS_CHANGE_HANDLERS = new Array();
function addStyleSheetChangeHandler(theFunc)
{
	if(typeof(theFunc) == "string")
	{
		eval("theFunc = function(){"+theFunc+";}");
	}
	if(typeof(theFunc) == "function")
	{
		SS_CHANGE_HANDLERS[SS_CHANGE_HANDLERS.length] = theFunc;
	}
}
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")  && a.getAttribute("title") != 'Paginator') 
	{
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
  for(i=0;i<SS_CHANGE_HANDLERS.length;i++)
  	SS_CHANGE_HANDLERS[i]();
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(Math.round(days*24*60*60*1000)));  // Jerry: Add rounding in case days is fractional.
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = 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(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function cookieHandler()
{
	this.createCookie = createCookie;
	this.readCookie = readCookie;
	this.eraseCookie = eraseCookie;
}

function getStylesheetFromCookie(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);

  if(document.getElementsByTagName)
  { 
  	// evens column heights
    matchColumns();			 
  } 

}
addLoadEvent(getStylesheetFromCookie);

function getActiveStyleSheetTitle(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}
addLoadEvent(getActiveStyleSheetTitle);

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);


var IsABLink = false; 
function ab_click(cid,lid)//[linkType]
{
	var linkType = "media";
	if(arguments.length >= 3)
		linkType = arguments[2];
	eraseCookie("COMPONENTID");
	createCookie("COMPONENTID", cid, 1);
	
	try {
		if(typeof( s_ab ) != 'undefined'){
		s_ab.linkTrackEvents="event13"; 	// Check for Omniture Events
		s_ab.linkTrackVars="events,eVar18";
		s_ab.events="event13";
		s_ab.eVar18=cid;
		s_ab.tl(this,'o',cid);
		} else if(typeof( s ) != 'undefined'){
			s.linkTrackEvents="event13"; 	// Check for Omniture Events
			s.linkTrackVars="events,eVar18";
			s.events="event13";
			s.eVar18=cid;
			s.tl(this,'o',cid);
	}
	} catch (e) {}

	try {
		if (lid > 0) {
			IsABLink = true;
			if (ShowExitSurvey) ShowExitSurvey();
		}
	} catch (e) {}
	return true;
}

function enableField()
{
document.form1.address2.disabled=false;
}

// to enable: <a href="javascript:enableField()">Click here to enable the element<a/> //


var toggledDisplay = new Object();
    toggledDisplay['lyr1'] = true;
    toggledDisplay['lyr2'] = true;
    toggledDisplay['lyr3'] = true;
	toggledDisplay['lyr4'] = true;
	toggledDisplay['lyr5'] = true;
	toggledDisplay['lyr10'] = true;
	toggledDisplay['lyr11'] = true;
	toggledDisplay['lyr12'] = true;
	toggledDisplay['lyr13'] = true;
	toggledDisplay['lyr14'] = true;
	toggledDisplay['lyr15'] = true;
	toggledDisplay['lyr16'] = true;

function toggleDisplay(bDisplayed)
{
  if(!document.getElementById || toggleDisplay.arguments.length < 2) return;
  var displayed = new Object();
      displayed['true'] = 'block';
      displayed['false'] = 'none';
  for(var i = 1; i < toggleDisplay.arguments.length; i++)
  {
    oDisplay = document.getElementById(toggleDisplay.arguments[i]);
    if(oDisplay)
    {
      oDisplay.style.display = displayed[bDisplayed];
      // mozilla is the only browser out of the lot that can't get this right.  so, if we're
      // setting an object's display style to block, we gotta reload any images contained
      // within that block.  mozilla won't do it for you like every other browser that
      // supports the functionality of changing the display style dynamically.
      // begin crap browser hack
      if(bDisplayed)
      {
        oImages = oDisplay.getElementsByTagName('IMG');
        for(var j = 0; j < oImages.length; j++)
          oImages[j].src = oImages[j].src;
      }
      // end mozilla, err, crap browser hack
       if(typeof toggledDisplay[toggleDisplay.arguments[i]] != 'undefined')
        toggledDisplay[toggleDisplay.arguments[i]] = !bDisplayed;
    }
  }
}


function toggleSCCClass(className)
{
  if(!document.getElementById || toggleSCCClass.arguments.length < 2) return;
  for(var i = 1; i < toggleSCCClass.arguments.length; i++)
  {
    oDisplay = document.getElementById(toggleSCCClass.arguments[i]);
    if(oDisplay)
    {
      oDisplay.className = className;
    }
  }
}

//	toggles visibility of a div (or any other element) based on id only
//	safe to put inside href attribute
function toggle_div(id)
{
	var div = document.getElementById(id);
	if (div.style.display == 'none')
		div.style.display = 'block';
	else
		div.style.display = 'none';
	//	stops IE onClick event
	if("undefined" != typeof(event) )event.returnValue = false; 
	return false;
}
// This is our email obfuscation script
// Here is an example of what you would put in place of your "mailto" link:
//
//	Spamtastic ('sdrace', 'Email', 'Contact%20Us')
//
// For images, use Spimtastic and you will need to close the A tag manually
function Spamtastic (username, linktext, subject)
{
	var hostname = "allbusiness.com";
	document.write("<a href=\"" + "mail" + "to:" + username + "@" + hostname + "?subject=" + subject + "\">" + linktext + "</a>");
}

function Spimtastic	(username, subject)
{
	var hostname = "allbusiness.com";
	document.write("<a href=\"" + "mail" + "to:" + username + "@" + hostname + "?subject=" + subject + "\">");
}




function closePopupWindow(redirectURI)
{
	if (window.opener)
	{
		if (redirectURI != '')
			window.opener.location.href = redirectURI;
		window.opener.focus();
	}
	window.close();
}


function loadIFrameSrc(framename, framesrc)
{
	frames[framename].location.href = framesrc;
}

memetrics_variable='NULL';
memetrics_cpc_timeout = null;
memetrics_cpc = 0;

function cpcHover(varName,compId,isOver){
	memetrics_variable = varName;
	if(isOver){
		memetrics_cpc = compId;
		setTimeout('memetrics_cpc = 0;',2000);
	}
}
function cpcClick(varName,compId){
	recordOutcome(varName,compId);
}


/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2003-4 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

/*
  dw_lib.js - used with dw_glide.js, dw_glider.js, ...
  version date July 2004 
*/

dynObj.holder = {}; 
// constructor
function dynObj(id,x,y,w,h) {
  var el = dynObj.getElemRef(id);
  if (!el) return;  this.id = id; 
  dynObj.holder[this.id] = this; this.animString = "dynObj.holder." + this.id;
  var px = window.opera? 0: "px";
	this.x = x || 0;	if (x) el.style.left = this.x + px;
	this.y = y || 0;	if (y) el.style.top = this.y + px;
	this.w = w || el.offsetWidth || 0;	this.h = h || el.offsetHeight || 0;
	// if w/h passed, set style width/height
	if (w) el.style.width = w + px; if (h) el.style.height = h + px;
}

dynObj.getElemRef = function(id) { 
  var el = document.getElementById? document.getElementById(id): null;
  return el;
} 

dynObj.getInstance = function(id) {
  var obj = dynObj.holder[id];
  if (!obj) obj = new dynObj(id);
  else if (!obj.el) obj.el = dynObj.getElemRef(id);
  return obj;
}

dynObj.prototype.shiftTo = function(x,y) {
  var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
  if (el) {
    if (x != null) el.style.left = (this.x = x) + "px";
    if (y != null) el.style.top = (this.y = y) + "px";
  }
}

dynObj.prototype.shiftBy = function(x,y) { this.shiftTo(this.x+x, this.y+y); }

dynObj.prototype.show = function() { 
  var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
  if (el) el.style.visibility = "visible"; 
}
dynObj.prototype.hide = function() { 
  var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
  if (el) el.style.visibility = "hidden"; 
}


// for time-based animations
// resources: www.13thparallel.org and www.youngpup.net (accelimation)
var dw_Bezier = {
  B1: function (t) { return t*t*t },
  B2: function (t) { return 3*t*t*(1-t) },
  B3: function (t) { return 3*t*(1-t)*(1-t) },
  B4: function (t) { return (1-t)*(1-t)*(1-t) },
  // returns current value based on percentage of time passed
  getValue: function (percent,startVal,endVal,c1,c2) {
    return endVal * this.B1(percent) + c2 * this.B2(percent) + c1 * this.B3(percent) + startVal * this.B4(percent);
  }
}

// adapted from accelimation.js by Aaron Boodman of www.youngpup.net
dw_Animation = {
  instances: [],
  add: function(fp) {
    this.instances[this.instances.length] = fp;
  	if (this.instances.length == 1) this.timerID = window.setInterval("dw_Animation.control()", 10);
  },
  
  remove: function(fp) {
    for (var i = 0; this.instances[i]; i++) {
  		if (fp == this.instances[i]) {
  			this.instances = this.instances.slice(0,i).concat( this.instances.slice(i+1) );
  			break;
  		}
  	}
  	if (this.instances.length == 0) {
  		window.clearInterval(this.timerID);	this.timerID = null;
  	}
  },
  
  control: function() {
    for (var i = 0; this.instances[i]; i++) {
  		if (typeof this.instances[i] == "function" ) this.instances[i]();
      else eval(this.instances[i]);
    }
  }
}

function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}

function initGlide(glideDivId, xstart, ystart, xend, yend) {
  var winWd = getWinWidth();
  // arguments: id, x, y
  var glideLyr = new dynObj(glideDivId, xstart, ystart);
  glideLyr.show();
  // slideTo arguments: destination x, destination y, duration of slide,
  // acceleration/deceleration factor (can be -1 to 1) 0 is linear, i.e., steady slide
  glideLyr.slideTo(xend, yend, 1200, -.8); 
  _getGUIObjectInstanceById("searchboxfilter").style.display = "none"
}

function _getGUIObjectInstanceById(id) {
		var obj = -1;
		obj = ((document.getElementById) ? document.getElementById(id) : ((document.all) ? document.all[id] : ((document.layers) ? document.layers[id] : null)));
		return obj;
		}

function getWinWidth() {
	var winWd = 0;
	if (document.documentElement && document.documentElement.clientWidth) 
		winWd = document.documentElement.clientWidth;
	else if (document.body && document.body.clientWidth) 
		winWd = document.body.clientWidth;
	else if (document.body && document.body.offsetWidth) 
		winWd = document.body.offsetWidth; // ns6
	else if (window.innerWidth) winWd = window.innerWidth-18;
	return winWd;
}

/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2003-4 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

/*
  dw_glide.js - requires dw_lib.js
  version date July 2004 
*/

// acc is number between -1 and 1 ( -1 full decelerated, 1 full accelerated, 0 linear, i.e. no acceleration)
dynObj.prototype.slideTo = function (destX,destY,slideDur,acc,endFn) {
  if (!document.getElementById) return;
  this.slideDur = slideDur || .0001; var acc = -acc || 0;
  if (endFn) this.onSlideEnd = endFn;
  // hold destination values (check for movement on 1 axis only)
 	if (destX == null) this.destX = this.x;	else this.destX = destX;
  if (destY == null) this.destY = this.y; else this.destY = destY;
  this.startX = this.x; this.startY = this.y;
	this.st = new Date().getTime();
	// control points for bezier-controlled slide (see www.youngpup.net accelimation)
  this.xc1 = this.x + ( (1+acc) * (this.destX-this.x)/3 );
	this.xc2 = this.x + ( (2+acc) * (this.destX-this.x)/3 );
  this.yc1 = this.y + ( (1+acc) * (this.destY-this.y)/3 );
	this.yc2 = this.y + ( (2+acc) * (this.destY-this.y)/3 );
	this.sliding = true;
  this.onSlideStart();
  dw_Animation.add(this.animString + ".doSlide()");
}

dynObj.prototype.doSlide = function() {
	if (!this.sliding) return;	
	var elapsed = new Date().getTime() - this.st;
	if (elapsed < this.slideDur) {
    var x = dw_Bezier.getValue(elapsed/this.slideDur, this.startX, this.destX, this.xc1, this.xc2);
    var y = dw_Bezier.getValue(elapsed/this.slideDur, this.startY, this.destY, this.yc1, this.yc2);
		this.shiftTo( Math.round(x) ,Math.round(y) );
		this.onSlide();
	} else {	// if time's up
    dw_Animation.remove(this.animString + ".doSlide()");
		this.shiftTo(this.destX,this.destY);
		this.onSlide();
		this.sliding = false;
		this.onSlideEnd();
	}
}

dynObj.prototype.slideBy = function(dx,dy,slideDur,acc,endFn) {
	var destX=this.x+dx; var destY=this.y+dy;
	this.slideTo(destX,destY,slideDur,acc,endFn);
}

dynObj.prototype.onSlideStart = function () {}
dynObj.prototype.onSlide = function () {}
dynObj.prototype.onSlideEnd = function () { if (this.el) this.el = null; }



/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2003-4 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

matchColumns=function()
{ 
     var divs,contDivs_a,maxHeight_a,contDivs_b,maxHeight_b,divHeight,d; 
     // get all <div> elements in the document 
     divs=document.getElementsByTagName('div'); 

     contDivs_a=[]; 
     contDivs_b=[]; 

     // initialize maximum height value 
     maxHeight_a=0; 
     maxHeight_b=0; 

     // iterate over all <div> elements in the document 
     for(var i = 0; i < divs.length; i++){ 
			
          d=divs[i]; 
	 
          // make collection with <div> elements with class attribute 'container' 
			
          if(/\bleft_nav\b|\bcontent_2col\b|\bleft_nav_newindustry\b|\bthird_col_switcher_300\b|\bcontent_3col\b|\bthird_col\b/.test(d.className))
		  { 

                contDivs_a[contDivs_a.length]=d; 
				d.style.height = "";
                // determine height for <div> element 
                if(d.offsetHeight)
				{ 
                     divHeight=d.offsetHeight; 					
                } 
                else if(d.style.pixelHeight)
				{ 
                     divHeight=d.style.pixelHeight;					 
                } 
				
				if(divHeight==undefined){
					divHeight=0;
				}
                // calculate maximum height 
                maxHeight_a=Math.max(maxHeight_a,divHeight); 
          } 
          else if(/\bfaux_3col_left\b|\bfaux_3col_right\b|\bfaux_3col_right_home\b|\bfaux_3col_right_low\b/.test(d.className))
		  { 

                contDivs_b[contDivs_b.length]=d; 
				d.style.height = "";
                // determine height for <div> element 
                if(d.offsetHeight)
				{ 
                     divHeight=d.offsetHeight; 					
                } 
                else if(d.style.pixelHeight)
				{ 
                     divHeight=d.style.pixelHeight;					 
                } 
                
				if(divHeight==undefined){
					divHeight=0;
				}
                
                // calculate maximum height 
                maxHeight_b=Math.max(maxHeight_b,divHeight); 
          } 
     } 


	
	//if internal is taller than external, reassign external height;
		 
	if (maxHeight_b > maxHeight_a)
		maxHeight_a = maxHeight_b + 20;
	 
     // assign maximum height value to all of container <div> elements 
     for(var i=0;i<contDivs_a.length;i++)
	 { 
          contDivs_a[i].style.height=maxHeight_a + "px"; 
     } 
     for(var i=0;i<contDivs_b.length;i++)
	 { 
          contDivs_b[i].style.height=maxHeight_b + "px"; 
     } 
} 



// This function adjusts the size of the ad area to the ad content.
function adIframeBorderSizer(ifrmId, divId) 
{	
	var adHolder = document.getElementById(divId);
	adHolder.style.display = '';
	adHolder.style.backgroundColor = 'transparent';
	
	var adIframe = window.frames[ifrmId];
	var adIframeRef2 = document.getElementById(ifrmId);

	var adBox = adIframe.document.getElementById('adBox');
	var adHeight = adBox.offsetHeight;	// Set from expected resize of ad container
	var adWidth = adBox.offsetWidth;	// Set from expected resize of ad container
	var childMaxWidth = 0;
	var childMaxHeight = 0;

	// Scan all Iframe objects to get maximum width and height
	for (var i = 0; i < adBox.childNodes.length; i++)
	{

		// Scan Iframe to get maximum width
		childMaxWidth = getIframeInnerWidth(adBox.childNodes[i]);
		if (childMaxWidth > adWidth)
			adWidth = childMaxWidth;
						
		// Scan Iframe to get maximum height
		childMaxHeight = getIframeInnerHeight(adBox.childNodes[i]);
		if (childMaxHeight > adHeight)
			adHeight = childMaxHeight;
			
	}
	
	// Test for no ad or no visible ad.
	if	(adHeight < 10 || adWidth < 10)  
	{	
			adIframeRef2.style.height = 0 + 'px';
			adIframeRef2.style.width = 0 + 'px';
	}
	else
	{	
		//	We have a visible ad in the iframe, so shrink (or expand) the iframe to the ad's size.
		adIframeRef2.style.height = adHeight + 'px';
		adIframeRef2.style.width = adWidth + 'px';
	}
	/* 	NOTE-A:
		We have the string signature for the makings of a "tricky" eyeblaster ad.
		Since there's nothing *visible* in the iframe, minimize it, but don't "display=none" it
		so that the ad can crawl out of the iframe once we receive it.  
		When it does it will push the vertical height of the adholder to its height.
		Note, we need to minimize only because we could have the case where the iframe's intial 
		dimensions are greater than the ad's dimensions.  
		The end result is adholder (not adIframe) "shrinks (rather expands) to fit" around the ad.
	*/
} 

// This function, called exclusively by adIframeBorderSizer gets the width size of all objects in a DOM object.
function getIframeInnerWidth(innerNode)
{
	var maxWidth = 0;
	var childMaxWidth = 0;
		
	if (innerNode.width > maxWidth)
		maxWidth = innerNode.width;
	
	if (innerNode.offsetWidth > maxWidth)
		maxWidth = innerNode.offsetWidth;

	if (innerNode.childNodes.length > 0)
	{
		for (var i = 0; i < innerNode.childNodes.length; i++)
		{
			childMaxWidth = getIframeInnerWidth(innerNode.childNodes[i]);
			if (childMaxWidth > maxWidth)
				maxWidth = childMaxWidth;
		}		
	}
	
	return maxWidth;
}

// This function, called exclusively by adIframeBorderSizer gets the height size of all objects in a DOM object.
function getIframeInnerHeight(innerNode)
{
	var maxHeight = 0;
	var childmaxHeight = 0;
		
	if (innerNode.height > maxHeight)
		maxHeight = innerNode.height;
	
	if (innerNode.offsetHeight > maxHeight)
		maxHeight = innerNode.offsetHeight;

	if (innerNode.childNodes.length > 0)
	{
		for (var i = 0; i < innerNode.childNodes.length; i++)
		{
			childmaxHeight = getIframeInnerHeight(innerNode.childNodes[i]);
			if (childmaxHeight > maxHeight)
				maxHeight = childmaxHeight;
		}		
	}
	
	return maxHeight;	
}

/* #################################### */
/* Google custom adsense */
/* #################################### */
function google_ad_request_done(google_ads) 
{
	/*
	* This function is required and is used to display the ads that are returned 
	* from the JavaScript request. 
	*/
	var s = '';
	var i;
	var config = new Object();
	var newConfig = true;
	
	config.LISTTITLE = new Object();
	config.CONTAINER = new Object();
	config.TITLELINK = new Object();
	config.TITLE = new Object();
	config.DESCRIPTION = new Object();
	config.LINK = new Object();
	
	//* Verify that there are actually ads to display.
	if (google_ads.length == 0) {
		return;
	}

	// Make sure adNum is defined.  Backward compatibility w/older components
	if (typeof(google_adnum) == "undefined")
	{
		// google_adnum = 0;
		newConfig = false;
	}

	// Set default for the case of older component invocation
	config.CONTAINER.CLASS = "goog_two_ads";
	config.LISTTITLE.CLASS = "google_ads_by";
	config.TITLELINK.CLASS = "";
	config.TITLE.CLASS = "goog_title";
	config.DESCRIPTION.CLASS = "goog_desc";
	config.LINK.CLASS = "goog_url";
	config.adsByGoogleText = "Ads by Google";
	config.componentID = 0;
		
	// Set google ad information passed by components via JSon structure
	if (typeof(googleAdSense) != "undefined")
	{
		// Set entry configuration from JSon, set in new component invocation
		if (google_ads.length == 1)
		{
			config = googleAdSense.config[0];
		}
		else if (google_ads.length == 2)
		{
			config = googleAdSense.config[1];
		}
		else if (google_ads.length >= 3)
		{
			config = googleAdSense.config[2];
		}
		
		// Set google ad text, set in new component invocation
		if (typeof(googleAdSense.adsByGoogleText) != "undefined")
			config.adsByGoogleText =  googleAdSense.adsByGoogleText;
			
		// Set component id for tracking adNum for unique components in a request
		if (typeof(googleAdSense.componentID) != "undefined")
			config.componentID =  googleAdSense.componentID;
	}
	/*
	* If an image or flash ad is returned, display that ad.
	* Otherwise, build a string containing all of the ads and
	* then use a document.write() command to print that string.
	*/
	if (google_ads[0].type == "flash")
	{
		s += '<a href=\"' + google_info.feedback_url + '\" class="' + config.LISTTITLE.CLASS + '">' + config.adsByGoogleText + '</a><br>' +
		'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
		' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"' +
		' WIDTH="' + google_ad.image_width +
		'" HEIGHT="' + google_ad.image_height + '">' +
		'<PARAM NAME="movie" VALUE="' + google_ad.image_url + '">'
		'<PARAM NAME="quality" VALUE="high">'
		'<PARAM NAME="AllowScriptAccess" VALUE="never">'
		'<EMBED src="' + google_ad.image_url +
		'" WIDTH="' + google_ad.image_width +
		'" HEIGHT="' + google_ad.image_height +
		'" TYPE="application/x-shockwave-flash"' +
		' AllowScriptAccess="never" ' +
		' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
	
	} 
	else if (google_ads[0].type == "image") 
	{
		s += '<a href=\"' + google_info.feedback_url + '\" class="' + config.LISTTITLE.CLASS + '">' + config.adsByGoogleText + '</a><br>' +
		'<a href="' + google_ads[0].url +
		'" target="_top" title="go to ' + google_ads[0].visible_url +
		'"><img border="0" src="' + google_ads[0].image_url +
		'"width="' + google_ads[0].image_width +
		'"height="' + google_ads[0].image_height + '"></a>';
	
	} 
	else 	/* For text ads, append each ad to the string.*/
	{
		// Configure text ads based on our google ad component version.
		if (newConfig)
		{
			s += '<div><a href=\"' + google_info.feedback_url + '\" class="' + config.LISTTITLE.CLASS + '" style="' + config.LISTTITLE.STYLE + '">' + config.adsByGoogleText + '</a></div>';	
			for(i = 0; i < google_ads.length; ++i)  
			{			
				s += '<div class="' + config.CONTAINER.CLASS + '" style="' + config.CONTAINER.STYLE + '"><br><a href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true" ' + 
				'class="' + config.TITLELINK.CLASS + '" style="' + config.TITLELINK.STYLE + '">' +
				'<span class="' + config.TITLE.CLASS + '" style="' + config.TITLE.STYLE + '">' + google_ads[i].line1 + '<br></span></a>' +
				'<span class="' + config.DESCRIPTION.CLASS + '" style="' + config.DESCRIPTION.STYLE + '">' +
				google_ads[i].line2 + '&nbsp;' +
				google_ads[i].line3 + '<br></span><span><a class="' + config.LINK.CLASS + '" style="' + config.LINK.STYLE + '" href="'+
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' + 
				google_ads[i].visible_url + '</span></a><br></div>';
			}
			if (google_ads[0].bidtype == "CPC")
			{
				// Update adNum by how many text ads were displayed
				google_adnum = google_adnum + google_ads.length;
				
				// Update adNum count for registered component
				if (typeof(adComponentRegistry) != "undefined")
				{	
					for (var i=0; i<adComponentRegistry.length; i++)
					{
						if (adComponentRegistry[i].id == googleAdSense.componentID)
						{
							adComponentRegistry[i].adNum = google_adnum;
							break;
						}
					}
				}
			} // CPC
		}
		else
		{
			// old stuff
			if (google_ads.length == 1)
			{
				/*
				* Partners should adjust text sizes
				* so ads occupy the majority of ad space.
				*/
				s += '<div class="goog_one_ad"><div><a href=\"' + 
				google_info.feedback_url + '\" class="google_ads_by">Ads by Google</a></div><a href="' +
				google_ads[0].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[0].visible_url + '\';return true" ' +
				' style="text-decoration: none;">' +
				'<span class="goog_title">' + google_ads[0].line1 + '</a><br></span>' +
				'<span class="goog_desc">' +
				google_ads[0].line2 + '&nbsp;' +
				google_ads[0].line3 + '<br></span><span><a class="goog_url" href="'+
				google_ads[0].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[0].visible_url + '\';return true">' + 
				google_ads[0].visible_url + '</span></a></div><br>';
			} 
			else if (google_ads.length == 2)
			{
				s += '<div><a href=\"' + google_info.feedback_url + '\" class="google_ads_by">Ads by Google</a></div>';
				for(i = 0; i < google_ads.length; ++i) 
				{	
					s += '<div class="goog_two_ads"><br><a href="' +
					google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
					google_ads[i].visible_url + '\';return true" ' +
					'class="bd_googad">' +
					'<span class="goog_title">' + google_ads[i].line1 + '</a><br></span>' +
					'<span class="goog_desc">' +
					google_ads[i].line2 + '&nbsp;' +
					google_ads[i].line3 + '<br></span><span><a class="goog_url" href="'+
					google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
					google_ads[i].visible_url + '\';return true">' + 
					google_ads[i].visible_url + '</span></a><br></div>';
				}
			}
			else if (google_ads.length > 2)
			{
				s += '<div><a href=\"' + google_info.feedback_url + '\" class="google_ads_by">Ads by Google</a></div>';
				for(i = 0; i < google_ads.length; ++i) 
				{	
					s += '<br><a href="' +
					google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
					google_ads[i].visible_url + '\';return true" class="bd_googad">' +
					'<span class="goog_title">' + google_ads[i].line1 + '</a><br></span>' +
					'<span class="goog_desc">' +
					google_ads[i].line2 + '&nbsp;' +
					google_ads[i].line3 + '<br></span><span><a class="goog_url" href="'+
					google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
					google_ads[i].visible_url + '\';return true">' + 
					google_ads[i].visible_url + '</span></a><br>';
				}
			}	
		}
	} //text ads
	
	document.write(s);
	return;
}



/* #################################### */
/* Google AFS - Adsense search function */
/* #################################### */
/*
* This function retrieves the search query from the URL.
*/

function GetParam(name)
{
		var match = new RegExp(name + "=(.+)[&]","i").exec(location.search);
		if (match==null)
		{
				match = new RegExp(name + "=(.+)","i").exec(location.search);
		}

		if (match==null)
		{
				return null;
		}

		match = match + "";
		result = match.split(",");
		try {	
			var resultString=result[1];
			var resultArr=resultString.split("&");
			resultString=resultArr[0];
			return resultString;
		}
		catch(err)
		{
			return null;
		}
		
}


/*
 * This function is required. It processes the google_ads JavaScript object,
 * which contains AFS ads relevant to the user's search query. The name of
 * this function <i>must</i> be <b>google_afs_request_done</b>. If this
 * function is not named correctly, your page will not display AFS ads.
 */

function google_afs_request_done(google_ads)
{
		/*
		 * Verify that there are actually ads to display.
		 */
		var google_num_ads = google_ads.length;
		if (google_num_ads <= 0)
		{
				return;
		}

		var wideAds = "";   // wide ad unit html text
		var narrowAds = "";   // narrow ad unit html text

		for(i = 0; i < google_num_ads; i++)
		{
				if (google_ads[i].type=="text/wide")
				{
						// render a wide ad
						wideAds+='<a href="' +
										google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
										google_ads[i].visible_url + '\';return true" class="bd_googad" style="text-decoration: none;">' +
										'<span class="goog_title">' + google_ads[i].line1 + '</span></a><br>' +
										'<span class="goog_desc">' + google_ads[i].line2 + '</span><br><div><a class="goog_url" href="'+
										google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
										google_ads[i].visible_url + '\';return true">' + 
										google_ads[i].visible_url + '</a></div><br />';
				}

				else
				{
						// render a narrow ad
						narrowAds+='<a href="' +
										google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
										google_ads[i].visible_url + '\';return true" class="bd_googad" style="text-decoration: none;">' +
										'<span class="goog_title">' + google_ads[i].line1 + '</span></a><br>' +
										'<span class="goog_desc">' + google_ads[i].line2 + '</span><br>' +
										'<span class="goog_desc">' + google_ads[i].line3 + '</span><br><div><a class="goog_url" href="'+
										google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
										google_ads[i].visible_url + '\';return true">' + 
										google_ads[i].visible_url + '</a></div><br />';
				}
		}

		if (narrowAds != "")
		{
				narrowAds = '<div><a class="google_ads_by" ' +
										'href="http://services.google.com/feedback/online_hws_feedback">' +
										'Ads by Google</a></div><br />' + narrowAds;
		}

		if (wideAds != "")
		{
				wideAds = '<div><a class="google_ads_by" ' +
									'href="http://services.google.com/feedback/online_hws_feedback">' +
									'Ads by Google</a></div><br />' + wideAds;
		}

		// Write HTML for wide and narrow ads to the proper <div> elements. // Jerry 1/28/2008: added tests for elements.
		if	(document.getElementById("wide_ad_unit"))
		{	document.getElementById("wide_ad_unit").innerHTML = wideAds;  }
		if	(document.getElementById("narrow_ad_unit"))
		{	document.getElementById("narrow_ad_unit").innerHTML = narrowAds;  }
}



// === === ===   === === ===   === === ===   === === ===  === === ===   === === ===
// CODE RELATED TO FLOATING INTERSTITIAL AD PROJECT

	function removeDomNode(id)
	{	
		try 
		{
		var domNode = document.getElementById(id);
		domNode.parentNode.removeChild(domNode);
	}
		catch(e)
		{	/* do nothing */  }
	}
	
	function floatingInterstitialAdHandler(adDisplayAfter,adCookieExpire,otherConditionsGoodFlag,objectId)
	{  
		// PARAMS INFO  --- --- ---   --- --- ---   --- --- ---
		// * adDisplayAfter (number) -- Number of page requests before showing ad.  From #request.site.adDisplayAfter#
		// * adCookieExpire (hours) -- Days or fraction of to expire.  From #request.site.adCookieExpire#
		// * otherConditionsGoodFlag -- True/false flag of some of other iia conditions.  From #request.iia.otherConditionsGoodFlag#
		// * objectId -- Say an articleID.  From #request.object.id#
		
		// CONSTRUCTOR --- --- ---   --- --- ---   --- --- ---
		this.adDisplayAfter = adDisplayAfter || '';
		this.adCookieExpire = adCookieExpire || '';
		this.objectId = objectId || '';
		if ( otherConditionsGoodFlag == false )
		{	this.otherConditionsGoodFlag = 'false_';  }
		else
		{	this.otherConditionsGoodFlag = otherConditionsGoodFlag || '';  }
		
		if ( ! (this.adDisplayAfter == '' || this.adCookieExpire == '' || this.otherConditionsGoodFlag == '' || this.objectId == '') )
		{
			this.validInputsFlag = true;
			this.adDisplayAfter = (-1 * adDisplayAfter) + '';  		// Make it negative so it can be increment up to 0 - the trigger value.
			if ( otherConditionsGoodFlag == 'false_' )
			{	this.otherConditionsGoodFlag = false;  }	
			this.cookieHandler = new cookieHandler();   			// Instanciate cookieHandler.
																	// ...Possibly instanciating prevents Firefox issues.												
		}
		else
		{	this.validInputsFlag = false;  }
		
		//alert('booo2 ' + ' ' + adDisplayAfter + ' ' + adCookieExpire + ' ' + otherConditionsGoodFlag + ' ' + objectId + ' ' + this.validInputsFlag);  // Useful for debugging.
		
		
		// METHODS (only one) --- --- ---   --- --- ---   --- --- ---
		this.requestAdCreation = function() // A Method.
		{	
			if (this.validInputsFlag == true)  // If we had valid inputs and TRUE for other conditions for ad other than cookie value, then we may proceed.
			{
				// Set cookie expiration period in unit of days.
				var adCookieExpireInDays = this.adCookieExpire / 24  // Again this.adCookieExpire is in hours.
					
				// Read Cookie ... Set local value.
				var cookieVal = this.cookieHandler.readCookie('IIA');
	
				if ( typeof cookieVal == 'undefined' || cookieVal == null ) // Handling if IIA cookie value is undefined/null
				{	
					cookieVal = this.adDisplayAfter;  
				}
				// else ... cookieVal was ok so do nothing.
				
				cookieVal += '';  // convert to string - for regex below and for consistency
				//alert('booo cookieVal b4 regex ' + cookieVal + ' ' + this.adDisplayAfter);  // Useful for debugging.
	
				// Replace url encoding for negative sign (if any)...
				// ...in returned value to actual negative sign.	
				var regexToFind = '%2D';  // URL encoded code for negative sign.
				var replaceWithSubstring = '-';
				var objRegExp = new RegExp(regexToFind, 'g');
				cookieVal = cookieVal.replace(objRegExp, replaceWithSubstring); 			
		
				// Act on Cookie value.
				if (cookieVal < 0)  // Less than 0 case.   We just increment cookie value.
				{
					cookieVal ++; // Increment value for cookie by 1.
					this.cookieHandler.createCookie('IIA',cookieVal,adCookieExpireInDays); // Write cookie with new value.
				}		
				else if (cookieVal == 0)  // Equals 0 case.  We create ad on 0.
				{
					if  ( this.otherConditionsGoodFlag == true  &&  testForFinalPageElement() ) 
					{
						cookieVal ++; 
						this.cookieHandler.createCookie('IIA',cookieVal,adCookieExpireInDays); 
						floatingInterstitialAdMaker(this.objectId); // Create the floating interstitial ad  
					}
				}
				// else ... Greater than 0 case.  Ad should have already been viewed so do nothing.
					
			} // END: if (this.validInputsFlag...)
		} // END: function requestAdCreation()
	} // END: function floatingInterstitialAdHandler(...)
	
	
	
	function floatingInterstitialAdMaker(objectId)
	{	
		if ( ! ( typeof objectId == 'undefined' || objectId == '' ) ) // This was a test if we have sound input.
		{
			try
			{
				var myBody = document.getElementsByTagName("body")[0];
				var newDiv = document.createElement('div');
				
				newDiv.id = 'pageFloatingIframeHolder';
				newDiv.name = 'pageFloatingIframeHolder';
				myBody.appendChild(newDiv);
				
				if (typeof document.height != "undefined")
				{	
					var browser = 'Firefox';
					var desiredWidth = document.width + 'px'; 
					if ( window.innerHeight > document.height)
					{	
						var desiredHeight = window.innerHeight + 'px'; 
						var scrollingVal = 'no'; 
					}
					else
					{	
						var desiredHeight = document.height + 'px';  
						var scrollingVal = 'no'; 
					}
				}
				else
				{
					var browser = 'IE';
					var desiredWidth = myBody.offsetWidth + 'px'; 
					var desiredHeight = myBody.offsetHeight + 'px'; 
					var scrollingVal = 'no'; 	
				}
		
				var string = '<iframe id="pagefloatingIframe" name="pagefloatingIframe" src="/utilpages/interstitialAd.cfm?id='+objectId+'&isfloatinginterstitialad=on" frameborder="0" scrolling="'+scrollingVal+'" marginheight="0" marginwidth="0" style="position:absolute; top:0px; left:0px; width:'+desiredWidth+'; height:'+desiredHeight+';"  onload="floatingIframeResizer(\'pagefloatingIframe\', \'pageFloatingIframeHolder\');" ></iframe>';
			
				newDiv.innerHTML = string;
		
				newDiv.style.position = 'absolute';
				newDiv.style.top = 0;
				newDiv.style.left = 0;
				newDiv.style.width = desiredWidth;
				newDiv.style.height = desiredHeight;
				newDiv.style.zIndex = 999999999;
			}
			catch(e)
			{	/* Do nothing */ }

		} // END: if ( ! ( typeof objectId == 'und...
	} // END: function floatingInterstitialAdMaker(...)
	
	
	function floatingIframeResizer(ifrmId, divId) 
	{	
		var holder = document.getElementById(divId);
		holder.style.display = '';
		holder.style.backgroundColor = 'transparent';
		
		var ifrm = window.frames[ifrmId];
		var bodyHeight = ifrm.document.body.scrollHeight;
		var bodyWidth = ifrm.document.body.scrollWidth;
		
		if (holder.offsetHeight < bodyHeight)
		{	document.getElementById(ifrmId).style.height = bodyHeight + 'px'; }
		if (holder.offsetWidth < bodyWidth)
		{	document.getElementById(ifrmId).style.width = bodyWidth + 'px'; }
	} 
	
	function testForFinalPageElement()
	{
		if (document.getElementById('finalPageElement'))
		{	return true;  }
		else
		{	return false;  }
	} 
	
// *END* CODE RELATED TO FLOATING INTERSTITIAL AD PROJECT

//	clickFncsHandler(eventt) should be put a highlevel tag to handle bubble up events 
//	...and handle them per the functions specified in the target tags (forEventTyp)fnc attribute.
//	...A good application of this function is to delegate up to some highlevel tag a click handler
//	...that runs ab_click(...).
function eventFncsHandler(eventt, forEventType)
{  	
	var eventt = eventt;
	var	forEventType = forEventType;
	var	target = '';
	var fncs = '';
	var	fncString = '';
	var fncsArr = '';
	var fncsArrLen = '';
	var idx = '';
	
	if	(eventt.type == forEventType)
	{
		var target = eventt.target || eventt.srcElement;
		var fncs = target.getAttribute(forEventType+'fncs');
		
		if	(fncs)
		{
			fncsArr = fncs.split(';');
			fncsArrLen = fncsArr.length;
			idx = 0;
			for	(idx; idx < fncsArrLen; idx++)
			{
				fncString = fncsArr[idx];
				fncStringWithTry = 'try {' + fncString + '} catch (e) {}'
				eval(fncString);
			}
		}	
	}	
}

function getHTTML () {
	var xmlhttp=false;

	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}
	
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest) {
		try {
		xmlhttp = window.createRequest();
		} catch (e) {
		xmlhttp=false;
		}
	}
	
	if (!xmlhttp) {
		alert("Your browsers current version, or its security settings,\ncurrently do not allow you to use this feature of the site.");
	}
	
	return xmlhttp;	
}

function getBDC (URL) {
	var xmlhttp = getHTTML();
	try {
		xmlhttp.open("GET", URL, false);
		try{
			xmlhttp.setRequestHeader( "Content-type", "application/x-www-form-urlencoded");
			
			try{ //Added for ie6 compatibility
				xmlhttp.setRequestHeader( "Cookie", document.cookie );
				xmlhttp.send(null);
				return xmlhttp.responseXML;
			
			}	catch (e) {
				xmlhttp.send(null);
				return xmlhttp.responseXML;
			}
			
		} catch (e) {
			return e;
		}
	} catch(e) {
		return e;
	}
}

function getBDCvalue(result, name){
	try {
		return result.getElementsByTagName(name)[0].childNodes[0].nodeValue;
	} catch (e) {
		return ""
	}
}


//
//	SBTV functions
//	needed to enable SBTV Companion Ads
//
var bDartBannerLoaded = false;

function showDartBanner() {
    try {
        var objDartBanner = getSBTVCompanionRef();
        var objCompanion = document.getElementById('adHolder_CompanionBanner');
        objCompanion.style.display = 'none';
        if (!bDartBannerLoaded) {
            loadSBTVCompanionOrgDart();
            bDartBannerLoaded = true;
        }
        objDartBanner.style.display = 'block';
    }
    catch (errShowDartBanner) {
    }
}

function showCompanionBanner(banner_url, urlOnClick, is_image) {
    var objDartBanner = getSBTVCompanionRef();
    var objCompanion = document.getElementById('adHolder_CompanionBanner');

    var crlf = '<br />';
    var sAlert = 'showCompanionBanner( ' + crlf
    + ">" + banner_url + "< " + crlf
    + ",'" + urlOnClick + "' " + crlf
    + "," + is_image + crlf
    + ' )' + crlf
    + crlf
    + 'objCompanion >' + objCompanion + '<' + crlf;

    var sDiagHtml = '<div'
    + ' style="'
    + 'width:300px;'
    + 'height:250px;'
    + 'background-color:Fuchsia;'
    + 'font: normal 16px arial;'
    + 'color: White;'
    + '"'
    + '>'
    + 'Diagnostic<br />HTML'
    + sAlert
    + '</div>';

    var sHtml = '';
    objDartBanner.style.display = 'none';

    var sOnClick = ' onclick="NewWindow('
        + "'"
        + urlOnClick
        + "'"
        + ')"' + "\n";

    if (is_image) {
        sHtml = '<img'
        + ' style="'
        + 'width:300px;'
        + 'height:250px;'
        + '"'
        + ' src=' + banner_url + ''
        + sOnClick
        + ' />';
        }
    else {
        sHtml = '<iframe'
        + ' src="' + banner_url + '"'
        + ' frameborder="0"'
        + ' scrolling="no"'
        + ' style="'
        + 'width: 300px;'
        + 'height: 250px;'
        + 'border: none;'
        + '"'
        + '>'
        + '</iframe>';
    }
    objCompanion.innerHTML = sHtml;
    objCompanion.style.display = 'block';
}

function NewWindow(new_url) {
    pausePlayer();
    window.open(new_url);
}

function pausePlayer() {
    try
    {
        var objFlashPlayer = null;
        var sMovieName = 'http://h/FlashPlayer/Ldr.swf';
        if (navigator.appName.indexOf("Microsoft") != -1) {
            objFlashPlayer = window[sMovieName]
        } else {
            objFlashPlayer = document[sMovieName]
        }
        if (objFlashPlayer != null) {
            objFlashPlayer.pause();
        }
    }
    catch( errPausePlayer )
    {
    }
}

var loadSBTVCompanionOrgDart_count = 0;
var SBTVOrgHTML = '';
function loadSBTVCompanionOrgDart()
{
    if (loadSBTVCompanionOrgDart_count != 0) 
        return;
	loadSBTVCompanionOrgDart_count++;
	var obj = getSBTVCompanionRef();
	var orgHTML = SBTVOrgHTML;
	if (null == obj)
		return;
	if (orgHTML.length == 0)
		return;
	obj.innerHTML = orgHTML;
	return 1;
}
var setCompanionBanner_count = 0;
function setCompanionBanner(url) {
    if (setCompanionBanner_count != 0)
        return 1;
    setCompanionBanner_count++;
    var objDartBanner = getSBTVCompanionRef();
    var objCompanion = document.getElementById('adHolder_CompanionBanner');
    objCompanion.innerHTML = '<iframe'
    + ' src=' + url + ''
    + ' frameborder="0"'
    + ' scrolling="no"'
    + ' style="'
    + 'width: 300px;'
    + 'height: 250px;'
    + 'border: none;'
    + '"'
    + '>'
    + '</iframe>';
    objCompanion.style.display = 'block';
    return 1;
}

function restoreDartBanner() {
    if (setCompanionBanner_count != 0)
	{
	    var objCompanion = document.getElementById('adHolder_CompanionBanner');
	    objCompanion.style.display = 'none';
	    objCompanion.innerHTML = '';
	}
    loadSBTVCompanionOrgDart();
}
function displayCompanionBanners(banners, tracking) {
    var objDartBanner = getSBTVCompanionRef();
    var objCompanion = document.getElementById('adHolder_CompanionBanner');
    objDartBanner.style.display = 'none';
    objCompanion.style.display = 'block';
    tmDisplayBanner(banners, 'adHolder_CompanionBanner', 300, 250, null, tracking);
}
function hideCompanionBanners(banners) {
    tmHideBanner('adHolder_CompanionBanner');
    showDartBanner();    
}
var lastBannerVideoUid="";function tmDisplayBanner(banners,divName,width,height,defaultSize,tracking){if(!defaultSize)defaultSize="300x250";var size=width+'x'+height;var adDiv=document.getElementById(divName);if(banners.constructor.toString().indexOf("Array")==-1){var tempArray=[];for(var key in banners){if(key==="tracking"){tracking=banners["tracking"];}
else{tempArray.push(banners[key]);}}
banners=tempArray;}
var newBanners=new Array();for(var i=0;i<banners.length;i++){if(banners[i].type!=null&&banners[i].type=="google"){tmHideBanner("adCompanionBanner"+size);}else{tmHideBanner("googleCompanionBanner"+size);if(banners[i].type){var newBanner=null;for(var j=0;j<newBanners.length;j++){if(newBanners[j].size==banners[i].size){newBanner=newBanners[j];break;}}
if(newBanner==null){newBanner=new Object();newBanner.size=banners[i].size;newBanner.width=banners[i].width;newBanner.height=banners[i].height;newBanner.guid=banners[i].guid;newBanners[newBanners.length]=newBanner;}
if(banners[i].type=="image"){newBanner.imageUrl=banners[i].imageUrl?banners[i].imageUrl:banners[i].url;newBanner.clickUrl=banners[i].clickUrl;}else if(banners[i].type=="iframe"){newBanner.htmlUrl=banners[i].htmlUrl?banners[i].htmlUrl:banners[i].url;}else if(banners[i].type=="swf"){newBanner.swfUrl=banners[i].swfUrl?banners[i].swfUrl:banners[i].url;}else if(banners[i].type=="htmlSource"||banners[i].type=="html"){newBanner.htmlSource=banners[i].source;}}else{tmDisplaySingleBanner(banners[i],adDiv,width,height,size,defaultSize,tracking);}}}
if(newBanners.length>0){for(var i=0;i<newBanners.length;i++){tmDisplaySingleBanner(newBanners[i],adDiv,width,height,size,defaultSize,tracking);}}}
function tmDisplaySingleBanner(banner,adDiv,width,height,size,defaultSize,tracking){var bannerSize=banner.size?banner.size:banner._size;var bannerDisplayed=false;if((bannerSize==null)||(bannerSize=="undefinedxundefined")||(bannerSize=="NaNxNaN")||(bannerSize=="_default")){bannerSize=defaultSize;}
if(bannerSize==size){adDiv.innerHTML="";var htmlUrl=banner.htmlUrl?banner.htmlUrl:banner._htmlUrl;var htmlSource=banner.htmlSource?banner.htmlSource:banner._htmlSource;var swfUrl=banner.swfUrl?banner.swfUrl:banner._swfUrl;var imageUrl=banner.imageUrl?banner.imageUrl:banner._imageUrl;var clickUrl=banner.clickUrl?banner.clickUrl:banner._clickUrl;if(htmlSource){var div=document.createElement("div");div.innerHTML=htmlSource;adDiv.appendChild(div);bannerDisplayed=true;}else if(htmlUrl){var iframe=document.createElement("iframe");iframe.style.width=width+"px";iframe.style.height=height+"px";iframe.style.border="0";iframe.scrolling="no";iframe.marginWidth="0";iframe.marginHeight="0";iframe.frameBorder="no";adDiv.appendChild(iframe);var new_iframes=adDiv.getElementsByTagName("iframe");if(new_iframes.length==1){var new_iframe=new_iframes[0];new_iframe.src=htmlUrl;new_iframe.frameborder="no";bannerDisplayed=true;}}else if(swfUrl){var objHtml='<object';objHtml+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'" id="acudeo_swf">';objHtml+='<param name="movie" value="'+swfUrl+'" />';objHtml+='<param name="quality" value="high" />';objHtml+='<param name="wmode" value="transparent" />';objHtml+='<param name="allowfullscreen" value="true" />';objHtml+='<param name="allowscriptaccess" value="always" />';objHtml+='<!--[if !IE]>-->';objHtml+='<object type="application/x-shockwave-flash" data="'+swfUrl+'" width="'+width+'" height="'+height+'" id="acudeo_swf">';objHtml+='<param name="quality" value="high" />';objHtml+='<param name="wmode" value="transparent" />';objHtml+='<param name="allowfullscreen" value="true" />';objHtml+='<param name="allowscriptaccess" value="always" />';objHtml+='<!--<![endif]-->';objHtml+='<a href="http://www.adobe.com/go/getflashplayer">';objHtml+='<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />';objHtml+='</a>';objHtml+='<!--[if !IE]>-->';objHtml+='</object>';objHtml+='<!--<![endif]-->';objHtml+='</object>';var span=document.createElement("span");if(navigator.appName.indexOf("Microsoft")!=-1){adDiv.appendChild(span);var new_spans=adDiv.getElementsByTagName("span");if(new_spans.length==1){var span=new_spans[0];span.outerHTML=objHtml;}}else{span.innerHTML=objHtml;adDiv.appendChild(span);}
bannerDisplayed=true;}else if(imageUrl){var a=document.createElement("a");a.setAttribute("href",clickUrl);a.setAttribute("target","_blank");a.setAttribute("id",banner.guid);if(tracking){if(tracking.clickTrackUrl){a.onclick=function(){new Image().src=tracking.clickTrackUrl;return true;}}else if(acudeoComponents&&tracking.playerIndex>=0){a.onclick=function(banner){var banner={guid:this.id};acudeoComponents[tracking.playerIndex].tmSendEvent("bannerClick",{banner:banner});return true;}}}
var img=document.createElement("img");img.setAttribute("src",imageUrl);img.setAttribute("border",0);img.setAttribute("width",width);img.setAttribute("height",height);a.appendChild(img);adDiv.appendChild(a);bannerDisplayed=true;}}
var dispatchBannerImpression=true;if(bannerDisplayed){adDiv.style.visibility="visible";if(tracking&&tracking.videoUid){if((lastBannerVideoUid!="")&&(tracking.videoUid==lastBannerVideoUid)){dispatchBannerImpression=false;}
lastBannerVideoUid=tracking.videoUid;}}
if(tracking&&bannerDisplayed&&dispatchBannerImpression){if(tracking.impressionUrls&&tracking.impressionUrls.length){for(var i=0;i<tracking.impressionUrls.length;i++){var img=new Image();img.onerror=function(){tmOnBannerImpLoadError(tracking.errorUrls);};img.src=tracking.impressionUrls[i];}}else if(acudeoComponents&&tracking.playerIndex>=0){acudeoComponents[tracking.playerIndex].tmSendEvent("bannerDisplayed",{banner:banner});}}}
function tmHideBanner(divId){var adDiv=document.getElementById(divId);if(adDiv!=null){adDiv.style.visibility="hidden";}}
function tmOnBannerImpLoadError(urls){for(var i=0;i<urls.length;i++){new Image().src=urls[i];}}
//
//	End of SBTV functions
//	needed to enable SBTV Companion Ads
//



