var theImages = new Array()

//Random-loading images
theImages[0] = '../htmlresources/images/phrase1.gif' // replace with names of images
theImages[1] = '../htmlresources/images/phrase2.gif' // replace with names of images
theImages[2] = '../htmlresources/images/phrase3.gif' // replace with names of images
theImages[3] = '../htmlresources/images/phrase4.gif' // replace with names of images

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


function showImage(){


var x = readCookie("myquotes");

if(x)
{
if(whichImage==0){
document.write('<a href ="#"><img src="'+theImages[whichImage]+'" border=0 width=202 height=415></a>');
}
else if(whichImage==1){
document.write('<a href ="#"><img src="'+theImages[whichImage]+'" border=0 width=202 height=415></a>');
}
else if(whichImage==2){
document.write('<a href ="#"><img src="'+theImages[whichImage]+'" border=0 width=202 height=415></a>');
}
else if(whichImage==3){
document.write('<a href ="#"><img src="'+theImages[whichImage]+'" border=0 width=202 height=415></a>');
}
else if(whichImage==4){
document.write('<a href ="#"><img src="'+theImages[whichImage]+'" border=0 width=202 height=415></a>');
}

} else
{
document.write('<a href ="#"><img src=images/phrase1.gif border=0 width=202 height=415></a>');
createCookie("myquotes","tam",1)
}

}
