

	function onGalleries(status){
		document.getElementById('options').style.display = status ? 'block' : 'none';
	}
	
	function onThumbnail(thumbnail, status, cart){
		thumbnail.style.background= status ? cart ? '#369' : '#999' : cart ? '#036' : '#666';
	}
	
	querystring = window.location.search.substr(1);
	function setGet(name, val){
		if(val && querystring == '') querystring = name + '=' + val;
		else{
				querystring = querystring.split('&');
				found = -1;
				for(i=0; i<querystring.length; i++){
					querystring[i] = querystring[i].split('=');
					if(querystring[i][0] == name){
						if(val) querystring[i][1] = val;
						found = i;
					}
					querystring[i] = querystring[i].join('=');
				}
				if(found > -1)
					if(!val) querystring = querystring.splice(found-1, 1);
				querystring = querystring.join('&');
				if(found == -1 && val) querystring += '&' + name + '=' + val;
		}
		return querystring;
	}
	
	function addToCart(gallery, image){
		script = window.location.pathname.split('/');
		script = script[script.length-1];
		querystring = setGet('removeg', false);
		querystring = setGet('removei', false);
		querystring = setGet('addg', gallery);
		querystring = setGet('addi', image);
		window.location = script + '?' + querystring;
	}
	
	function removeFromCart(gallery, image){
		script = window.location.pathname.split('/');
		script = script[script.length-1];
		querystring = setGet('addg', false);
		querystring = setGet('addi', false);
		querystring = setGet('removeg', gallery);
		querystring = setGet('removei', image);
		window.location = script + '?' + querystring;
	}
	
	function viewFullSize(gallery, image){
		window.open('full.php?gallery=' + gallery + '&image=' + image, 'full', 'width=540,height=600');
	}
	
	total = 0;
	function changePrice(size, price){
		if(size.checked) total += price;
		else total -= price;
		document.getElementById('total').innerHTML = total;
	}