function next(whichrow){
	document.getElementById(whichrow+'next').src = 'plugins/homepage/nextfetching.gif';
	//fill three child nodes with three new id's
	rows[whichrow].index += 3;
	if (rows[whichrow].index == rows[whichrow].ids.length){
		rows[whichrow].index = 0;
	}else if (rows[whichrow].index > rows[whichrow].ids.length - 3){
		rows[whichrow].index = rows[whichrow].ids.length - 3;
	}
	index = rows[whichrow].index;
	querystring = 'row=' + whichrow;
	for (i = 0;i < 3;i++){
		querystring = querystring + '&id' + i + '=' + rows[whichrow].ids[(index+i)];
	}
	ajaxRun('plugins/homepage/get3cells.asp',nextReturn,'POST',querystring,false,true);
}
function prev(whichrow){
	document.getElementById(whichrow+'next').src = 'plugins/homepage/nextfetching.gif';
	//fill three child nodes with three new id's
	rows[whichrow].index -= 3;
	if (rows[whichrow].index == -3){
		rows[whichrow].index = rows[whichrow].ids.length - 3; //rows[whichrow].ids.length 
	}else if (rows[whichrow].index < 0){
		rows[whichrow].index = 0;
	}
	index = rows[whichrow].index;
	querystring = 'row=' + whichrow;
	for (i = 0;i < 3;i++){
		querystring = querystring + '&id' + i + '=' + rows[whichrow].ids[(index+i)];
	}
	ajaxRun('plugins/homepage/get3cells.asp',nextReturn,'POST',querystring,false,true);
}

function nextReturn(xmlObj){
	if (xmlObj.readyState == 4){
		txt = xmlObj.responseText;
		//which
		returnRow = txt.substr(0,txt.indexOf('['));
		txt = txt.replace(returnRow,'');
		//first
		returnIndex = parseInt(txt.replace('[',''));
		if (returnIndex.toString() != 'NaN'){
			txt = txt.replace('['+returnIndex+']','');
			returnHtml = txt.substr(0,txt.indexOf('[end]'));
			txt = txt.substr(txt.indexOf('[end]')+5,txt.length);
			document.getElementById(returnRow+returnIndex).innerHTML = returnHtml;
			//second
			returnIndex = parseInt(txt.replace('[',''));
			if (returnIndex.toString() != 'NaN'){
				txt = txt.replace('['+returnIndex+']','');
				returnHtml = txt.substr(0,txt.indexOf('[end]'));
				txt = txt.substr(txt.indexOf('[end]')+5,txt.length);
				document.getElementById(returnRow+returnIndex).innerHTML = returnHtml;
				//third
				returnIndex = parseInt(txt.replace('[',''));
				if (returnIndex.toString() != 'NaN'){
					txt = txt.replace('['+returnIndex+']','');
					returnHtml = txt.substr(0,txt.indexOf('[end]'));
					document.getElementById(returnRow+returnIndex).innerHTML = returnHtml;
				}
			}
		}
		//document.getElementById(whichrow+i).innerHTML = '';
		document.getElementById(returnRow+'next').src = 'plugins/homepage/next-blauw.gif';
	}
}

function imgover(whichimg,overimg){
	imgoverkind = whichimg.parentNode.title;
	if (whichimg.src.indexOf('plugins/homepage/'+imgoverkind+'fetching.gif') != -1){
		//do nothing
	}else{
		if (overimg){
			whichimg.src = 'plugins/homepage/'+imgoverkind+'-over.gif';
		}else{
			whichimg.src = 'plugins/homepage/'+imgoverkind+'-blauw.gif';
		}
	}
}

function replaceTitles(){
	if (window.loaded){
		arrReplaceTitles = document.getElementsByTagName('H6');
		for (iReplaceTitle in arrReplaceTitles){
			elReplaceTitles = arrReplaceTitles[iReplaceTitle];
			titleReplaceTitles = elReplaceTitles.innerHTML;
			elReplaceTitles.innerHTML = '<img src="plugins/homepage/'+theme+'/titles/'+titleReplaceTitles+'.gif" border="0"/>';
		}
	}else{
		setTimeout('replaceTitles();',250);
	}
}
setTimeout('replaceTitles();',500);

