// JavaScript Document
function swapProdImg (divId, newImagePath, thumbName, nOfThumbs) {
	//alert (newImagePath);
	// we assume that all thumbs have id thumbName1 ... thumbName+nOfThumbs
	document.getElementById('prodpichero').style.backgroundImage = 'url('+newImagePath+')';
	var i;
	for (i=1;i<=nOfThumbs;i++){
		document.getElementById(thumbName+i).className = 'normal';
	}
}

function colourRows(tableName, colour1, colour2, offset){
	// for the background #ece9d8
	// green colours: #DCD7BA and #E4E0CB
	// blue colours: #C7CFCB and #D9DCD2
	// red colours: #F2C1B6 and #F0CFC1
	// gold colours: #F2D197 and #F0D9AD
	// purple colours: #D1C5D6 and #D8CED6
	var i;
	var myrows= new Array();
	myrows=document.getElementById(tableName).rows;
	for (i in myrows){
		if(i>=offset){
			myrows[i].bgColor=colour1;
			if(i%2==0){myrows[i].bgColor=colour2;	}
		}
	}
}
function createFlyout(originatorId,flyoutId,flyoutClass,flyoutText){
   var newdiv = document.createElement('div');
   newdiv.setAttribute('id', flyoutId);
   newdiv.className='flyoutdiv';
   x=document.getElementById(originatorId);
   newdiv.innerHTML=flyoutText;
   x.appendChild(newdiv);	
}
function destroyFlyout(parentId,flyoutId){
	var child = document.getElementById(flyoutId);
    var parent = document.getElementById(parentId);
    parent.removeChild(child);
}

