// G L O B A L  V A R I A B L E S
var popupWin;
var strIsRtl = '';
var strShow = '';
var strHide = '';
var allDivs = null;
var allImages = null;
var fExpanded = false;

// F U N C T I O N S
function openWindow(url, example)
{	
  if (typeof(popupWin) != "object" || null == popupWin) 		
    popupWin = window.open(url, example, "width=452,height=572,top=0,left=0,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=1,copyhistory=0");	
  else {		
    if (!popupWin.closed) 			
      popupWin.location.href = url;		
    else 			
      popupWin = window.open(url, example, "width=452,height=572,top=0,left=0,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=1,copyhistory=0");
  }	  	

  popupWin.focus();
}

function SubmitForm( action, form )
{
  form.action = action; 
  form.submit();
}

function submitenter( myfield, e )
{
  var keycode;

  if (window.event) keycode = window.event.keyCode;
  else if (e) keycode = e.which;
  else return true;

  if (keycode == 13) {
    myfield.form.submit();
    return false;
  }
  else {
    return true;
  }
}

function ExpandDiv(theDivName)
{
	InitializeGlobalData();

	if (null == theDivName || typeof(theDivName) == "undefined") return; var theDiv = allDivs[theDivName]; if (null == theDiv || typeof(theDiv) == "undefined") return;
	theDiv.style.display = "block";

	var thePic = allImages[theDivName + "_img"];
	if (null != thePic && typeof(thePic) != "undefined")
	{
	  if( thePic.src.split( "/img/" )[1] == "plus.gif" ) {
	    thePic.src = "/img/collapseline_alt_plus.gif";
	  }
	  else {
	    thePic.src = "/img/collapseline.gif";
	  }

	  thePic.alt = strHide;
	}
}

function CollapseDiv(theDivName)
{
	InitializeGlobalData();

	if (null == theDivName || typeof(theDivName) == "undefined") return; var theDiv = allDivs[theDivName]; if (null == theDiv || typeof(theDiv) == "undefined") return;
	theDiv.style.display = "none";

	var thePic = allImages[theDivName + "_img"];
	if (null != thePic && typeof(thePic) != "undefined")
	{
	  if( thePic.src.split( "/img/" )[1] == "collapseline_alt_plus.gif" ) {
	    thePic.src = "/img/plus.gif";
	  }
	  else {
	    thePic.src = "/img/question_mark" + strIsRtl + ".gif";
	  }

	  thePic.alt = strShow;
	}
}

function ToggleDiv(theDivName)
{
	InitializeGlobalData();

	if (null == theDivName || typeof(theDivName) == "undefined") return; var theDiv = allDivs[theDivName]; if (null == theDiv || typeof(theDiv) == "undefined") return;

	if (theDiv.style.display.toUpperCase() != "BLOCK")
		ExpandDiv(theDivName);
	else
		CollapseDiv(theDivName);
}

function AlterAllDivs(displayStyle)
{
	InitializeGlobalData();

	if (null == allDivs || typeof(allDivs) == "undefined")
		return;

	if (typeof(allDivs["divShowAll"]) != "undefined" &&
		typeof(allDivs["divHideAll"]) != "undefined")
		{
		if (displayStyle == "block")
			{
			allDivs["divShowAll"].style.display = "none";
			allDivs["divHideAll"].style.display = "block";
			}
		else
			{
			
			
			
			
			allDivs["divShowAll"].style.display = "block";
			allDivs["divHideAll"].style.display = "none";
			}
		}

	AlterAllDivsSpans(document.body.getElementsByTagName("DIV"), displayStyle);
	AlterAllDivsSpans(document.body.getElementsByTagName("SPAN"), displayStyle);
}

function AlterAllDivsSpans(allDivsSpans, displayStyle)
{
	if (typeof(allDivsSpans) == "undefined" ||
		null == allDivsSpans)
		return;

	for (i=0; i < allDivsSpans.length; i++)
		if (typeof(allDivsSpans[i]) != "undefined" &&
			null != allDivsSpans[i] &&
			typeof(allDivsSpans[i].id) != "undefined" &&
			null != allDivsSpans[i].id &&
			allDivsSpans[i].id.length > 0)
			{
			if (0 == allDivsSpans[i].id.indexOf("divExpCollAsst_")) 
				{
				var thePic = allImages[allDivsSpans[i].id + "_img"];

				if (displayStyle == "block")
					{
					allDivsSpans[i].style.display = "block";

					if (typeof(thePic) != "undefined" && null != thePic)
						{
						thePic.src = "/img/collapseline.gif";
						thePic.alt = strHide;
						}
					}
				else
					{
					allDivsSpans[i].style.display = "none";

					if (typeof(thePic) != "undefined" && null != thePic)
						{
						thePic.src = "/img/question_mark" + strIsRtl + ".gif";
						thePic.alt = strShow;
						}
					}
				}

			if (0 == allDivsSpans[i].id.indexOf("divInlineDef_")) 
				if (displayStyle == "block")
					allDivsSpans[i].style.display = "inline";
				else
					allDivsSpans[i].style.display = "none";
			}
}

function ToggleAllDivs()
{
	InitializeGlobalData();

	if (fExpanded)
		AlterAllDivs("none");
	else
		AlterAllDivs("block");

	fExpanded = !fExpanded;
}

function ToggleAll()
{
	InitializeGlobalData();
	ToggleAllDivs();
}

function InitializeGlobalData()
{
	if ('undefined' != typeof(strRtl))
		strIsRtl = strRtl;

	var divs = document.body.getElementsByTagName("DIV");
	var spans = document.body.getElementsByTagName("SPAN");

	var countDiv = 0;
	var countSpan = 0;
	if (typeof(divs) != "undefined" && null != divs)
		countDiv = divs.length;

	if (typeof(spans) != "undefined" && null != spans)
		countSpan = spans.length;

	allDivs = new Array();
	for (i=0; i < countDiv; i++)
		if (typeof(divs[i].id) != "undefined" &&
			null != divs[i].id &&
			divs[i].id.length > 0)
			allDivs[divs[i].id] = divs[i];

	for (i=0; i < countSpan; i++)
		if (typeof(spans[i].id) != "undefined" &&
			null != spans[i].id &&
			spans[i].id.length > 0)
			allDivs[spans[i].id] = spans[i];

	allImages = document.body.getElementsByTagName("IMG");
}

function OnSeeAlsoClicked()
{
	InitializeGlobalData();

	if (null == allDivs || typeof(allDivs) == "undefined")
		return;

	if (typeof(allDivs["divSeeAlsoShowBullet"]) != "undefined" &&
		typeof(allDivs["divSeeAlsoHideBullet"]) != "undefined")
		{
		if (allDivs["divSeeAlsoShowBullet"].style.display.toUpperCase() == "INLINE")
			{
			allDivs["divSeeAlso"].style.display = "block";
			allDivs["divSeeAlsoShowBullet"].style.display = "none";
			allDivs["divSeeAlsoHideBullet"].style.display = "inline";
			}
		else
			{
			allDivs["divSeeAlso"].style.display = "none";
			allDivs["divSeeAlsoShowBullet"].style.display = "inline";
			allDivs["divSeeAlsoHideBullet"].style.display = "none";
			}
		}
}

function trackClick( trackingURL )
{
  new Image().src = trackingURL;
}

function hitURL( trackingURL )
{
  new Image().src = trackingURL;
}
