// JavaScript Document
//Copyright W3 Communcations Ltd 2008 to 2011


var OpenSection="";
function LeftMenuClickControl(objTarget){
	//alert("Left Menu Clicked");
	if(document.getElementById(objTarget).style.display=="none")
		{
		//alert("debug1");
		document.getElementById(objTarget).style.display="";
		}
	else if(document.getElementById(objTarget).style.display=="")
		{
		//alert("debug2");
		document.getElementById(objTarget).style.display="none";
		}
}
function OpenSubsection(objAnchor,objTarget){
	//alert("Opening section");	
//alert(OpenSection);
	//Close Currently open section
	//alert(document.getElementById(objAnchor).id);
	if(document.getElementById(OpenSection))
		{
		if(String(OpenSection) != String(objTarget))
			{
			//alert("Closing section"+OpenSection+":Opening section"+objTarget)
			document.getElementById(OpenSection).style.display="none";
			//alert("test3");
			OpenSection="";
			//document.getElementById(OpenSection).style.visibility="hidden";
			}
		}
	//Open New Section
	if(document.getElementById(objTarget))
		{
		//alert("test");
		document.getElementById(objTarget).style.display="";
		document.getElementById(objTarget).style.zIndex="99";
		//document.getElementById(objTarget).style.visibility="";
		OpenSection=String(objTarget);
		//alert("test2");
		}
}
function CloseSubsection(objTarget){
	//alert("closing section_"+OpenSection);
	if(objTarget=="" || typeof(objTarget) =='undefined')	
		{
		//alert(OpenSection);	
		if(document.getElementById(OpenSection))
			{
			document.getElementById(OpenSection).style.zIndex="0";
			document.getElementById(OpenSection).style.display="none";
			//OpenSection="";
			//document.getElementById(OpenSection).style.visibility="hidden";
			}
		}
	else
		{
		//alert(objTarget);
		if(document.getElementById(objTarget))
			{
			if(OpenSection != objTarget)
				document.getElementById(objTarget).style.zIndex="0";
				document.getElementById(objTarget).style.display="none";
				//OpenSection ="";
				//document.getElementById(objTarget).style.visibility="hidden";
			}	
		}
		
}
function SetCurrentSection(objTarget){
	//alert("setting section to:"+objTarget)
	OpenSection=objTarget;
	//alert("debug1"+OpenSection);
}
function ClearCurrentSection(objTarget){
	//OpenSection="";
	//alert("test"+objTarget);
	//setTimeout("CloseSubsection('"+objTarget+"')",2000);

}

function ChangeProductImage(strImageFilename,strTarget){
	//alert("ChangeProductImage")
	
	
	//alert(strImageFilename);
	//if(strImageFilename.lastIndexOf("/")>0)
	//	{
	//	alert(strImageFilename.lastIndexOf("/"));
	//	strImageFilename=strImageFilename.substr(strImageFilename.lastIndexOf("/")+1);
	//	}
	if(strImageFilename.lastIndexOf("\\")>0)
		{
		//alert(strImageFilename.lastIndexOf("\\"));
		strImageFilename=strImageFilename.substr(strImageFilename.lastIndexOf("\\")+1);
		}
	//alert(strImageFilename);	


	//alert(strTarget);
	try
		{
		if(strImageFilename != ""){ 	
		document.getElementById(strTarget).src = strImageFilename
		}
		}
	catch(e){
		 //alert('An error has occurred: '+e.message)
		}
	//alert("test");

}

/////------------------------------------------------------////////
/////Actinic menu control code -----------------///////////////////
/////------------------------------------------------------////////

