var home_banners_current=1;
var home_banners_enabled=true;
is_element = function(id){
	return $type($(id)) == 'element' ? true : false;
}

var disable_click = false;
window.addEvent('domready', function(){
	/* Clickable maken van H1 tags */
	if(is_element('home_blokken')){
		$('home_blokken').getElements('h1').each(function(el){
			p = el.getPrevious();
			if(p.get('tag') == 'a'){
				el.set('link', p.get('href')).addEvent('click', function(){ 
					go(this.get('link')); 
				}).setStyle('cursor', 'pointer');			
			}
		});
													   
	}
	/* title tags op links vervangen */
	$$('a').set('title', '');
	if($type($('btn_enlarge')) == 'element'){
		$('btn_enlarge').addEvent('click', function(){ if(!disable_click){
														  disable_click = true;
														  load_popup('enlarge', {'image':this.get('href')} );
														  (function(){ disable_click = false; }).delay(500);
													   }} );
	}
	Custom.init();
	/*
	if($$('.tabpaging').getElements('a').length > 0){
		$$('.tabpaging a').addEvent('click', function(event){
					event.stop(); 	
					loc = String(window.location);
					loc = loc.substring(0, loc.indexOf('.html')) + '.ajax';
					var req = new Request.HTML({method: 'get', url:loc, 
						onSuccess: function(html) {
							$('tabpage1').set('text', '');
							$('tabpage1').adopt(html);
						},
						onFailure: function() {
							$('tabpage1').set('text', 'Er heeft zich een time-out voorgedaan tijdens het laden van de reviews.<br /><br />Probeer het later nog eens.');
						}
					});
					req.send('pagina='+this.get('html'));
		});
	}
	*/
	//this.mElement.getElementById('background').setStyle('background- image', 'url("'+url+'")'); 

									 
	/* Topmenu tabjes laden en mouseovers instellen 
									 
	$$('li.tmi').each( function(el){
		if ( el.className.indexOf("active") != -1 ) {
			var this_a=el.getElementsByTagName("a")[0];
			var this_img=this_a.getElementsByTagName("img")[0];
			el.style.backgroundImage = "url('/images/topmenu_item_left_hover_"+el.className.replace("tmi ","").replace("_active","")+".jpg')";
			this_a.style.backgroundImage = "url('/images/topmenu_item_right_hover_"+el.className.replace("tmi ","").replace("_active","")+".jpg')";
			this_img.src = this_img.src.replace('.jpg', '__'+el.className.replace("tmi ","").replace("_active",""))+".jpg";
		}
		el.onmouseover=function(el){
				if ( this.className.indexOf("active") == -1 ) {
					var this_a=this.getElementsByTagName("a")[0];
					var this_img=this_a.getElementsByTagName("img")[0];
					this.style.backgroundImage = "url('/images/topmenu_item_left_hover_"+this.className.replace("tmi ","")+".jpg')";
					this_a.style.backgroundImage = "url('/images/topmenu_item_right_hover_"+this.className.replace("tmi ","")+".jpg')";
					this_img.src = this_img.src.replace('.jpg', '__'+this.className.replace("tmi ",""))+".jpg";
				}
			};
		el.onmouseout=function(el){
				if ( this.className.indexOf("active") == -1 ) {
					var this_a=this.getElementsByTagName("a")[0];
					var this_img=this_a.getElementsByTagName("img")[0];
					this.style.backgroundImage = "";
					this_a.style.backgroundImage = "";
					this_img.src=this_img.src.substring(0,this_img.src.indexOf('__'))+".jpg";
				}
			};
	});*/
	
	$$('li.tmi').each(function(el){
		el.addEvents({'mouseenter': function(){ if(!this.hasClass('active') && this.className.indexOf('active') == -1 || this.getProperty('nocheck')){ 
													im = this.getElements('img');
													ims = String(im.get('src'));
													col = this.className.replace("tmi ","");
													col = col.replace("_active","");
													ims = ims.replace('__'+col, '');
													nim = ims.replace('.jpg', '__'+col)+".jpg";
													this.setStyle('backgroundImage', "url('/images/topmenu_item_left_hover_"+col+".jpg')");
													im.set('src', nim);
													this.getElements('a').setStyle('backgroundImage', "url('/images/topmenu_item_right_hover_"+col+".jpg')");
											   }
								   },
					  'mouseleave': function(){ if(!this.hasClass('active') && this.className.indexOf('active') == -1){
													im = this.getElements('img');
													//ims = String(im.get('src'));
													//col = this.className.replace("tmi ","");
													//nim = ims.replace('.jpg', '__'+col)+".jpg";
													this.setStyle('backgroundImage', '');
													imr = String(im.get('src'));
													if(imr.indexOf('__') > -1)im.set('src', imr.substring(0, imr.indexOf('__')) +'.jpg');
													this.getElements('a').setStyle('backgroundImage', '');
											   }
								   }
								   
								   
					 });
		if ( el.className.indexOf("active") != -1 ) {
			el.setProperty('nocheck', true);
			el.fireEvent('mouseenter');
		}													 
    });
	
	/* Overige (grijze) tabjes laden en mouseovers instellen */
	
	var i=1;
	$$('li.tbi').each( function(el){
		if ( el.className.indexOf("active") != -1 ) {
			var this_a=el.getElementsByTagName("a")[0];
			el.style.backgroundImage = "url('/images/tabmenu_item_left_hover.jpg')";
			this_a.style.backgroundImage = "url('/images/tabmenu_item_right_hover.jpg')";
			el.setStyle('border-bottom','1px solid white');
			el.setStyle('position','relative');
			el.setStyle('z-index','2');
		}
		el.onclick = new Function("$$('div.tabpage').each( function(ell){ell.style.display='none';});$$('li.tbi').each( function(ell){ell.removeClass('active');ell.style.backgroundImage='';ell.style.borderBottom='0';ell.getElementsByTagName('a')[0].style.backgroundImage='';});$(\"tabpage"+i+"\").style.display='block';this.onmouseover();this.addClass('active');return false;");
		
		el.onmouseover=function(el){
				if ( this.className.indexOf("active") == -1 ) {
					var this_a=this.getElementsByTagName("a")[0];
					this.style.backgroundImage = "url('/images/tabmenu_item_left_hover.jpg')";
					this_a.style.backgroundImage = "url('/images/tabmenu_item_right_hover.jpg')";
					this.setStyle('border-bottom','1px solid white');
					this.setStyle('position','relative');
					this.setStyle('z-index','2');
				}
			};
		
		el.onmouseout=function(el){
				if ( this.className.indexOf("active") == -1 ) {
					var this_a=this.getElementsByTagName("a")[0];
					this.style.backgroundImage = "";
					this_a.style.backgroundImage = "";
					this.setStyle('border-bottom','0');
				}
			};
			
			i++;
	});
	
	/* Tooltips genereren bij elk element dat de class "tooltip" heeft (gebruik het "rel" attribuut voor de inhoud) */

	$$('.tooltip').each(function(el){
								 var tooltip_id=Math.round(Math.random()*1000);
								 var tooltip_new = new Element('span', {'id':'tooltip_'+tooltip_id, 'class':'tooltip_tip', 'styles':{'text-decoration':'none'}});
								 var tooltip_inner = new Element('span', {'styles':{'text-decoration':'none'}});
								 tooltip_inner.innerHTML=el.getAttribute('rel').replace(' ','&nbsp;').replace(' ','&nbsp;');
								 tooltip_new.grab(tooltip_inner);
								 el.grab(tooltip_new);
								 el.onmouseover=new Function("$('tooltip_"+tooltip_id+"').setStyle('display','inline');");
								 el.onmouseout=new Function("$('tooltip_"+tooltip_id+"').setStyle('display','none');");
								 });

	/* onclick voor de kleine winkelwagen knop (rechterkolom) */

	if ($('btn_minicart')){
		$('btn_minicart').onclick=function(){
										if ( $('btn_minicart').className=='btn_minicart_active' ) {
											$('btn_minicart').className='btn_minicart_bekijk';
											$('minicart_pos').style.display='none';
										} else {
											$('btn_minicart').className='btn_minicart_active';
											$('minicart_pos').style.display='inline';
											$('minicart_shadow').style.height=$('minicart').offsetHeight+'px';
										}
									}
	}

	if ( typeof(home_bannerts) != 'undefined' ) {
		for( var i=1;i<home_bannerts.length+1;i++ ){
			$('home_banner_a'+i).onmouseover=function(){home_banners_enabled=false;setBanner(this);}
		}
		$('home_bannert').onmouseout=function(){home_banners_enabled=true;}
		scrollHomeBanner();
	}

	/* onclick voor alle elementen, wordt gebruikt om elementen (bijv minicart) te verbergen als ernaast geklikt wordt */

	document.onclick=function(e){
		if (!e) {e=event;}
		var src = e.srcElement;
		if (typeof(src)=='undefined') {src=e.target;}
		var curelm = src;
		var i=0;
		var found_minicart=false;
		while ( curelm && i<10 ) {
			if (curelm.id=='minicart' || curelm.id=='btn_minicart') {
				found_minicart=true;
			}
			curelm=curelm.parentNode;
			i++;
		}
		if (found_minicart==false && $('btn_minicart')) {
			$('btn_minicart').className='btn_minicart_bekijk';
			$('minicart_pos').style.display='none';
		}
	}

	/* external links */
	$$('a[rel=external]').each( function(el){el.setAttribute('target','_blank');} );
	
});

