		function clearText(thefield){
		if (thefield.defaultValue==thefield.value)
		thefield.value = ""
		} 
				// original content taken from Nic's JavaScript Page with permission
// lack of these three lines will result in copyright infringment
// made by: Nic's JavaScript Page - http://www.javascript-page.com

function initArray() {

this.length = initArray.arguments.length;
  for (var i = 0; i < this.length; i++) {
  this[i] = initArray.arguments[i];
  }
}

link = new initArray(
"http://www.mercia-group.co.uk/marketing_support/totalSOLUTION.htm",
"http://www.mercia-group.co.uk/technical_manuals/paperless_audit.htm",
"http://www.mercia-group.co.uk/technical_support/compliance_reviews.htm",
"http://www.mercia-group.co.uk/technical_manuals/specialist_assignments.htm",
"http://www.mercia-group.co.uk/training/webinars.htm",
"http://www.mercia-group.co.uk/technical_support/options.htm"
);

image = new initArray(
"http://www.mercia-group.co.uk/images/index-advert.gif",
"http://www.mercia-group.co.uk/images/index-paperless.gif",
"http://www.mercia-group.co.uk/images/index-quality.gif",
"http://www.mercia-group.co.uk/images/index-specialist.gif",
"http://www.mercia-group.co.uk/images/index-webinars.gif",
"http://www.mercia-group.co.uk/images/indextechnical.gif"
);

text = new initArray(
"Would you like a maintenance free website for your firm?",
"Are you ready to adopt Paperless Audit?",
"Would you benefit from an external Audit Quality Review?",
"Are you managing the risk of Specialist Assignments?",
"Do you want to find out more about our one hour Webinars?",
"Have you registered to use our Technical Support Service?"
);


var interval = 5; // delay between rotating images (in seconds)
interval *= 1000;

function rotateImage() {
	var currentdate = new Date();
	var core = currentdate.getSeconds() % image.length;
	var ranlink  = link[core];
	var ranimage = image[core];
	var rantext  = text[core];
	document.getElementById('ranImg').alt = rantext;
	document.getElementById('ranImgLink').href = ranlink;
	blendimage('ranImgDiv','ranImg', ranimage,500);
	setTimeout("rotateImage()", interval);
}

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}