function SectionList(ar)
{
var strIDs = '<table border=0 width=95% cols=2>';
for (var i=1;i<=ar.length;i++)
  {
  if (ar[i].sURL !=null)
    {
    strIDs += '<table><tr><td colspan=2><a href="' + ar[i].sURL + '"><span class="actxxsmall">' + ar[i].sName +  '</span></a></td></tr></table>';
      {
      if (ar[i].pChild)
        {
        for (var j=1;j<=ar[i].pChild.length;j++)
          {
strIDs += '<table><tr><td><img src=shim.gif width=5></td><td><a href="' + ar[i].pChild[j].sURL + '"><span class="actxxsmall">' + ar[i].pChild[j].sName + '</span></a></td></tr></table>';          

            {
            if (ar[i].pChild[j].pChild)
              {
              for (var k=1;k<=ar[i].pChild[j].pChild.length;k++)
                {

  strIDs += '<table><tr><td width="20"></td><td><a href="' + ar[i].pChild[j].pChild[k].sURL + '"><span class="actxxsmall">' + ar[i].pChild[j].pChild[k].sName + '</span></a></td></tr></table>';

                }
              }
            }
          }
        }
      }
    }
  }
strIDs += '</table>' 
return strIDs
}



function WriteThirdLevelLists(ar)
{
var strIDs = '';

for (var i=1;i<=ar.length;i++)
  {
  if (ar[i].sURL !=null)
    {
      {
      if (ar[i].pChild)
        {
        for (var j=1;j<=ar[i].pChild.length;j++)
          {
            {
            if (ar[i].pChild[j].pChild)
              {
              strIDs += '<div id=\"Section_'+ar[i].pChild[j].nSectionId+'\" style=padding-left:174px;"><div class=\"ThirdLevelSectionList\" onMouseover=\"SetCurrentSection(\'Section_'+ar[i].pChild[j].nSectionId+'\');\" onMouseout=\"ClearCurrentSection(\'Section_'+ar[i].pChild[j].nSectionId+'\');\">'
              for (var k=1;k<=ar[i].pChild[j].pChild.length;k++)
                {
						//strIDs += '<a href=\"' + ar[i].pChild[j].pChild[k].sURL + '\" onMouseover=\"SetCurrentSection(\'Section_'+ar[i].pChild[j].nSectionId+'\');\">' + ar[i].pChild[j].pChild[k].sName + '</a>';
						strIDs += '<a href=\"' + ar[i].pChild[j].pChild[k].sURL + '\" >' + ar[i].pChild[j].pChild[k].sName + '</a>';

										
                }
              strIDs+='</div></div>'
              }
            }
          }
        }
      }
    }
  }

strIDs += '' 
return strIDs
}

function WriteCurrentThirdLevelLists(ar,intCurrentSectionID)
{
var strIDs = '';

for (var i=1;i<=ar.length;i++)
  {
  if (ar[i].sURL !=null)
    {
      {
      if (ar[i].pChild)
        {
        for (var j=1;j<=ar[i].pChild.length;j++)
          {
            {
            if (ar[i].pChild[j].pChild && ar[i].pChild[j].nSectionId==intCurrentSectionID)
              {
              strIDs += '<div id=\"Section_'+ar[i].pChild[j].nSectionId+'\" class="ThirdLevelSectionListContainer"><div class=\"ThirdLevelSectionList\" onMouseover=\"SetCurrentSection(\'Section_'+ar[i].pChild[j].nSectionId+'\');\" onMouseout=\"ClearCurrentSection(\'Section_'+ar[i].pChild[j].nSectionId+'\');\">'
              for (var k=1;k<=ar[i].pChild[j].pChild.length;k++)
                {
						//strIDs += '<a href=\"' + ar[i].pChild[j].pChild[k].sURL + '\" onMouseover=\"SetCurrentSection(\'Section_'+ar[i].pChild[j].nSectionId+'\');\">' + ar[i].pChild[j].pChild[k].sName + '</a><br/>';
						strIDs += '<a href=\"' + ar[i].pChild[j].pChild[k].sURL + '\" >' + ar[i].pChild[j].pChild[k].sName + '</a><br/>';
                }
              strIDs+='</div></div>'
              }
            }
          }
        }
      }
    }
  }

strIDs += '' 
return strIDs
}

