﻿//Used for the search control at the page header
function doKeywordSearch() {
    var value = document.getElementById("KeywordSearch").value;
    value = RemoveSpecialCharacters(value);
    var url = "/Search";

    window.location = url + "/" + value;
}

//Used in Search results page drop down options
function ControlOptionsSearch(url) {
	
   	var orderBy = document.getElementById("OrderBy").value;
   	var pageSize = document.getElementById("PageSize").value;
	
	url = url +"&pageSize=" + pageSize + "&orderBy=" + orderBy;
	
   	window.location = url;
}

function RemoveSpecialCharacters(string) {
	if (string != "" && isNaN(string)) {
		string = string.replace(/[^a-zA-Z 0-9 -]+/g, '');
	}

	return string;
}

function RetrieveBaseUrl() {
	var fullAddressUrl = window.location.href;
	var pathArray = fullAddressUrl.split('/');
	var baseUrl = pathArray[0] + "//" + pathArray[2];

	return baseUrl
}