function checkExistingEmail(email){
	var req = new Request.JSON({url:'/checkexistingemail.ajax', 
		onSuccess: function(jsonObj) {
			if ( jsonObj.status == 'true') {
				$('msg_email_exists').setStyle('display','block');
			} else {
				$('msg_email_exists').setStyle('display','none');
			}
		},
		onFailure: function() {
			
		}
	}).post({'email':email});
}

function checkExistingAddress(zipcode,number){
	var req = new Request.JSON({url:'/checkexistingaddress.ajax', 
		onSuccess: function(jsonObj) {
			if ( jsonObj.status == 'true') {
				$('msg_address_exists').setStyle('display','block');
			} else {
				$('msg_address_exists').setStyle('display','none');
			}
		},
		onFailure: function() {
			
		}
	}).post({'zipcode':zipcode,'number':number});
}

function setProductImage(num){
	$('product_img_l').setStyle('background-image','url('+product_images[num].l+')');
}
function restoreProductImage(){
	if ( product_images[0]==false ) {
		$('product_img_l').setStyle('background-image','url(/images/geenafbeelding.jpg)');
	} else {
		$('product_img_l').setStyle('background-image','url('+product_images[0].l+')');
	}
}

function scrollHomeBanner(){
	if ( home_banners_enabled==true ) {
		if ( home_banners_current==home_bannerts.length ) {
			home_banners_current=1;
		} else {
			home_banners_current++;
		}
		setBanner($('home_banner_a'+home_banners_current));
	}
	setTimeout("scrollHomeBanner();", 3000);
}
function setBanner(a){
	var bannerid = a.id.replace('home_banner_a', '');
	home_banners_current=bannerid;
	for(var i=1;i<home_bannerts.length+1;i++){
		$('home_banner_a'+i).className='';
	}
	$('home_banner_a'+bannerid).className='active';
	/*$('home_bannert').getElementsByTagName('IMG')[0].src=home_bannerts[bannerid-1].banner;*/
	$('home_bannert').style.backgroundImage="url("+home_bannerts[bannerid-1].banner.replace('&amp;','&')+")";
	
	$('home_bannert').set('href', ( home_bannerts[bannerid-1].url == '' ? '#' : home_bannerts[bannerid-1].url));
	//$('home_bannert').addClass(bannerid+'_'+(home_bannerts[bannerid-1].url == '' ? 'default' : 'pointer'));
	$('home_bannert').setStyle('cursor', home_bannerts[bannerid-1].url == '' ? 'default' : 'pointer');

}

