//These are used for show/hide all feature in faqs

function AlterAllDivs(displayStyle)
{
	InitializeGlobalData();

	if (null == allDivsInPage || typeof(allDivsInPage) == "undefined")
		return;
    
	if (typeof(allDivsInPage["divShowAll"]) != "undefined" &&
		typeof(allDivsInPage["divHideAll"]) != "undefined")
		{
		if (displayStyle == "block")
			{
			allDivsInPage["divShowAll"].style.display = "none";
			allDivsInPage["divHideAll"].style.display = "block";
			}
		else
			{
			allDivsInPage["divShowAll"].style.display = "block";
			allDivsInPage["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("p_")) 
			{
				var thePic = allImagesInPage[allDivsSpans[i].id + "_img"];

				if (displayStyle == "block")
				{
					allDivsSpans[i].style.display = "block";

					if (typeof(thePic) != "undefined" && null != thePic)
					{
						thePic.src = "/global/images/default.aspx?AssetID=ZA790050011033";
						thePic.alt = strHide;
					}
				}
				else
				{
					allDivsSpans[i].style.display = "none";

					if (typeof(thePic) != "undefined" && null != thePic)
					{
						thePic.src = "/global/images/default.aspx?AssetID=ZA790050001033";
						thePic.alt = strShow;
					}
				}
			}

			if (0 == allDivsSpans[i].id.indexOf("span_")) 
			{
				if (displayStyle == "block")
					allDivsSpans[i].style.display = "inline";
				else
					allDivsSpans[i].style.display = "none";
			}
		}
	}
}

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;

	allDivsInPage = new Array();
	for (i=0; i < countDiv; i++)
		if (typeof(divs[i].id) != "undefined" &&
			null != divs[i].id &&
			divs[i].id.length > 0)
			allDivsInPage[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)
			allDivsInPage[spans[i].id] = spans[i];

	allImagesInPage = document.body.getElementsByTagName("IMG");
}

function toggleMe(a){
      var e=document.getElementById(a);
      if(!e)return true;
      if(e.style.display=="none"){
        e.style.display="block"
      } else {
        e.style.display="none"
      }
      return true;
    }
  
  function subMenuShow(param) {
    oItem=getDivObj(param);
    oItem.style.display="block";

    var ua = navigator.userAgent.toLowerCase();
    this.ua = ua;

    // browser name
    this.isOpera     = (ua.indexOf("opera") != -1);
    var isSubMenu = false;
    if (!this.isOpera) {        
      c_param = 'c_'+ param;      
      p_param = 'p_' + param;
      oItem=getDivObj(c_param);
      if(!IsSubMenu(param))
      {
        oItem.className='top_menu_rollover';
      }      
    }
  }

  function subMenuHide(param, flag) {    
    getDivObj(param).style.display="none";
    
    var ua = navigator.userAgent.toLowerCase();
    this.ua = ua;

    // browser name
    this.isOpera     = (ua.indexOf("opera") != -1);

    if (!this.isOpera && flag != 1) {
      c_param = 'c_'+ param;
      oItem=getDivObj(c_param);      
      if(!IsSubMenu(param))
      {
          oItem.className='top_menu_inactive';
      }      
    }
  }
  
  function IsSubMenu(param)
  {
      var lastInd = param.lastIndexOf('_sub')
      
      if(lastInd == -1)
      {
           return false;
      }
      else
      {
           return true; 
      }      
  }
  
  function getDivObj(name) {
    obj=document.getElementById(name);
  
    return obj; 
  }  

function popUp(vrr) {
props=window.open(vrr, 'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=1250, height=900, left = 20, top = -10');
}

function popUpSm(vrr) {
props=window.open(vrr, 'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=0, width=400, height=200, left = 200, top = 200');
}

function popUpWindow(url, width, height)
{
 var x = window.open(url,'popUpWindow','toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=0, width=' + width + ',height=' + height);
 x.moveTo((screen.width-width)/2, (screen.height-height-100)/2);
 x.opener = self;
}