window.addEvent('domready', function(e){
	var AutoPrint = true; // Indien 'false' wordt de pagina niet automatisch uitgeprint
	
	function PrintPageDiv(divName){
	if (document.getElementById != null){
	var html = '<HTML>\n<HEAD>\n';
	if (document.getElementsByTagName != null){
	var headTags = document.getElementsByTagName("head");
	if (headTags.length > 0)
	html += headTags[0].innerHTML;}
	html += '\n</HE' + 'AD>\n<BODY>\n';
	var PrintKlaarElem = document.getElementById(divName);
	if (PrintKlaarElem != null){
	html += PrintKlaarElem.innerHTML;}
	html += '\n</BO' + 'DY>\n</HT' + 'ML>';
	var printWin = window.open("","PrintPagina");
	printWin.document.open();
	printWin.document.write(html);
	printWin.document.close();
	if (AutoPrint)printWin.print();}}

	
	$$('.toggle').each(function(e){
		id = e.id.replace(/toggle_/,"");
		el = $(id);
		var Slider = new Fx.Slide(id,{wait: false, duration: 600, transition: Fx.Transitions.Quint.easeOut} );	
		Slider.hide();
		e.addEvent('click', function(el){
			Slider.toggle();
		});
	});
	
	
});
function AddCart(id)
{ 
	setTimeout("AlertDone("+id+")",700);
	var pos = $('shopcart').getCoordinates();
	var prod = $('p'+id);
	var aantal = 1;
	if($('aantal'))
	{
		aantal = $('aantal').value;
	}
	else
	{
		aantal = 1
	}
	new Ajax('/cart_content.php', {
		method: 'post',
		update: $('shopcart'),
		data: {
			product_id: id,
			aantal: aantal
		}
	}).request();
	
	Basket.slideIn();
		
}
function AlertDone(id){
	var prod = $('p'+id);
	var pos = prod.getCoordinates();
	
	var border = prod.getStyle("border");
	if(border == '0px'){
		var bgcolor = '#fff';
		var left = pos.left;
		var top = pos.top;

	}else{
		var bgcolor = prod.getStyle("border-top-color");
		var left = pos.left+1;
		var top = pos.top+1;
	}
	var width = prod.getStyle("width");
		
	var log = new Element("div");
	log.id = "log";
	
	log.setStyles({
		'position': 			'absolute', 
		'visibility': 			'visible',
		'z-index':				'900000',
		'opacity':				0,
		'width':				width,
		'background-color': 	bgcolor,
		'left':					left,
		'top':					top
	});
	log.injectInside('inside');
	
	var fire = new Fx.Styles(log, {
		duration: 1500,
		wait: false,
		transition: Fx.Transitions.Quad.easeOut
	});
	
	
	log.setHTML("Dit product is succesvol toegevoegd");
	
	fire.start({
		'background-color': bgcolor,
		'opacity': [0, 1]
	}).chain(function(){
		this.start({
			'opacity': [1, 0]
		});
	}).chain(function(){
		log.remove();	
	});
}

function hide(id)
{
	var elem = document.getElementById(id);
	if(elem.style.display == 'none')
	{
		elem.style.display = '';
	}
	else{
		elem.style.display = 'none';
	}
}
function show(id)
{    
	var elem = document.getElementById(id);
	elem.style.display = '';
}

function showBlock(e){
		$(e).style.display = 'block';
	}
	function hideBlock(e){
		$(e).style.display = 'none';
	}
