
// Remove options from a drop-down list
$(document).ready(function() {
   $("#Searchresults1_Search_plhSearchControl_drpSortOrder option[value='Alpha']").remove();
   
   $('#Searchresults2_Search_plhSearchControl_btnSearch').attr('href',"javascript:window.location.href=renderProductSearchScriptNew('/Content_Common/index.aspx', 'rcs', '1', 'st', 'pcId', 'rrp', 'Searchresults2_Search_plhSearchControl_txtSearchTerm', 'Searchresults2_Search_plhSearchControl_drpProductCategory', 'Searchresults2_Search_plhSearchControl_drpResultsPerPage', [], [], 'so', 'Searchresults2_Search_plhSearchControl_drpSortOrder');" );
});

//javascript:window.location.href=renderProductSearchScript('/Content_Common/index.aspx', 'rcs', '1', 'st', 'pcId', 'rrp', 'Searchresults1_Search_plhSearchControl_txtSearchTerm', 'Searchresults1_Search_plhSearchControl_drpProductCategory', 'Searchresults1_Search_plhSearchControl_drpResultsPerPage', [], [], 'so', 'Searchresults1_Search_plhSearchControl_drpSortOrder');

function renderProductSearchScriptNew(curPath, resultListCreatedFromSearchQualifier, resultListCreatedFromSearchValue, searchTermQualifier, productCategoryQualifier, resultsPerPageQualifier, txtSearchTerm, productCategoryDropDownListId, resultsPerPageDropDownListId, arrProductPropertiesDropDownClientIds, arrProductPropertiesDropDownDataBaseIds, sortOrderQualifier, sortOrderDropDownListId) {
	var searchURL;
	
	//Note: For this to function correctly, ensure the SearchResults Product Search control is rendered to the screen (so that document.getElementById(txtSearchTerm) is valid),
	//      and that productCategoryDropDownListId is also rendered to the screen (so that document.getElementById(productCategoryDropDownListId) is valid) [however both can be hidden with CSS]
	//      That is, ensure: SearchControl_Product_SearchTerm_Visible="True" and SearchControl_Product_ProductCategory_Visible = "True"

	searchURL  = curPath + '?' + resultListCreatedFromSearchQualifier + '=' + resultListCreatedFromSearchValue;
	searchURL += '&' + searchTermQualifier + '=' + ((document.getElementById(txtSearchTerm) != null) ? escape(document.getElementById(txtSearchTerm).value) : "");
	searchURL += '&' + productCategoryQualifier + '=b41df93e-972b-4842-90ea-f73711eb5ff6' /*+ ((document.getElementById(productCategoryDropDownListId) != null) ? document.getElementById(productCategoryDropDownListId).options[document.getElementById(productCategoryDropDownListId).selectedIndex].value : "");*/
	searchURL += '&' + resultsPerPageQualifier + '=' + ((document.getElementById(resultsPerPageDropDownListId) != null) ? document.getElementById(resultsPerPageDropDownListId).options[document.getElementById(resultsPerPageDropDownListId).selectedIndex].value : "");

	if (sortOrderQualifier) {
	    searchURL += '&' + sortOrderQualifier + '=' + ((document.getElementById(sortOrderDropDownListId) != null) ? document.getElementById(sortOrderDropDownListId).options[document.getElementById(sortOrderDropDownListId).selectedIndex].value : "");
	}

	for(i=0; i<arrProductPropertiesDropDownClientIds.length; i++) {
		searchURL += '&' + arrProductPropertiesDropDownDataBaseIds[i] + '=' + document.getElementById(arrProductPropertiesDropDownClientIds[i]).options[document.getElementById(arrProductPropertiesDropDownClientIds[i]).selectedIndex].value;
	}

	return searchURL;
}
