function replaceStringInIds(element, oldString, newString) {
	var id = element.getAttribute("id");
	if (id) {
		element.setAttribute("id", id.replace(oldString, newString));
	}
	for (var i = 0; i < element.childNodes.length; i++) {
		if (element.childNodes[i].nodeType == ELEMENT_NODE_TYPE) {
			replaceStringInIds(element.childNodes[i], oldString, newString);
		}
	}
}

function cnnConvertPNGs() {
	var browser = navigator.userAgent;
	if (browser.indexOf('MSIE 6') > -1) {
		var imgs = d.getElementsByTagName('img');
		for (i = 0; i < imgs.length; i++) {
			if (imgs[i].className == 'cnnPNGImage') {
				convertPNG(imgs[i]);
			}
		}
	}
}

function convertPNG(img) {
	if (navigator.userAgent.indexOf('MSIE 6') > -1 && img && img.className == 'cnnPNGImage') {
		img.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + img.src + ')';
		img.src = 'http:/\/i.cdn.turner.com/nascar/.element/img/2.0/global/util/pixel.gif';
	}
}

function isNull(value) {
	return !value || value == "null";
}

function convertNullToDefault(value, def) {
	if (isNull(value)) {
		return def ? def : "--";
	} else {
		return value;
	}
}

function newXHR() {
	var req = null;
    if (window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = null;
        }
    } else if (window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = null;
        	}
		}
    }
    return req;
}

function el(id) {
	return document.getElementById(id);
}