function setProductColor(val, colelm){
	$('color').value=val;
	$$('a.selectcolor').each( function(el){
		el.className='selectcolor';								   
	});
	colelm.className='selectcolor selectcolor_selected';
	updateProductPrice();
}

function setProductSize(val){
	$('size').value=val;
	updateProductPrice();
}


function add_option(obj, label, value){
	try{
	 obj.add(new Option(label, value), null) //add new option to end of "sample"
	} catch(e){ //in IE, try the below version instead of add()
	 obj.add(new Option(label, value)) //add new option to end of "sample"
	}	
}

function updateProductPrice(){ 
	var colorsizecombi = $('color').value+'_'+$('size').value;
	//alert('updateProductPrice');
	//alert(colorsizecombi +'->'+ typeof(product_prices[colorsizecombi]));
	if ( typeof(product_prices[colorsizecombi]) != 'undefined' ) {
		//alert(product_prices[colorsizecombi].dprice != product_prices[colorsizecombi].price);
		if($type($('product_price_small')) == 'element' && $('product_price_small').getElements('del').length > 0){
			if(product_prices[colorsizecombi].dprice != product_prices[colorsizecombi].price){
				$('product_price_small').getElements('del')[0].set('html', "van "+product_prices[colorsizecombi].dprice); 
			} else {
				$('product_price_small').getElements('del')[0].set('html', "");
			}
		}	
		//$('product_price_small').setStyle('display', (product_prices[colorsizecombi].dprice != product_prices[colorsizecombi].price ? 'block' : 'none'));
		//alert($('product_price_small').getStyle('display'));
		//return ;
		if ( product_prices[colorsizecombi].image==false ) {
		} else {
			product_images[0].ms='/images/products/thumbs/ms_'+product_prices[colorsizecombi].image;
			product_images[0].l='/images/products/thumbs/l_'+product_prices[colorsizecombi].image;
			product_images[0].xl='/images/products/thumbs/xl_'+product_prices[colorsizecombi].image;
		}
		
		if ($('product_thumb_1')) {
		if ( product_prices[colorsizecombi].image2==false ) {
			$('product_thumb_1').setStyle('display','none');
		} else {
			$('product_thumb_1').setStyle('display','block');
			$('product_thumb_1').setStyle('background-image','url(/images/products/thumbs/ms_'+product_prices[colorsizecombi].image2+')');
			product_images[1].ms='/images/products/thumbs/ms_'+product_prices[colorsizecombi].image2;
			product_images[1].l='/images/products/thumbs/l_'+product_prices[colorsizecombi].image2;
			product_images[1].xl='/images/products/thumbs/xl_'+product_prices[colorsizecombi].image2;
		}
		}
		
		if ($('product_thumb_2')) {
		if ( product_prices[colorsizecombi].image3==false ) {
			$('product_thumb_2').setStyle('display','none');
		} else {
			$('product_thumb_2').setStyle('display','block');
			$('product_thumb_2').setStyle('background-image','url(/images/products/thumbs/ms_'+product_prices[colorsizecombi].image3+')');
			product_images[2].ms='/images/products/thumbs/ms_'+product_prices[colorsizecombi].image3;
			product_images[2].l='/images/products/thumbs/l_'+product_prices[colorsizecombi].image3;
			product_images[2].xl='/images/products/thumbs/xl_'+product_prices[colorsizecombi].image3;
		}
		}
		
		if ($('product_thumb_3')) {
		if ( product_prices[colorsizecombi].image4==false ) {
			$('product_thumb_3').setStyle('display','none');
		} else {
			$('product_thumb_3').setStyle('display','block');
			$('product_thumb_3').setStyle('background-image','url(/images/products/thumbs/ms_'+product_prices[colorsizecombi].image4+')');
			product_images[3].ms='/images/products/thumbs/ms_'+product_prices[colorsizecombi].image4;
			product_images[3].l='/images/products/thumbs/l_'+product_prices[colorsizecombi].image4;
			product_images[3].xl='/images/products/thumbs/xl_'+product_prices[colorsizecombi].image4;
		}
		}
		
		if ($('product_thumb_3d')) {
		if ( product_prices[colorsizecombi].d360view==false ) {
			$('product_thumb_3d').setStyle('display','none');
		} else {
			$('product_thumb_3d').setStyle('display','block');
			$('product_thumb_3d').setAttribute('href','/images/products/3d/'+product_prices[colorsizecombi].d360view);
			product_images_3d.d3d='/images/products/3d/'+product_prices[colorsizecombi].d360view;
		}
		}
		
		$('product_price_big').innerHTML = product_prices[colorsizecombi].price.replace(',',',<span>')+"</span>";
		$('price').value=product_prices[colorsizecombi].price.replace(',', '.');
		maxorder = ( product_prices[colorsizecombi].stock > 5 ? 5 : product_prices[colorsizecombi].stock );
		$('amount').options.length = 0;
		for(i=1; i<=maxorder; i++){
			add_option($('amount'), i, i);
		}
		if ( product_prices[colorsizecombi].stock > 0 ) {
			$('product_instock').setStyle('color','#009931');
			$('product_instock').innerHTML = 'Voorradig';
			$('btn_addtocart').style.display='inline-block';
		} else {
			$('product_instock').setStyle('color','#c33');
			$('product_instock').innerHTML = 'Uitverkocht';
			$('btn_addtocart').style.display='none';
		}
		if ( product_prices[colorsizecombi].image != '' ) {
			$('product_img_l').setStyle("background-image", "url('/images/products/thumbs/l_"+product_prices[colorsizecombi].image+"')");
			$('btn_enlarge').setStyle("display", "block");
			$('btn_enlarge').setAttribute("href", "/images/products/thumbs/xl_"+product_prices[colorsizecombi].image+"");
			//$('btn_enlarge').setAttribute("onclick", "load_popup('enlarge', {'image':'/images/products/thumbs/xl_"+product_prices[colorsizecombi].image+"'});return false;");
		} else {
			$('btn_enlarge').setStyle("display", "none");
		}
		
	} else {
		/* maat-kleur combinatie bestaat niet */
		$('product_price_big').innerHTML = '';	
		$('price').value='0';
		$('product_instock').setStyle('color','#c33');
		$('product_instock').innerHTML = 'Uitverkocht';
		$('btn_addtocart').style.display='none';
	}
}

