// JavaScript Document

function PagingLinks(page_number){
	//set up the initial search url
	var searchUrl = "/shop/search/?";
	
	//go through all arguments starting with the third and add them to the url as query parameters
	for(var i=1; i < arguments.length; i+=2){
		//get the field name and value
		var searchField = arguments[i];
		var searchValue = arguments[i+1];
		
		//if they are both defined, then add them to the url
		if(searchField != undefined && searchValue != undefined){
			searchUrl += ("&" + searchField + "=" + searchValue);
		}
	}
	
	if(page_number != '1'){
		searchUrl += "&page=" + page_number;
	}

	//go to the url we generated
	window.location.href = searchUrl;
}

function SubmitSearchForm(form){
	form.action = "/shop/search/";
	form.method = "get";
	form.submit();
}