

	function searchBoxSubmit(pCatRefineId, pVirtualProdRefine) {
		var selectedCatId = document.searchbox.catId.value;
		if (selectedCatId != "" && pCatRefineId != "" && pVirtualProdRefine=="") {
			document.searchbox.qfh_ft.value = pCatRefineId + ":" + selectedCatId ;
		}else if(selectedCatId != "" && pCatRefineId != ""&& pVirtualProdRefine!=""){
			document.searchbox.qfh_ft.value = pCatRefineId + ":" + selectedCatId + ":" + pVirtualProdRefine;
		}	
		document.searchbox.submit();
	}

	function searchEnterSubmit(event, pCatRefineId, pVirtualProdRefine) {
		if (event.keyCode == 13) {
			searchBoxSubmit(pCatRefineId, pVirtualProdRefine);
		}
	}

	var windowlocation = window.location.href;
	function quickSearchSubmit(defaultMsg, errorMsg) {
		if (document.getElementById('textarea').value == defaultMsg || document.getElementById('textarea').value == '') {
			document.getElementById('warning').style.display = 'block';
			document.getElementById('errorDiv').innerHTML = "<strong>" + errorMsg + "</strong>";
			window.location.href = windowlocation + "#warning";
		} else {
			document.quicksearchform.submit();
		}
	}

	function editQuickSearchSubmit(defaultMsg, errorMsg) {
		if (document.getElementById('textarea').value == defaultMsg || document.getElementById('textarea').value == '') {
			document.getElementById('warning').style.display = 'block';
			document.getElementById('errorDiv').innerHTML = "<strong>" + errorMsg + "</strong>";
			window.location.href = windowlocation + "#warning";
		} else {
			document.qseditform.submit();
		}
	}

	function submitQSForm() {
		document.qsresultsform.submit();
	}

	function submitQSOrderBy(orderBy) {
		document.qsresultsform.qfh_ob.value = orderBy;
		submitQSForm();
	}

	function submitOrderBy(orderBy) {
		document.orderByForm.qfh_ob.value = orderBy;
		document.orderByForm.submit();
	}

	function submitQSAddFacet(facetTrail, pageNum) {
		document.qsresultsform.qfh_ft.value = facetTrail;
		document.qsresultsform.qfh_gtp.value = pageNum;
		submitQSForm();
	}

	function submitQSPageSize(pageSize, pageNum) {
		document.qsresultsform.srs_ps.value = pageSize;
		document.qsresultsform.qfh_gtp.value = pageNum;
		submitQSForm();
	}

	function submitQSView(view) {
		document.qsresultsform.action = document.qsresultsform.action + "&srchResultsView=" + view;
		submitQSForm();
	}

	function submitQSPagination(pageNum) {
		document.qsresultsform.qfh_gtp.value = pageNum;
		submitQSForm();
	}

	function submitQSNoResultsForm() {
		document.qsnoresultsform.qfh_q.value = document.getElementById("ingresa-mail").value;
		if(document.getElementById("ingresa-mail").value) {
			document.qsnoresultsform.submit();
		}
	}

	var selbrands = "";
	var seloptions = "";
	var message="";
	function setMessage(error){
		message=error;
	}
	function setBrandsFacet(facetTrail) {
		selbrands = facetTrail;
	}
	function setOptionsFacet(facetTrail) {
		seloptions = facetTrail;
	}
	function submitFacetSearch(pVirtualProdRefine) {
		var finalFacetTrail = selbrands;
		if (selbrands != "" && seloptions != "") {
			finalFacetTrail = finalFacetTrail + ":";
		}
		finalFacetTrail = finalFacetTrail + seloptions;
		if (finalFacetTrail != "" && pVirtualProdRefine != "") {
			finalFacetTrail = finalFacetTrail + ":";
		}
		finalFacetTrail = finalFacetTrail + pVirtualProdRefine;
		document.prosearch.qfh_ft.value = finalFacetTrail;
		document.prosearch.submit();
	}
	
	function check_length(my_form,event){
		var count_coma,count_enter,counter=null;
		var limit=52;
		var unicode=event.charCode? event.charCode : event.keyCode;
		var strText = document.getElementById('textarea').value;
		var strTextTemp = strText + String.fromCharCode(unicode);
		count_coma = strTextTemp.split(",").length;
		count_enter = strTextTemp.split(/\n+/).length;
		counter=count_coma+count_enter;
		if(counter >=limit){
			alert(message);
			document.getElementById('textareaHidden').value=strText;
			if (unicode != 8) {
				my_form.value = my_form.value.substring(0, (my_form.value.length-1));
			}
		}
		}
	
