//*--------------------------------------------------------
//* Display header image. First pic is random, next pics rotate.
//* Last image filename displayed is saved in a cookie.
//*--------------------------------------------------------                            
	var w 	= "205";
	var h	= "275";
	var pic	= "x-watch.jpg";  //* Default pics
	var hs	= "0";
	var vs	= "0";
	var border = "0";
//*------------------------------------ 
//*  Place images in array. 
//*------------------------------------
	var p=new Array(); 	
	var ix =-1;  
//	p[ix] = "x-watch.jpg"; 	
 

	p[ix = ix + 1] = "x-silouette-single.jpg"
	p[ix = ix + 1] = "x-standing-by-truck.jpg"
	p[ix = ix + 1] = "x-church-roof.jpg"
	p[ix = ix + 1] = "x-tarring-roof.jpg"
	p[ix = ix + 1] = "x-officeworker.jpg"
	p[ix = ix + 1] = "x-tar-flatroof.jpg"
	p[ix = ix + 1] = "x-worker-tiphat.jpg"
 	p[ix = ix + 1] = "x-wheelbarrow.jpg"
 	p[ix = ix + 1] = "x-production-order.jpg"
 	p[ix = ix + 1] = "x-four-on-roof.jpg"
 	p[ix = ix + 1] = "x-metal-sheet-measure.jpg"
 	p[ix = ix + 1] = "x-staplegun.jpg"
 	p[ix = ix + 1] = "x-row-of-trucks.jpg"
 	p[ix = ix + 1] = "x-metalwork.jpg"
 	p[ix = ix + 1] = "x-large-residential-roof.jpg"
 	p[ix = ix + 1] = "x-luxury-home-roof.jpg"
 	p[ix = ix + 1] = "x-roofer-staplegun.jpg"
 	p[ix = ix + 1] = "x-certainteed.jpg"
 	p[ix = ix + 1] = "x-caulking.jpg"
 	p[ix = ix + 1] = "x-soffit-fascia.jpg"
 	p[ix = ix + 1] = "x-metalworker.jpg"
 	p[ix = ix + 1] = "x-highrise-scaffold.jpg"
 	p[ix = ix + 1] = "x-siding.jpg"

// 	p[ix = ix + 1] = ""
 
 
	//p[ix = ix + 1] = "";
	var pcount =  p.length  // no. of array elments

	var picindex = getCookie("rowpic");  
  	if (picindex == null) {picindex = get_random(pcount); }  // get random pic the first time
 	picindex = parseInt(picindex);  // Converts string to a number
 	var iy = picindex + 1;
 	if (iy >= pcount) {iy = 0}; 
 	pic = p[iy];
 	
 	iy2 = iy + 1; 
 	if (iy2 >= pcount) {iy2 = 0}; 
 	pic2 = p[iy2];
 	
 	iy3 = iy2 + 1; 
 	if (iy3 >= pcount) {iy3 = 0}; 
 	pic3 = p[iy3]; 	
 	
 	iy4 = iy3 + 1; 
 	if (iy4 >= pcount) {iy4 = 0}; 
 	pic4 = p[iy4];  	
 	
 	
// 	pic = p[iy];
// 	pic2 = p[iy  + 1]; 
// 	pic3 = p[iy + 2]; 
 	setCookie("rowpic", iy); 
 
//<img src="../images/x-watch.jpg" width="260" height="59" border="0"><img src="../images/x-watch.jpg" width="260" height="59" border="0"><img src="../images/x-watch.jpg" width="260" height="59" border="0">

theRow = '<img src="../images/' +  pic + '" width="' + w + '" height="' + h + '" hspace="' + hs + '" vspace="' + vs + '" border="' + border + '" align="left"><img src="../images/' +  pic2 + '" width="' + w + '" height="' + h + '" hspace="' + hs + '" vspace="' + vs + '" border="' + border + '" align="left"><img src="../images/' +  pic3 + '" width="' + w + '" height="' + h + '" hspace="' + hs + '" vspace="' + vs + '" border="' + border + '" align="left"><img src="../images/' +  pic4 + '" width="' + w + '" height="' + h + '" hspace="' + hs + '" vspace="' + vs + '" border="' + border + '" align="left">'

document.write(theRow);

//alert(theRow)	
//document.write('<img src="../images/' +  pic + '" width="' + w + '" height="' + h + '" hspace="' + hs + '" vspace="' + vs + '" border="' + border + '" align="left"><img src="../images/' +  pic2 + '" width="' + w + '" height="' + h + '" hspace="' + hs + '" vspace="' + vs + '" border="' + border + '" align="left"><img src="../images/' +  pic3 + '" width="' + w + '" height="' + h + '" hspace="' + hs + '" vspace="' + vs + '" border="' + border + '" align="left"><img src="../images/' +  pic4 + '" width="' + w + '" height="' + h + '" hspace="' + hs + '" vspace="' + vs + '" border="' + border + '" align="left">');

function whichPic(count) {
//* Count is the number of itmems in the array - 1.
	count = count - 1;  //* because array is from [0] to [n]
    var ranNum= Math.round(Math.random()*  count );
    return ranNum;
}
	
function get_random(pcount) {
    var ranNum= Math.round(Math.random()* pcount);
    return ranNum;
}	

function setCookie(name, value, expires, path, domain, secure) {
//*******************************************************************************
// Generic rtn to set a cookie.
//*******************************************************************************
       var curCookie = name + "=" + escape(value) +
           ((expires) ? "; expires=" + expires.toGMTString() : "") +
           ((path) ? "; path=" + path : "") +
           ((domain) ? "; domain=" + domain : "") +
           ((secure) ? "; secure" : "");
       document.cookie = curCookie;
}
 
function getCookie(name) {
//*******************************************************************************
// Get a cookie.
//*******************************************************************************	
       var dc = document.cookie;
       var prefix = name + "=";
       var begin = dc.indexOf("; " + prefix);
       if (begin == -1) {
         begin = dc.indexOf(prefix);
         if (begin != 0) return null;
       } else
         begin += 2;
       var end = document.cookie.indexOf(";", begin);
       if (end == -1)
         end = dc.length;
       return unescape(dc.substring(begin + prefix.length, end));
     } 