

    function trim(strSource) {
        strSource=strSource.replace(/^(\s*)/, "");
        var strValue=strSource.replace(/(\s*)$/, "");
        return strValue;
    }


    function parseSearchString() {
        var aplphaChars="";
        var numericChars="";
        strSource = document.getElementById('txtSearch').value;
        strSource=trim(strSource)
        if(strSource=="" || strSource==" "){
            alert("Please enter Search Keywords");
            document.getElementById('txtSearch').focus();
            return false;
        }else{
            var strValue=strSource.replace(/\s{1,}/g, "|");
            var arr=strValue.split("\|");

                for(i=0;i<arr.length;i++) {
                    if(isNaN(arr[i])) {
                        aplphaChars= aplphaChars + "," + arr[i];
                    }else{
                        numericChars=numericChars + ","  + arr[i];
                    }
                }

            numericChars=numericChars.replace(/(^\,)/, "");
            aplphaChars=aplphaChars.replace(/(^\,)/, "");

            document.getElementById('hidNumeric').value = numericChars;
            document.getElementById('hidAlpha').value = aplphaChars;
			if (navigator.appName == 'Microsoft Internet Explorer') {
				document.searchFrm.action="products/textileSearchResults.jsp";
				}else {
//					document.searchFrm.action='products/textileSearchResults.jsp';
					document.searchFrm.action='products/textileSearchResults.jsp';
					}
        }
    }

    function parseSearchNumString() {
        var numericChars="";
        var returnFlag=true;

        strSource = document.getElementById('txtProd').value;
        strSource=trim(strSource)
        if(strSource=="" || strSource==" "){
            alert("Please enter Style # ");
            document.getElementById('txtProd').focus();
            return false;
        }else{
            var strValue=strSource.replace(/\s{1,}/g, "|");
            var arr=strValue.split("\|");

                for(i=0;i<arr.length;i++) {
                    if(isNaN(arr[i])) {
                        returnFlag=false;
                        break;
                    }else{
                        numericChars=numericChars + ","  + arr[i];
                    }
                }

            if(returnFlag==false){
                alert("Please remove Alphabets from Style #");
                document.getElementById('txtProd').focus();
                return false;
            }

            numericChars=numericChars.replace(/(^\,)/, "");

            document.getElementById('hidStyle').value = numericChars;
			if (navigator.appName == 'Microsoft Internet Explorer') {
				document.searchProdFrm.action="products/textileSearchResults.jsp";
				}else {
				document.searchProdFrm.action='products/textileSearchResults.jsp';
					}
        }
    }


    function setAllParameters(){

        var strFullVal = "";
        var strFlag ="";
		var strColorFlag="";


        var strOption = document.getElementById('apptype');
        strOption=strOption.options[strOption.selectedIndex].text;
        if(strOption!='All...'){
            strFullVal = strFullVal +strFlag+ strOption;
            strFlag="|";
        }


        strOption = document.getElementById('priceRange');
        strOption=strOption.options[strOption.selectedIndex].text;
        if(strOption!='All...'){
            strFullVal = strFullVal +strFlag+ strOption;
            strFlag="|";
        }


        strOption = document.getElementById('pattern');
        strOption=strOption.options[strOption.selectedIndex].text;
        if(strOption!='All...'){
            strFullVal = strFullVal +strFlag+ strOption;
            strFlag="|";
        }

		strOption = document.getElementById('colorcat');
        strOption=strOption.options[strOption.selectedIndex].text;
        if(strOption!='All...'){
            strFullVal = strFullVal +strFlag+ strOption;
            strFlag="|";
        }



		var strEnvironment = document.getElementById('environment').checked;
        if(strEnvironment==true){
            strFullVal = strFullVal +strFlag+ "Environmental";
            strFlag="|";
        }


        if(document.getElementById('crypton').checked==true){
            strFullVal = strFullVal +strFlag+ "HC/Crypton compatible";
            strFlag="|";
        }


        if(document.getElementById('Wyz100').checked==true){
            strFullVal = strFullVal +strFlag+ "100,000+ Wyzenbeek";
            strFlag="|";
        }


        if(document.getElementById('Wyz50').checked==true){
            strFullVal = strFullVal +strFlag+ "50-100,000 Wyzenbeek";
            strFlag="|";
        }





        if(document.getElementById('cal_117').checked==true){
            strFullVal = strFullVal +strFlag+ "CAL 117";
            strFlag="|";
        }
        if(document.getElementById('ASTM_E84_Ad').checked==true){
            strFullVal = strFullVal +strFlag+ "ASTM E84 adhered";
            strFlag="|";
        }
        if(document.getElementById('ASTM_E84_Un').checked==true){
            strFullVal = strFullVal +strFlag+ "ASTM E84 Unadhered";
            strFlag="|";
        }
        if(document.getElementById('NFPA_701').checked==true){
            strFullVal = strFullVal +strFlag+ "NFPA 701";
            strFlag="|";
        }


        document.getElementById('strPara').value = strFullVal;


		if (document.getElementById('colorcat').value=="All"){

			strColorFlag="0";
			formSubmit(strColorFlag);
			}else {
				strColorFlag="1";
				formSubmit(strColorFlag);
				}

    }


	function formSubmit(strColorFlag){

		if (navigator.appName == 'Microsoft Internet Explorer') {
		if (strColorFlag=="0"){
		document.advFrm.action = 'products/textileAdvanceSearchResults.jsp';
		document.advFrm.submit();
			}else {
		document.advFrm.action = 'products/textileAdvanceSearchResultsColor.jsp';
		document.advFrm.submit();
				}
		}else if (navigator.appName == 'Netscape') {
			if (strColorFlag=="0"){
		document.advFrm.action = 'products/textileAdvanceSearchResults.jsp';
		document.advFrm.submit();
			}else {
		document.advFrm.action = 'products/textileAdvanceSearchResultsColor.jsp';
		document.advFrm.submit();
				}
			}
	}