function check_fire_event(evn, id){
	if($type($(id)) == 'element'){ 
		if($(id).getStyle('display') == 'block'){
			//alert('element'+ $(id).getStyle('display'));
			$(id).fireEvent(evn);	
		}
	}
}

var _col;
function updateProductPriceWithStock(filterstr){
	if(!filterstr)filterstr = false;
	dcolor = $('color').value;
	dsize  = $('size').value;
	sizeids = new Array();
	colorids = new Array();
	if(filterstr){
//		alert('filterstr'+filterstr);
		vars = filterstr.substring(1).split('&');
		for(i=0; i<vars.length; i++){
			p = vars[i].split('=');
			switch(p[0]){
				case 'size':
					vals = p[1].split('|');
					for(j=0; j<vals.length; j++){
						// controleren of maat bestaat
						for(x=0; x<$('size').options.length; x++){
							if(vals[j] == $('size').options[x].text){
								sizeids.push($('size').options[x].value);	
							}
						}
					}
					dsize = vals[0];
					break;
				case 'color':
					vals = p[1].split('|');
					for(j=0; j<vals.length; j++){
						// controleren of kleur bestaat
						if($type($('pcol_'+vals[j]))){
							colorids.push( String($('pcol_'+vals[j]).getElements('img').get('id')).substring(4) );
						}
						/*for(x=0; x<$('size').options.length; x++){
							if(vals[j] == $('size').options[x].text){
								sizeids.push($('size').options[x].value);	
							}
						}*/
					}
					//dcolor = vals[0];
					break;
			}
		}
	}
	if(colorids.length > 0)dcolor = $('color').value = colorids[0];
	
	if(sizeids.length > 0){
		if(sizeids.length == 1){
			dsize = $('size').value = sizeids[0];
		} else {
			//if(colorids.length > 0){
					
			//} else {
				for(i=0; i<sizeids.length; i++){
					if($type(product_prices[dcolor+'_'+sizeids[i]]) && product_prices[dcolor+'_'+sizeids[i]].stock > 0){
						dsize = $('size').value = sizeids[i];
						i = sizeids.length;
					}
				} //dcolor = 
			//}
		}
	} 
	if(colorids.length > 0){
		//if(colorids.length == 1){
			//dcolor = $('color').value = colorids[0];
			//alert(dcolor);
			$$('a.selectcolor').each( function(el){
				el.className='selectcolor';	
				if(el.getElements('img').get('id') == 'col_'+dcolor){
					el.className='selectcolor selectcolor_selected';
				}
			});
			//alert('id'+dcolor);
			//alert($('col_'+dcolor));
			//$('col_'+dcolor).getParent().className='selectcolor selectcolor_selected';
		/*} else {
			for(i=0; i<colorids.length; i++){
				if($type(product_prices[dcolor+'_'+sizeids[i]]) && product_prices[dcolor+'_'+sizeids[i]].stock > 0){
					dsize = $('size').value = sizeids[i];
					i = sizeids.length;
				}
			} 
		}*/
	} 
	//alert(dcolor);
	var colorsizecombi = dcolor+'_'+dsize;
	if ( $type(product_prices) && $type(product_prices[colorsizecombi]) && product_prices[colorsizecombi].stock <= 0 ) {
		found = false;
		
		var tmpsize='';
		for (var i=0;i<$('size').options.length;i++) {
			tmpsize=$('size').options[i].value;
			if (product_prices[$('color').value+'_'+tmpsize].stock > 0) {
				$('size').options[i].selected='selected';
				$('size').value=tmpsize;
				updateProductPrice();
				found = true;
				break;	
			}
		}
		
		if(!found){
			_col = [];
			if($type($('sel_colors'))){
				$('sel_colors').getElements('img').each(function(im){ 
					_col.push(im.get('id'));
				});
				if(_col.length > 1){
					for(j=0; j<_col.length; j++){
						cl = _col[j].substring(4);
						sl = $('size').options.length;
						for (var i=0;i<sl;i++) {
							tmpsize=$('size').options[i].value;
							if (product_prices[cl+'_'+tmpsize].stock > 0) {
								$('size').options[i].selected='selected';
								$('size').value=tmpsize;
								setProductColor(cl, $('sel_colors').getElements('img')[j].getParent());
								updateProductPrice();
								j = _col.length;
								found = true;
								break;	
							}
						}						
					}
				}
			}
		}
		if(!found){
			updateProductPrice();
		}

	} else {
		updateProductPrice();
	}
}

