if (typeof slideOutMenu != "undefined")
	{
	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 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_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];}
	}
	var menus = [
		new slideOutMenu("menu1", "down", 170, 0, 165, 250)
	]
	for (var i = 0; i < menus.length; i++) {
		menus[i].onactivate = new Function("document.getElementById('act" + i + "').className='active';");
		menus[i].ondeactivate = new Function("document.getElementById('act" + i + "').className='';");
	}
	}
	function MM_jumpMenu(targ,selObj,restore){ //v3.0
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
	}




function askTheExpert(pstrExtraCats,pstrExpertDiv)
	{

	gstrPageUIDs = "";
	gstrPageSubs = "";

	lstrExtraSubs = "";

	if (document.getElementById("hidAskTheExpert"))
		{
		pstrExtraCats = (typeof(pstrExtraCats) != "undefined" ? pstrExtraCats + "," : "") + document.getElementById("hidAskTheExpert").value;
		}

	if (gstrPageUIDs.length == 0 )
		{
		var metatags = document.getElementsByTagName("META");
		if (metatags.length >0)
			{
			for(i=0;i<metatags.length;i++)
				{
				if (metatags[i].name == "generator")
					{
					larrTags = metatags[i].content.split(" | ");
					if (larrTags.length > 0)
						{
						gstrPageUIDs = larrTags[1];
						if (larrTags.length > 1 && typeof(larrTags[2]) != "undefined") {gstrPageSubs = larrTags[2] ;}
						}
					}
				}
			}

		}
	var pageCats = (gstrPageUIDs.length > 0 ? gstrPageUIDs + (typeof(pstrExtraCats) != "undefined" ? "," : "") : "") +(typeof(pstrExtraCats) != "undefined" ? pstrExtraCats : "");
	var pageSubs = (gstrPageSubs.length > 0 ? gstrPageSubs + (typeof(pstrExtraCats) != "undefined" ? "," : "") : "") +(typeof(pstrExtraCats) != "undefined" ? pstrExtraCats : "");


	if (pageCats != "")
		{
		lobjExpertAjax = new sack();
		lobjExpertAjax.requestFile = '/_shared/ajax/ask_the_expert.php';
		lobjExpertAjax.encVar("cats",pageCats);
		lobjExpertAjax.encVar("subs",pageSubs);
		lobjExpertAjax.onCompletion = function ()
			{
			if (document.getElementById('ms_askTheExpert').innerHTML != lobjExpertAjax.response)
				{
				document.getElementById('ms_askTheExpert').innerHTML = lobjExpertAjax.response;
				}
			}
		lobjExpertAjax.runAJAX();
		}
	}


	function update_sac_counter()
		{
		lobjCountAjax = new sack();
		lobjCountAjax.requestFile = "/_shared/ajax/get_contact_count.php";
		lobjCountAjax.setVar("site",document.getElementById("selSiteSelect").value);
		lobjCountAjax.setVar("cat",document.getElementById("selProductCategory").value);
		lobjCountAjax.setVar("subcat",document.getElementById("selProductSubCategory").value);
		lobjCountAjax.setVar("supplier",document.getElementById("selProductSupplier").value);

		lobjCountAjax.onCompletion = function()
			{
			document.getElementById('sac_finder_count').innerHTML = lobjCountAjax.response;
			}

		lobjCountAjax.runAJAX();

		}



	function get_subcategories()
		{

		lobjSubAjax = new sack();
		lobjSubAjax.requestFile = "/_shared/ajax/get_subcategories.php";
		lobjSubAjax.setVar("parent",document.getElementById("selProductCategory").value);

		lobjSubAjax.onLoading = function()
			{
			document.getElementById('selProductSubCategory').options.length = 0;
			document.getElementById('selProductSubCategory').style.background = "url(/cz/magicLibrary/images/ajax-loader-2.gif) no-repeat";
			document.getElementById('selProductSupplier').options.length = 0;
			document.getElementById('selProductSubCategory').disabled = true;
			document.getElementById('selProductSupplier').disabled = true;
			}

		lobjSubAjax.onCompletion = function()
			{
			eval(lobjSubAjax.response);
			update_sac_counter();
			}

		lobjSubAjax.runAJAX();

		}



	function get_suppliers()
		{
		lobjSupAjax = new sack();
		lobjSupAjax.requestFile = "/_shared/ajax/get_suppliers.php";
		lobjSupAjax.setVar("subcat",document.getElementById("selProductSubCategory").value);

		lobjSupAjax.onLoading = function()
			{
			document.getElementById('selProductSupplier').style.background = "url(/cz/magicLibrary/images/ajax-loader-2.gif) no-repeat";
			document.getElementById('selProductSupplier').options.length = 0;
			document.getElementById('selProductSupplier').disabled = true;
			}

		lobjSupAjax.onCompletion = function()
			{
			eval(lobjSupAjax.response);
			update_sac_counter();
			}

		lobjSupAjax.runAJAX();

		}

	function fnContactResults(){
		pintSiteUID = document.getElementById('selSiteSelect').value;
		pintCatUID = document.getElementById('selProductCategory').value;
		pintSubcatUID = document.getElementById('selProductSubCategory').value;

		window.location = '/cz/solution_contact_finder_search_results.php?site='  + pintSiteUID + '&category=' + pintCatUID + '&subCategory=' + pintSubcatUID;
	}

     ms_doSiteSearch = function()
    {
        var q = document.getElementById('q').value;
      //  q = q.replace(/[^\w\s]/g,'');
		document.getElementById('q').value = q;
		if (q.length > 0) {
			location.href = '/cz/search/'+ms2_urlencode(q)+'/1/';
			}
    }

    ms_catchEnter = function(e)
    {

        if (!e) { var e = window.evt; }
        if (e.keyCode) { code = e.keyCode; }
        else if (e.which) { code = e.which; }

        if (code==13)
        {
            //submit the form, do your validation, or whatever
            ms_doSiteSearch();
        }
    }

	function ms2_urlencode( pstrURL ) {
    var lobjSymbols = {};
    var lstrReturn = encodeURIComponent(pstrURL.toString());
 
    lobjSymbols['%20'] = '+';
    lobjSymbols['!']   = '%21';
    lobjSymbols["'"]   = '%27';
    lobjSymbols['(']   = '%28';
    lobjSymbols[')']   = '%29';
    lobjSymbols['*']   = '%2A';
    lobjSymbols['~']   = '%7E';
    
    for (lstrSearch in lobjSymbols) {
        lstrReplace = lobjSymbols[lstrSearch];
        lstrReturn = ms2_replace(lstrReturn, lstrSearch, lstrReplace) 
    }
    
    // Uppercase for full PHP compatibility
    return lstrReturn.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) {
        return "%"+m2.toUpperCase();
    });
    
    return  lstrReturn;
	}

	function ms2_replace(pstrString, pstrSearch, pstrReplace) {
	var larrTemp = [];
	larrTemp = pstrString.split(pstrSearch).join(pstrReplace);
	return larrTemp;
	};