function randomfromfolder() {
	if(document.cookie) {
		
	} else {
		serialImagePath = imagePath.join(",");
		document.cookie = 'roeschImgList='+ serialImagePath;
		document.cookie = 'roeschListOffset=0';
	}
	var displayedImagePath = 'fileadmin/template/images/front_random/ROE_Web_30.jpg';
	if(document.cookie) {
		cookieValuesList = document.cookie;
		if(cookieValuesList.search('roeschImgList') < 0) {
			serialImagePath = imagePath.join(",");
			document.cookie = 'roeschImgList='+ serialImagePath;
			cookieValuesList = document.cookie;
		}
		cookieValuesList = cookieValuesList.substring(cookieValuesList.search('roeschImgList')+14);
		roeschImgList = cookieValuesList.substring(0,cookieValuesList.search(';'));
		
		
		cookieValuesOffset = document.cookie;
		if(cookieValuesList.search('roeschListOffset') < 0 || cookieValuesList.search('roeschListOffset') === false) {
			document.cookie = 'roeschListOffset=0';
			cookieValuesOffset = document.cookie;
		}
		cookieValuesOffset = cookieValuesOffset.substring(cookieValuesOffset.search('roeschListOffset')+17);
		roeschImgListOffset = cookieValuesOffset.substring(0,cookieValuesOffset.search(';'));
		if(!roeschImgListOffset) {
			roeschImgListOffset = cookieValuesOffset;
		}
		
		roeschImgArray = roeschImgList.split(',');
		displayedImagePath = roeschImgArray[roeschImgListOffset];
		
		if(displayedImagePath.length == 0) {
			serialImagePath = imagePath.join(",");
			displayedImagePath = serialImagePath.substring(0,serialImagePath.search(','));
		}
		
		div = document.getElementById("randomfromfolder");
		if(div) {
			div.innerHTML = '<img style="height:335px;width:660px;" src="'+displayedImagePath+'" alt="" id="randomimagetag"/><span id="randomimagefromfolderNext" onclick="randomfromfolder()">'+nextLink+'</span>';
		}
		if(roeschImgListOffset < roeschImgArray.length-1 || roeschImgArray.length == 1) {
			roeschImgListOffset++;
		} else {
			roeschImgListOffset = 0;
		}
		document.cookie = 'roeschListOffset='+roeschImgListOffset;
	}
}