function hideVestiging(){
	$('vestiging').setStyle('display','none');
}

function showVestiging(){
	$('vestiging').setStyle('display','block');
}

_convert = function(inp){
	s = l = ''; for(i=0;i<inp.length;i=i+3){ s+= (inp.substring(i, i+3));i=i+3; }
	for(i=0;i<s.length;i=i+3){ if((s.substring(i, 3+i)*1/3) != ''){ l+= String.fromCharCode((s.substring(i, 3+i)*1/3)); } }
	document.write(l);
};

function go(where){
	window.location.href=where;
}

var open_filter = false;
var dispstatus;
function show_filter_popup(obj, hide){
	
	//alert((hide ? 'hide' : 'show')+ '->' +$type(obj)+' == '+obj+'->'+type);
	if(!hide)hide = false;
	if(hide){
		htype = ($type(obj) == 'element') ? obj.get('id').substring(4) : obj;
		if($type($('filter_'+htype+'_pos')) == 'element')$('filter_'+htype+'_pos').setStyle('display', 'none');
		if($type($('btn_'+htype)) == 'element')$('btn_'+htype).removeClass('btn_orange_active');
	} else {
		type = ($type(obj) == 'element') ? obj.get('id').substring(4) : obj;
		dispstatus = (!open_filter ? '' : $('filter_'+open_filter+'_pos').getStyle('display'))+'-'+$('filter_'+type+'_pos').getStyle('display');
		if($type($('filter_'+type+'_pos')) == 'element')$('filter_'+type+'_pos').setStyle('display', 'block');
		if($type($('filter_'+type+'_shadow')) == 'element')$('filter_'+type+'_shadow').setStyle('height', $('filter_'+type+'_inner').offsetHeight);
		if($type($('btn_'+type)) == 'element')$('btn_'+type).addClass('btn_orange_active');
		if(open_filter){
			if($type(obj) == 'element' && open_filter == type && dispstatus == 'none-none'){
				// don't hide
			} else {
				show_filter_popup(open_filter, true);
			}
			
		}
		open_filter = type;
	}
}
var fv;
function set_filters(){
	fv = new Hash({'inp_pri' : new Array()}, {'inp_col' : new Array()});
	$('filter_values').getElements('input').each(function(inp){
		if(inp.get('type') == 'checkbox' && inp.checked){
			if(!$type(fv[inp.get('name')]))fv.set(inp.get('name'), new Array());
			fv[inp.get('name')].push(inp.get('value'));
			//alert(inp.get('name')+'->'+inp.get('value'));
		}
	});
	qs = '';
	fv.each(function(v, k){
		switch(k){ case 'inp_col': k = 'color'; break; case 'inp_pri': k = 'price'; break; case 'inp_siz': k = 'size'; break; case 'inp_bra': k = 'brand'; break; }
		//alert(skipfilter+'.indexOf(,'+k+')');
		if(skipfilter.indexOf(','+k) == -1){
			qs += '&'+ k +'=';
			for(i=0; i<v.length; i++){
				qs += (i > 0 ? '|' : '')+String(v[i]).replace('+', '*');
			}
		}
	});
	go('?'+qs.substr(1));
}
var skipfilter = '';
function remove_filter(k){
	skipfilter += ','+k;	
	set_filters();
}

