var newTabsPath = "stonecalcbuttons/";
var quo = "'";

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImagesX() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImagesX.arguments.length; i+=2) {
			//alert(changeImagesX.arguments[i]);
			//alert(newTabsPath+changeImagesX.arguments[i+1])
			document[changeImagesX.arguments[i]].src = newTabsPath+changeImagesX.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		over_home1 = newImage('stonecalcbuttons/overbegin1.jpg');
		over_basic1 = newImage('stonecalcbuttons/overpavelocproject1.jpg');
		over_border1 = newImage('stonecalcbuttons/overborder1.jpg');
		over_circle1 = newImage('stonecalcbuttons/overcircle1.jpg');
		over_base1 = newImage('stonecalcbuttons/overbase1.jpg');
		over_calcs1 = newImage('stonecalcbuttons/overcalculate1.jpg');
		over_blank = newImage('stonecalcbuttons/overblankredbutton.jpg');
		Help_Tab = newImage('stonecalcbuttons/Help1.jpg');
		preloadFlag = true;
	}
}

preloadImages();

function writePageTop (mode,page) {

var img1,img2,img3,img4,img5,img6;
var href1,href2,href3,href4,href5,href6;

var img = new Array
var href = new Array

for(i=0;i<9;i++)
	img[i] = "blankredbutton.jpg";

if (mode == "A") {
	img[1] = "begin1.jpg";
	href[1] = "start.html";
	img[2] = "pavelocproject1.jpg";
	href[2] = "field.html";
	img[3] = "border1.jpg";
	href[3] = "border.html"
	img[4] = "circle1.jpg";
	href[4] = "circle.html";
	img[5] = "base1.jpg";
	href[5] = "baseMaterials.html";
	img[6] = "calculate1.jpg";
	href[6] = "final.html";
	img[7] = "help1.jpg";
	href[7] = "faq.html";
}
else if (mode == "B") {
	img[1] = "begin1.jpg";
	href[1] = "start.html";
	img[2] = "customproject1.jpg";
	href[2] = "custom.html";
	img[3] = "border1.jpg";
	href[3] = "border.html"
	img[4] = "circle1.jpg";
	href[4] = "circle.html";
	img[5] = "base1.jpg";
	href[5] = "baseMaterials.html";
	img[6] = "calculate1.jpg";
	href[6] = "final.html";
	img[7] = "help1.jpg";
	href[7] = "faq.html";
}
else if (mode == "C") {
	img[1] = "begin1.jpg";
	href[1] = "start.html";
	img[2] = "circle1.jpg";
	href[2] = "circle.html";
	img[3] = "base1.jpg";
	href[3] = "baseMaterials.html";
	img[4] = "calculate1.jpg";
	href[4] = "final.html";
	img[5] = "help1.jpg";
	href[5] = "faq.html";
}
else if (mode == "D") {
	img[1] = "begin1.jpg";
	href[1] = "start.html";
	img[2] = "retainingwall1.jpg";
	href[2] = "wall.html";
	img[3] = "base1.jpg";
	href[3] = "baseMaterials.html";
	img[4] = "calculate1.jpg";
	href[4] = "final.html";
	img[5] = "help1.jpg";
	href[5] = "faq.html";
}


	document.write('<A href="http://www.paveloc.com"><IMG height="85" width="700" src="stonecalcbuttons/header.jpg" border = "0" alt=""/></A>');

	document.write('<TABLE width="700" height = "41" border="0" cellspacing="0" cellpadding="0">');
	document.write('<TR>');
	i = 1
	document.write('<TD valign="top" align="left" width ="100" height="41" xpos="0"><A onmouseover="changeImagesX('+quo+img[i]+quo+','+quo+'over'+img[i]+quo+');return true" onmouseout="changeImagesX('+quo+img[i]+quo+','+quo+img[i]+quo+');return true" href='+href[i]+'><IMG src="stonecalcbuttons/'+img[i]+'" alt="" name="'+img[i]+'" border="0"></A></TD>');		
	for(i=2;i<8;i++) {
		if (img[i] == "help1.jpg") {
			document.write('<TD width ="100" height="41" valign="top" align="left" xpos="0"><A target="_blank" href='+href[i]+'><IMG src="stonecalcbuttons/'+img[i]+'" onmouseover="changeImagesX('+quo+img[i]+quo+','+quo+'over'+img[i]+quo+');return true" onmouseout="changeImagesX('+quo+img[i]+quo+','+quo+img[i]+quo+');return true" alt="" name="'+img[i]+'" border="0"></A></TD>');		
		}
		else {
		if (i == page)
				document.write('<TD width ="100" height="41" valign="top" align="left" xpos="0"><A onclick="return SaveCookies();" href='+href[i]+'><IMG src="stonecalcbuttons/over'+img[i]+'" alt="" name="'+img[i]+'" border="0"></A></TD>');
			else
				document.write('<TD width ="100" height="41" valign="top" align="left" xpos="0"><A onclick="return SaveCookies();" onmouseover="changeImagesX('+quo+img[i]+quo+','+quo+'over'+img[i]+quo+');return true" onmouseout="changeImagesX('+quo+img[i]+quo+','+quo+img[i]+quo+');return true" href='+href[i]+'><IMG src="stonecalcbuttons/'+img[i]+'" alt="" name="'+img[i]+'" border="0"></A></TD>');		
		}
	}
	document.write('</TR>');
	document.write('</TABLE>');
	
	/*document.write('<TR height="1" cntrlrow>');
	document.write('<TD width="110" height="1"><SPACER type="block" width="110" height="1"></TD>');
	document.write('<TD width="110" height="1"><SPACER type="block" width="110" height="1"></TD>');
	document.write('<TD width="110" height="1"><SPACER type="block" width="110" height="1"></TD>');
	document.write('<TD width="110" height="1"><SPACER type="block" width="110" height="1"></TD>');
	document.write('<TD width="110" height="1"><SPACER type="block" width="110" height="1"></TD>');
	document.write('<TD width="110" height="1"><SPACER type="block" width="110" height="1"></TD>');
	document.write('<TD width="1" height="1"></TD>');
	document.write('</TR>');*/


}
