function readMore(){
	$('#moreText').css('display','inline');
	$('#readMore').css('display','none');
	$('#readLess').css('display','inline');
}
function readLess(){
	$('#moreText').css('display','none');
	$('#readMore').css('display','inline');
	$('#readLess').css('display','none');
}
function search() {
	var s = document.getElementById("search-input").value;
	
	if (s.length > 0) {
		s = s.replace(/ /gi,'+');
		//s = s.replace(/[^a-z0-9\&+]/gi,'');
		window.location="/zoeken/"+escape(s)+"/";
	}
}

function keyevent(e) {
	if (e.keyCode == 13) {
		search();
	}
}
function getSearchResultsProductByOrder(order){
	$.ajax({
  		url: '/?m=Search',
		data: 'ajax=1&product=1&page=1&order='+order,
      	dataType: "html",
  		success: function(data) {
    		document.getElementById('product_resultaten').innerHTML = data;
	
			if (document.location.href.indexOf('#') >= 0) {
				document.location.href = document.location.href.substring(0,document.location.href.indexOf('#')+1)+'product_resultaten_';
				document.location.href = document.location.href.substring(0,document.location.href.indexOf('#')+1)+'product_resultaten';
			} else {
				document.location.href += '#product_resultaten';
  			}
		}
	});
}
function getSearchResultsPageProducts(page,order) { 
	$.ajax({
  		url: '/?m=Search',
		data: 'ajax=1&product=1&page='+page+'&order='+order,
      	dataType: "html",
  		success: function(data) {
    		document.getElementById('product_resultaten').innerHTML = data;
	
			if (document.location.href.indexOf('#') >= 0) {
				document.location.href = document.location.href.substring(0,document.location.href.indexOf('#')+1)+'product_resultaten_';
				document.location.href = document.location.href.substring(0,document.location.href.indexOf('#')+1)+'product_resultaten';
			} else {
				document.location.href += '#product_resultaten';
  			}
		}
	});
	/**
	var xmlhttp = new AjaxConnection(false);
	xmlhttp.setResponseAsText();
	xmlhttp.setURL("?m=Search");
	xmlhttp.addParam("product","1");
	xmlhttp.addParam("page",page);
	xmlhttp.setCallBackFunction("printSearchResultsProducts"); 
	xmlhttp.GETrequest();
	/**/
}

function printSearchResultsProducts(xmlhttp) {
	document.getElementById('product_resultaten').innerHTML = xmlhttp;
	
	if (document.location.href.indexOf('#') >= 0) {
		document.location.href = document.location.href.substring(0,document.location.href.indexOf('#')+1)+'product_resultaten_';
		document.location.href = document.location.href.substring(0,document.location.href.indexOf('#')+1)+'product_resultaten';
	} else
		document.location.href += '#product_resultaten';
}

function getSearchResultsPageDicsounts(page) { 
	$.ajax({
  		url: '/?m=Search',
		data: 'ajax=1&discount=1&page='+page,
      	dataType: "html",
  		success: function(data) {
    		document.getElementById('aanbieding_resultaten').innerHTML = data;
	
			if (document.location.href.indexOf('#') >= 0) {
				document.location.href = document.location.href.substring(0,document.location.href.indexOf('#')+1)+'aanbieding_resultaten_';
				document.location.href = document.location.href.substring(0,document.location.href.indexOf('#')+1)+'aanbieding_resultaten';
			} else
				document.location.href += '#aanbieding_resultaten';
		}
	});
	/**
	var xmlhttp = new AjaxConnection(false);
	xmlhttp.setResponseAsText();
	xmlhttp.setURL("?m=Search");
	xmlhttp.addParam("discount","1");
	xmlhttp.addParam("page",page);
	xmlhttp.setCallBackFunction("printSearchResultsDicsounts"); 
	xmlhttp.GETrequest();
	/**/
}

function printSearchResultsDicsounts(xmlhttp) {
	document.getElementById('aanbieding_resultaten').innerHTML = xmlhttp;
	
	if (document.location.href.indexOf('#') >= 0) {
		document.location.href = document.location.href.substring(0,document.location.href.indexOf('#')+1)+'aanbieding_resultaten_';
		document.location.href = document.location.href.substring(0,document.location.href.indexOf('#')+1)+'aanbieding_resultaten';
	} else
		document.location.href += '#aanbieding_resultaten';
}