function showRatingDetails(id){
	$('rating_details'+id).setStyle('display','block');
	$('rating_details_container'+id).setStyle('border','1px solid #ccc');
}
function hideRatingDetails(id,kleur){
	if(kleur){}else{kleur='#fff';}
	$('rating_details'+id).setStyle('display','none');
	$('rating_details_container'+id).setStyle('border','1px solid '+kleur);
}


/*

CUSTOM FORM ELEMENTS

Created by Ryan Fait
www.ryanfait.com

The only things you may need to change in this file are the following
variables: checkboxHeight, radioHeight and selectWidth (lines 24, 25, 26)

The numbers you set for checkboxHeight and radioHeight should be one quarter
of the total height of the image want to use for checkboxes and radio
buttons. Both images should contain the four stages of both inputs stacked
on top of each other in this order: unchecked, unchecked-clicked, checked,
checked-clicked.

You may need to adjust your images a bit if there is a slight vertical
movement during the different stages of the button activation.

The value of selectWidth should be the width of your select list image.

Visit http://ryanfait.com/ for more information.

*/

var checkboxHeight = "9";
var radioHeight = "9";
var selectWidth = "190";


/* No need to change anything after this */


document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } .disabled { opacity: 0.5; filter: alpha(opacity=50); }</style>');

var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		for(a = 0; a < inputs.length; a++) {
			if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") {
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;

				if(inputs[a].checked == true) {
					if(inputs[a].type == "checkbox") {
						position = "0 -" + (checkboxHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					} else {
						position = "0 -" + (radioHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				if(!inputs[a].getAttribute("disabled")) {
					span[a].onmousedown = Custom.pushed;
					span[a].onmouseup = Custom.check;
				} else {
					span[a].className = span[a].className += " disabled";
				}
			}
		}
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				if(!inputs[a].getAttribute("disabled")) {
					inputs[a].onchange = Custom.choose;
				} else {
					inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled";
				}
			}
		}
		document.onmouseup = Custom.clear;
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}
	}
}