function makeDoubleDelegate(function1, function2) {
    return function() {
        if (function1)
            function1();
        if (function2)
            function2();
    }
}
//Make sure every steps return true in order. If function one return false process is stopped
function orderedDoubleDelegate(function1,function2){
	return function(){
		var valid = true;
		if(function1){
			valid = function1();
		}
		if(valid && function2){
			valid = function2();
		}
		return valid;
	}
}
//Gets the requested url parameter
function getURLParameter(name)
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}
//Perform the search when carraige return is pressed
function onkeyup_performSearch(e){
	var key=e.keyCode || e.which;
	if (key==13){
		window.location.href='/s.nl?sc=27&category=&search='+escape(document.getElementById('mt_searchbox').value);
	}
}

function validateQty(e){
	var input = e.target;
	var currentValue = parseInt(input.value,10);
	if(isNaN(currentValue) || currentValue < 1){
		input.value=1;
	}
}
