// JavaScript Document

//* SIMPLE loading of images and links from common source file*//
//* this is for the featured business  image page //
var x=0
var entries=0
var alpha="" //* not needed in this  display
var entry="" 
var name="" 
var tel="" 
var xlink =""
var des2 = "" //* not needed in this  display
var piccie = ""

//* establish the number of entries to read from the data file..  value is first entry in first line of data *//
if (x==0)
{
		var entries=matrix[x][0]
//* got the number of entries so start reading the data at record #1 *//
//		var x=1
}

//* read from the data array *//	
//while (x<=entries) 
//	{
//	entry=matrix[x][1]
//	name=matrix[x][2]
//	tel=matrix[x][3]
//	xlink=matrix[x][4]
//	piccie=matrix[x][5]
		
//*		document.write("<td width=10%>"  + xlink + "</td> ")                //* to prove the load works ok
//*		document.write("<td width=15%><img src='images/rpiccie'></td></tr>") 


//* and now for the next one... *//
//		x=x+1
//
//	}

	var ry=Math.floor(Math.random()*entries)
	
	if(ry==0) {
	ry=1
	}
	
	var rentry=matrix[ry][1]
	var rname=matrix[ry][2]
	var rtel=matrix[ry][3]
	var rxlink=matrix[ry][4]
	var rpiccie=matrix[ry][5]
	var ralt=rtel.substr(5,5)+" "+rtel.substr(10,3)+" "+rtel.substr(13)
		
	
	document.write("<td align=center>"+rname+"</td></tr>")	
			
	if (rxlink.substr(0,4)=="mail") {
		document.write("<td width='100 align='center'><a href='mailto:"+rxlink.substr(5)+"'><img src='"+rpiccie+"' border='0' width='100' ></a></td>")
		}
		else {
		
		if (rxlink.substr(0,4)=="site") {
		document.write("<td width=100 align=center><a href='http://"+rxlink.substr(5)+"' target='Main'><img src='"+rpiccie+"' border='0' width='100'></a></td>")
			}
			else {
			document.write("<td width=100 align=center><a href='callto:+44"+rtel.substr(6)+"'><img src='"+rpiccie+"' border='0' width='100' alt='"+ralt+"'></a></td>")
			}
		}
		
	document.write("</tr><tr><td align=center>"+rentry+"</td></tr>")	
	document.write("</tr><tr><td align=center><font color='#cccccc' size='1'>"+ry+"/"+entries+"</font></td></tr>")	


