function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}

var http = createObject();
var http2 = createObject();
var nocache = 0;
nocache = Math.random();
nocache = nocache+1

function addtolijst(id) {
var id = encodeURI(id);
http.open('get', 'http://www.freakpyromaniacs.com/products/addlijst.php?productid='+id+'&nocache='+nocache);
http.onreadystatechange = added;
http.send(null);
}

function addtowish(id) {
var id = encodeURI(id);
http.open('get', 'http://www.freakpyromaniacs.com/products/addwish.php?productid='+id+'&nocache='+nocache);
http.onreadystatechange = added;
http.send(null);
}

function movelijst(id) {
var id = encodeURI(id);
http.open('get', 'http://www.freakpyromaniacs.com/products/addlijst.php?productid='+id+'&nocache='+nocache);
http2.open('get', 'http://www.freakpyromaniacs.com/products/includes/lijst/verwijderwish.php?productid='+id+'&nocache='+nocache);
http2.onreadystatechange = refresh;
http.send(null);
http2.send(null);
}

function added() {
if(http.readyState == 4){ 
var response = http.responseText;
alert('Product toegevoegd');
}
}

function deleteproduct(idp) {
var idp = encodeURI(idp);
http.open('get', 'http://www.freakpyromaniacs.com/products/includes/lijst/verwijder.php?productid='+idp+'&nocache='+nocache);
window.location.reload();
http.send(null);
}

function delwishpro(idq) {
var idq = encodeURI(idq);
http.open('get', 'http://www.freakpyromaniacs.com/products/includes/lijst/verwijderwish.php?productid='+idq+'&nocache='+nocache);
window.location.reload();
http.send(null);
}

function plus(id) {
var id = encodeURI(id);
http.open('get', 'http://www.freakpyromaniacs.com/products/addlijst.php?productid='+id+'&nocache='+nocache);
http.onreadystatechange = refresh;
http.send(null);
}

function min(id) {
var id = encodeURI(id);
http.open('get', 'http://www.freakpyromaniacs.com/products/addlijst.php?productid='+id+'&delete=true&nocache='+nocache);
http.onreadystatechange = refresh;
http.send(null);
}

function wislijst() {
var id = encodeURI(id);
http.open('get', 'http://www.freakpyromaniacs.com/products/addlijst.php?action=dropuserlist&nocache='+nocache);
http.onreadystatechange = refresh;
http.send(null);
}

function refresh() {
if(http.readyState == 4){ 
window.location.reload();
}
}