var _isEmbeded = false;
var _domain;
var _sub;
var _suprabarPath;
var _omniturePath;
var _jsPath;
var _swfPath

function embedSuprabar(pDomain, pSub, pWidth) {
	if( !_isEmbeded) {
		_domain = pDomain.charAt(pDomain.length-1) != '/' ? pDomain + '/' : pDomain;
		_sub = pSub;
		_suprabarPath = _domain +_sub + '/' + 'suprabar/';
		_jsPath = _suprabarPath + 'js/';
		_swfPath = _suprabarPath + 'swf/';
		_omniturePath = _domain+'js/';
		
		if (pWidth.indexOf('%') == -1 && pWidth.indexOf('px') == -1) pWidth += 'px';
		changeSuprabarWidth(pWidth);
		
		swfobject.embedSWF(_swfPath+'suprabar.swf', 'suprabar', '100%', '30px', '9.0.00', _swfPath+'expressinstall.swf', {}, {wmode:'transparent', allowscriptaccess: 'always'}, {});
		_isEmbeded = true;
	}
}


function include(pUrl)
{
	var head = window.document.getElementsByTagName('head')[0];
	var script = window.document.createElement('script');
	script.setAttribute('src', pUrl);
	script.setAttribute('type', 'text/javascript');
	head.appendChild(script);
}

function includeOmniture( pFileName) {
	include(_omniturePath + pFileName);
}


function changeSuprabarWidth(pWidth) {
	var oDivHeader = null;
	if (document.getElementById) {
		oDivHeader = document.getElementById('suprabarContainer');
	} else if (document.all) {
		oDivHeader = document.all['suprabarContainer'];
	}
	// var oDivVideo = document.getElementById("supra");
	if(oDivHeader){
		oDivHeader.style.width = pWidth;
		if (typeof document.body.style.maxWidth != "undefined") {
		  // IE 7, mozilla, safari, opera 9
		} else {
		  // IE6, older browsers
		  oDivEmbed = document.all['suprabarContainer'];
		  oDivEmbed.style.width = pWidth;
		}
	}
}


function changeSuprabarHeight(pHeight){
	var oDivHeader = null;
	if (document.getElementById) {
		oDivHeader = document.getElementById('suprabar');
	} else if (document.all) {
		oDivHeader = document.all['suprabar'];
	}
	// var oDivVideo = document.getElementById("supra");
	if(oDivHeader){
		oDivHeader.style.height = pHeight + "px";
		if (typeof document.body.style.maxHeight != "undefined") {
		  // IE 7, mozilla, safari, opera 9
		} else {
		  // IE6, older browsers
		  oDivEmbed = document.all['suprabar'];
		  oDivEmbed.style.height = pHeight + "px";
		}
	}
}