// sid - shader id
// tid - shader text id
function ShowShader(sid, tid, msg)
{
	var sha = document.getElementById(sid);
	var tex = document.getElementById(tid);
	if (sha) {
		sha.className = "shaderOn";
		tex.innerHTML = '<span>' + msg + '</span>';
	}
}

// sid - shader id
// tid - shader text id
function HideShader(sid, tid)
{
	var sha = document.getElementById(sid);
	var tex = document.getElementById(tid);
	if (sha) {
		sha.className = "shaderOff";
		tex.innerHTML = "&nbsp;";
	}
}

// sid - shader id
// tid - shader text id
function Show3Shader(sid, tid, msg) {
	var sha = document.getElementById(sid);
	var tex = document.getElementById(tid);
	if (sha) {
		sha.className = "shader3On";
		tex.innerHTML = '<span>' + msg + '</span>';
	}
}

// sid - shader id
// tid - shader text id
function Hide3Shader(sid, tid) {
	var sha = document.getElementById(sid);
	var tex = document.getElementById(tid);
	if (sha) {
		sha.className = "shader3Off";
		tex.innerHTML = "&nbsp;";
	}
}

// aid - adlinks container id
// sid - shader id
// cid - collapse container id
function ExpandAdLinks(aid, sid, cid)
{	
	//closes supplier links pop-up
	DisableVerticalSupplierLinksWithPublication()

	var ads = document.getElementById(aid);
	var sha = document.getElementById(sid);
	var col = document.getElementById(cid);
	if (ads) {
		sha.style.display = "none";
		ads.style.height = ads.scrollHeight + "px";
		col.style.display = "block";
		// This forces IE 7 to redraw the adlinks panel and position the 3 boxes below the adlinks to the correct position
		ads.parentNode.style.display = "none";
		ads.parentNode.style.display = "block"; 
	}
}

// aid - adlinks container id
// sid - shader id
// cid - collapse container id
// height - the height at which to collapse the container
function CollapseAdLinks(aid, sid, cid, height)
{
	//closes supplier links pop-up
	DisableVerticalSupplierLinksWithPublication()

	var ads = document.getElementById(aid);
	var sha = document.getElementById(sid);
	var col = document.getElementById(cid);
	if (ads) {
		ads.style.height = height + "px";
		sha.style.display = "block";
		col.style.display = "none";
		// This forces IE 7 to redraw the adlinks panel and position the 3 boxes below the adlinks to the correct position
		ads.parentNode.style.display = "none"; 
		ads.parentNode.style.display = "block";
	}
}

function EnableVerticalSupplierLinks(element)
{
	var lContainer = document.getElementById("verticalSupplierLinks");

	if (lContainer != null)
	{
		lContainer.style.top = findPosY(element) - 200 + 'px';
	
		SetSupplierDisplayStyle(lContainer,true);
	}
}

function EnableVerticalSupplierLinksWithPublication(element, code, hideFlashMap, wideContainer, offsetX, offsetY, showDropDownLists)
{
	var lHtmlChildrenElements;
	var lContainer = document.getElementById("verticalSupplierLinksGeneralContainer");
		
	if (hideFlashMap == true) {
		ShowCountryFlashMap(false);
	}
	
	if (lContainer != null) {
		if (offsetX != null)
			lContainer.style.left = (element.offsetLeft + 20) + offsetX + 'px';
		else
			lContainer.style.left = (element.offsetLeft + 20) + 'px';

		if (offsetY != null)
			lContainer.style.top = (element.offsetTop + 25) + offsetY + 'px';
		else
			lContainer.style.top = (element.offsetTop + 25) + 'px';

		if (wideContainer == true) {
			lContainer.style.width = '410px';
			if (offsetX == null) {
				lContainer.style.left = (element.offsetLeft) + 'px';
			}
		}
		else {
			lContainer.style.width = '201px';
		}
	
		SetSupplierDisplayStyle(lContainer,true);
		
		lHtmlChildrenElements = lContainer.childNodes;
	
		for (i = 0; i < lHtmlChildrenElements.length; i++)
		{
			if (lHtmlChildrenElements[i].id != null &&
			    lHtmlChildrenElements[i].id.indexOf ("verticalSupplierLinksSpecificContainer-") == 0)
			{
				if (lHtmlChildrenElements[i].id == ("verticalSupplierLinksSpecificContainer-" + code))
				{
					SetSupplierDisplayStyle(lHtmlChildrenElements[i], true);
				}
				else
				{
					SetSupplierDisplayStyle(lHtmlChildrenElements[i], false);
				}
			}
		}
		
		// Set the iframe
		var lIFrame = document.getElementById("SuppliersIFrame");
		lIFrame.style.width = lContainer.scrollWidth + "px";
		lIFrame.style.height = lContainer.scrollHeight + "px";
		lIFrame.style.top = lContainer.offsetTop + "px";
		lIFrame.style.left = lContainer.offsetLeft + "px";
		lIFrame.style.display = "block";
	}
}


function DisableVerticalSupplierLinks()
{
	var lContainer = document.getElementById("verticalSupplierLinks");
	if (lContainer != null)
	{
		SetSupplierDisplayStyle(lContainer,false);
	}
}

function DisableVerticalSupplierLinksWithPublication ()
{
	var lContainer = document.getElementById("verticalSupplierLinksGeneralContainer");
	if (lContainer != null)
	{
		SetSupplierDisplayStyle(lContainer,false);
		
		// Set the iframe
		var lIFrame = document.getElementById("SuppliersIFrame");
		lIFrame.style.display = "none";
	}

	ShowCountryFlashMap(true);
}

function SetSupplierDisplayStyle(container,display)
{
	if(display == true)
	{	
		container.style.display = "block";
	}
	else
	{
		container.style.display = "none";
	}	
}
