window.mmWroteMenu = false;

function mm_showsampleprep(iFlag, imgname, imgfile)
{
	if (window.mmWroteMenu)
	{
		this.MM_showMenu(window.mm_menu_sampleprep,0,24,null,imgname);
		if (iFlag == 2)
		{
			MM_swapImage(imgname,'',imgfile,1);
		}
	}
}

function mm_showcrmstandards(iFlag, imgname, imgfile)
{
	if (window.mmWroteMenu)
	{
		this.MM_showMenu(window.mm_menu_crmstandards,0,24,null,imgname);
		if (iFlag == 2)
		{
			MM_swapImage(imgname,'',imgfile,1);
		}
	}
}

function mm_showenviropt(iFlag, imgname, imgfile)
{
	if (window.mmWroteMenu)
	{
		this.MM_showMenu(window.mm_menu_enviropt,0,24,null,imgname);
		if (iFlag == 2)
		{
			MM_swapImage(imgname,'',imgfile,1);
		}
	}
}

function mm_showecommerce(iFlag, imgname, imgfile)
{
	if (window.mmWroteMenu)
	{
		this.MM_showMenu(window.mm_menu_ecommerce,0,24,null,imgname);
		if (iFlag == 2)
		{
			MM_swapImage(imgname,'',imgfile,1);
		}
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function mmLoadMenus() {
	 if (window.mm_menu_sampleprep) return;
  window.mm_menu_sampleprep = new Menu("root",150,20,"Verdana, Arial, Helvetica, sans-serif",10,"#3366cc","#3366cc","#e0e8f8","#dddddd","left","middle",3,0,1000,-5,7,true,true,true,0,false,true);
  mm_menu_sampleprep.addMenuItem("Table&nbsp;of&nbsp;Contents","window.open('http://www.spexcsp.com/sampleprep/', '_self');");
   mm_menu_sampleprep.hideOnMouseOut=true;
   mm_menu_sampleprep.menuBorder=1;
   mm_menu_sampleprep.menuLiteBgColor='#ffffff';
   mm_menu_sampleprep.menuBorderBgColor='#555555';
   mm_menu_sampleprep.bgColor='#555555';
  window.mm_menu_crmstandards = new Menu("root",184,18,"Verdana, Arial, Helvetica, sans-serif",10,"#cc6600","#cc6600","#fbf4ee","#dddddd","left","middle",2,0,1000,-5,7,true,true,true,0,true,true);
  mm_menu_crmstandards.addMenuItem("Catalog&nbsp;Table&nbsp;of&nbsp;Contents","location='http://www.spexcsp.com/crm/'");
  mm_menu_crmstandards.addMenuItem("Request&nbsp;a&nbsp;Custom&nbsp;Standard","location='http://www.spexcsp.com/crm/3/custom_Standards_Request.aspx'");
  mm_menu_crmstandards.addMenuItem("MSDS","location='http://Main.spexcsp.com/SPEXMSDS.aspx'");
  mm_menu_crmstandards.addMenuItem("Inorganic&nbsp;Certificate&nbsp;of&nbsp;Analysis","location='http://main.spexcsp.com/Login.aspx?ReturnUrl=%2fspexcertificates.aspx'");
  mm_menu_crmstandards.addMenuItem("Organic&nbsp;Certificate&nbsp;of&nbsp;Analysis","location='http://www.spexcsp.com/3/under_construction.aspx'");
  mm_menu_crmstandards.addMenuItem("Reference&nbsp;Materials&nbsp;FAQs&nbsp;","location='http://main.spexcsp.com/technicalcorner.html?tid=3&sid=1'");
  mm_menu_crmstandards.addMenuItem("US&nbsp;Sales&nbsp;Reps","location='http://www.spexcsp.com/crm/3/us_sales_reps.aspx'");
  mm_menu_crmstandards.addMenuItem("International&nbsp;Distributors","location='http://Main.spexcsp.com/SPEXContactUS.aspx'");
  mm_menu_crmstandards.addMenuItem("Email&nbsp;Newsletter","location='http://www.spexcsp.com/crm/3/newsletter_request.aspx'");
  mm_menu_crmstandards.addMenuItem("Customer&nbsp;Satisfaction&nbsp;Survey","location='http://www.spexcsp.com/crm/3/tcs_survey.aspx'");
   mm_menu_crmstandards.hideOnMouseOut=true;
   mm_menu_crmstandards.menuBorder=1;
   mm_menu_crmstandards.menuLiteBgColor='#ffffff';
   mm_menu_crmstandards.menuBorderBgColor='#555555';
   mm_menu_crmstandards.bgColor='#555555';
  window.mm_menu_enviropt = new Menu("root",150,20,"Verdana, Arial, Helvetica, sans-serif",10,"#663333","#663333","#f3e9e9","#dddddd","left","middle",3,0,1000,-5,7,true,true,true,0,false,true);
  mm_menu_enviropt.addMenuItem("Table&nbsp;of&nbsp;Contents","window.open('http://www.spexcsp.com/crm-organic/', '_self');");
   mm_menu_enviropt.hideOnMouseOut=true;
   mm_menu_enviropt.menuBorder=1;
   mm_menu_enviropt.menuLiteBgColor='#ffffff';
   mm_menu_enviropt.menuBorderBgColor='#555555';
   mm_menu_enviropt.bgColor='#555555';
  window.mm_menu_ecommerce = new Menu("root",150,20,"Verdana, Arial, Helvetica, sans-serif",10,"#006633","#006633","#e8fff3","#dddddd","left","middle",3,0,1000,-5,7,true,true,true,0,false,true);
  mm_menu_ecommerce.addMenuItem("Technical Library","location='http://Main.spexcsp.com/technicalcorner.html?tid=0'");
  mm_menu_ecommerce.addMenuItem("Presentations","location='http://Main.spexcsp.com/technicalcorner.html?tid=1'");
  mm_menu_ecommerce.addMenuItem("Trade Shows","location='http://Main.spexcsp.com/technicalcorner.html?tid=2'");
  mm_menu_ecommerce.addMenuItem("FAQs","location='http://Main.spexcsp.com/technicalcorner.html?tid=3'");
  mm_menu_ecommerce.addMenuItem("Tech Tips","location='http://Main.spexcsp.com/technicalcorner.html?tid=4'");
   window.mm_menu_ecommerce.hideOnMouseOut=true;
   window.mm_menu_ecommerce.menuBorder=1;
   window.mm_menu_ecommerce.menuLiteBgColor='#ffffff';
   window.mm_menu_ecommerce.menuBorderBgColor='#555555';
   window.mm_menu_ecommerce.bgColor='#555555';

  window.mm_menu_ecommerce.writeMenus();

	window.mmWroteMenu = true;
  
} // mmLoadMenus()

//if (document.getElementById)
//{
//	document.write('<style type="text/css">\n');
  //  document.write('.submenu{display: none;}\n');
//	document.write('</style>\n');
//}

function SwitchMenu(obj)
{
	if(document.getElementById)
	{
    	var el = document.getElementById(obj);
		var ar = document.getElementById("masterdiv").getElementsByTagName("span"); 
        if(el.style.display != "block")
        { 
			for (var i=0; i<ar.length; i++)
            {
				if (ar[i].className=="submenu") 
            		ar[i].style.display = "none";
            }
            el.style.display = "block";
		}
        else
        {
			el.style.display = "none";
        }
	}
}
