// Save domain selection
function create_http_object(){var ActiveXTypes=["Microsoft.XMLHTTP","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"];for(var i=0;i<ActiveXTypes.length;i++){try{return new ActiveXObject( ActiveXTypes[i] );}catch(e){}}try{return new XMLHttpRequest();}catch(e){}return false;} 

var httpObject = create_http_object();

$(document).ready(function(){
    $('.product button[name="act"]').click(function(){
        artikelnummer = $(this).parent().children('input[name="product_id"]').eq(0).val();
        //if(artikelnummer == undefined){
            //alert(artikelnummer);
        //}
       	if(!httpObject){ 
    		alert('Je browser ondersteunt deze feature niet.'); 
    		return false; 
    	} 
        httpObject.open("GET", "/includes/aj_bestel.php?art=" + artikelnummer + "&c=1&rand=" + Math.random(), true);
        httpObject.onreadystatechange = function(){};
        httpObject.send('');
        $(this).after(' <span>Toegevoegd<span>');
        setTimeout(function(){
            $(".cart_options span").fadeOut("slow", function(){
                $(".cart_options span").remove();
            });
        },2000);
    }); 
    
    
    $('.popup').click(function(){
        var id = 'webshop' + Math.random();
        id = id.replace('.','');
        $(this).children('span').wrapInner('<div>');
        $(this).children('span').attr('id', id);

       tb_show('Meer informatie', '#TB_inline?height=400&width=600&inlineId='+ id); 
    });
});
