// JavaScript Document
images = new Array();
 images[1] = 'cakes/Cakes1.png';
 images[2] = 'cakes/Cakes2.png';
 images[3] = 'cakes/Cakes3.png';
 images[4] = 'cakes/Cakes4.png';
 images[5] = 'cakes/Cakes5.png';
 images[6] = 'cakes/Cakes6.png';
 images[7] = 'cakes/Cakes7.png';
 images[8] = 'cakes/Cakes8.png';

 images[9] = 'chocolates/Chocolates1.png';
 images[10] = 'chocolates/Chocolates2.png';
 images[11] = 'chocolates/Chocolates3.png';
 images[12] = 'chocolates/Chocolates4.png';
 images[13] = 'chocolates/Chocolates5.png';
 images[14] = 'chocolates/Chocolates6.png';
 images[15] = 'chocolates/Chocolates7.png';
 images[16] = 'chocolates/Chocolates8.png';
 images[17] = 'chocolates/Chocolates9.png';
 
quotes = new Array();
quotes[1] = 'During the Aztec reign, a slave could be bought for 100 cacao beans.';
quotes[2] = 'Chocolate contains significantly less caffeine than tea, coffee and soft drinks.';
quotes[3] = 'The first cacao trees were found growing in the Amazon River basin and in the foothills of the Venezuelan and Colombian Andes.';
quotes[4] = 'The botanical name for the cacao tree is ‘Theobroma’. Derived from the Greek, this means ‘Food of the Gods’.';
quotes[5] = 'The Aztecs believed chocolate was an aphrodisiac and banned women from consuming it.';
quotes[6] = 'Chocolate is said to improve your mood by increasing your serotonin levels.';
quotes[7] = 'Taxes to Aztec emperors were paid in cacao beans.';
quotes[8] = 'Chocolate contains phenylethylamine, a naturally occurring amino-acid, which can trigger feelings similar to those felt when in love.';
quotes[9] = 'In 1624, Johan Franciscus Rauch, an Austrian professor, tried to ban chocolate from monasteries as he said it ‘inflamed passions’. ';
quotes[10] = 'Cacao beans were originally made into a bitter chocolate drink by the Aztecs which they served in golden goblets.';
quotes[11] = 'Chocolate contains antioxidants which may help prevent cancer and heart disease.';

 
function start() {
	//addAlt();	 disable for now 
	imageTitles();
	clearCurrentLink();

}

function clearCurrentLink(){
    var a = document.getElementsByTagName("A");
    for(var i=0;i<a.length;i++)
        if(a[i].href == window.location.href.split("#")[0])
            removeNode(a[i]);
}

function removeNode(n){
    if(n.hasChildNodes())
        for(var i=0;i<n.childNodes.length;i++)
            n.parentNode.insertBefore(n.childNodes[i].cloneNode(true),n);
			
	    n.parentNode.removeChild(n);
}
function imageTitles(){
    var img = document.getElementsByTagName("img");
    for(var i=0;i<img.length;i++)
	{
        if(img[i].alt!='')			
            img[i].title=img[i].alt;
		 img[i].galleryimg="no"
	}
}


function addAlt() {

	var images = document.getElementsByTagName('img');
	var alt='';
	var img;
	var myjs;
	for (var n = 0; n < images.length; n++)
		{
			  if(!images[n].alt =='')
				{
					img=images[n];
					alt=img.alt;
					img.alt='';
					myjs = 'return overlib(\'' + alt + '\');';
					img.onmouseover=new Function(myjs)
					img.onmouseout=new Function("return nd();");
				}                                                           
		}
}


//Load random images
function LoadImages(lower, upper, imagecount, path)
{
	imgs = new Array(1);
		
	for (i=1;i<=images.length; i++)
		{
			if(i>=lower && i<=upper)
			imgs[i] = images[i];
		}

	//randomise the array
	imgs.sort(function() {return 0.5 - Math.random()}) ;//Array elements now scrambled - and zero-based
	
	for(i=1;i<=imagecount;i++)
	{
		img=MM_findObj('img'+i);		
		img.src = path + 'images/photos/' + imgs[i-1];
	}
}

//Load random quote
function LoadQuote()
{
	
	MM_setTextOfLayer('randquote', 0, quotes[8]);
	//randomise the array
	quotes.sort(function() {return 0.5 - Math.random()}) ;//Array elements now scrambled - and zero-based
	
	MM_setTextOfLayer('randquote', 0, quotes[1]);
	
}


//unamended standard functions

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

