function findParentByTagName(startNode, tagName) {
	var node = startNode;
	tagName = tagName && tagName.toLowerCase ? tagName.toLowerCase() : null;
	if (node) {
		while (node.tagName && node.tagName.toLowerCase() !== tagName && node.parentNode) {
			node = node.parentNode;
		}
	}
	return (node.tagName && node.tagName.toLowerCase() === tagName) ? node : false;
}

function addClass(el, classname) {
	var re = new RegExp('( ?\\b' + classname + '\\b|$)');
	el.className = el.className ? el.className.replace(re, ' ' + classname) : classname;
	return el;
}

function removeClass(el, classname) {
	var re = new RegExp(' ?\\b' + classname + '\\b', '');
	el.className = el.className.replace(re, '');
	return el;
}

function initializeTopFeaturesTabs() {
	var topFeaturesTabs = document.getElementById('topFeaturesTabs');
	if (topFeaturesTabs) {
		var links = topFeaturesTabs.getElementsByTagName('a');
		for (var i = 0, link; link = links[i]; i++) {
			link.setAttribute('tabNumber', i);
			link.onclick = function() {
				var content = document.getElementById('topFeaturesContent');
				if (content) {
					var ul = findParentByTagName(this, 'ul');
					var links = ul.getElementsByTagName('a');
					for (var i = 0, link; link = links[i]; i++)
						removeClass(link, 'selected');
					addClass(this, 'selected');

					var divs = [];
					for (var i = 0, node; node = content.childNodes[i]; i++)
						if (node.nodeType === 1 && node.tagName.toLowerCase() === 'div')
							divs.push(node);
					for (var i = 0, div; div = divs[i]; i++)
						div.style.display = 'none';
					divs[this.getAttribute('tabNumber')].style.display = 'block';
				}
				return false;
			}
		}
		links[0].onclick();
	}
}

var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);function fixPNG(o){if((version>=5.5)&&(version<7)&&(document.body.filters)){var Q=(o.id)?"id='"+o.id+"' ":"";var h=(o.className)?"class='"+o.className+"' ":"";var d=(o.title)?"title='"+o.title+"' ":"title='"+o.alt+"' ";var B="display:inline-block;"+o.style.cssText;var t="<span "+Q+h+d+" style=\""+"width:"+o.width+"px; height:"+o.height+"px;"+B+";"+"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"+"(src='"+o.src+"', sizingMethod='scale');\"></span>";o.outerHTML=t;}}

function popUp( strURL, options ) {
var strOptions="scrollbars,resizable,height=500,width=720";
if(options) strOptions = options;
window.open(strURL, 'newWin', strOptions);
}
