// Cleptomania
var cleptoOpacity1;
var cleptoOpacity2;
var cleptoOpacity3;

function randomCleptoShop(fade, n, adult) {

	// adult?
	if (! adult) {
		var randshop = Math.floor ( Math.random() * (CleptoProducts.length-1) );
		var isAdult = 'Yes';
		while (isAdult == 'Yes') {
			var randshop = Math.floor ( Math.random() * (CleptoProducts.length-1) );
			isAdult = CleptoProducts[randshop].adult;
		}
	} else {
		var randshop = Math.floor ( Math.random() * (CleptoProducts.length-1) );
		var isAdult = 'No';
		while (isAdult == 'No') {
			var randshop = Math.floor ( Math.random() * (CleptoProducts.length-1) );
			isAdult = CleptoProducts[randshop].adult;
		}
	}

	if (fade) {
		if (n==1) {
			cleptoOpacity1.toggle();
			setTimeout('CleptofillMultShop('+randshop+', '+n+');', 400);
			setTimeout('cleptoOpacity1.toggle();', 500);
		} else if (n==2) {
			cleptoOpacity2.toggle();
			setTimeout('CleptofillMultShop('+randshop+', '+n+');', 400);
			setTimeout('cleptoOpacity2.toggle();', 500);
		} else if (n==3) {
			cleptoOpacity3.toggle();
			setTimeout('CleptofillMultShop('+randshop+', '+n+');', 400);
			setTimeout('cleptoOpacity3.toggle();', 500);
		}
	} else {
		CleptofillMultShop(randshop, n);
	}
	return randshop;
}

function CleptofillMultShop(id, n) {
	var baseImg = 'http://images.gay.it/cleptomania/adventice';
	document.getElementById('cleptoimage'+n).src = baseImg + '/' + CleptoProducts[id].image;
	document.getElementById('cleptoseller'+n).innerHTML = CleptoProducts[id].name;	
	document.getElementById('cleptoimghref'+n).href = CleptoProducts[id].link;	
	document.getElementById('cleptohref'+n).href = CleptoProducts[id].link;	
	if (CleptoProducts[id].discountprice!='') { document.getElementById('cleptoretailprice'+n).innerHTML = '&euro;'+CleptoProducts[id].discountprice; } else { document.getElementById('cleptoretailprice'+n).innerHTML = ''; }
	document.getElementById('cleptoprice'+n).innerHTML = '&euro;'+CleptoProducts[id].regularprice.toString();
	if (CleptoProducts[id].description!='') { document.getElementById('cleptotitle'+n).innerHTML = CleptoProducts[id].description; } else { document.getElementById('cleptotitle'+n).innerHTML =  ''; }
}

