<!-- 
/****************************************************
*			    	General Routines
*             ==================
*            (c) Adrian Jones, woodsgood.ca
*****************************************************/

 var d=document,iW=0,iH=0;
 
// returns the "name" Object
function getObject(name) {return (document.getElementById?document.getElementById(name):document.all?document.all[name]:document.layers?eval("document.layers[\"" + name + "\"]"):null); }

/* Function to write image and external link into a cell */

function doWriteImage2Cell(pN,iN,oP) {
	pN=Number(pN);iN=Number(iN);
	var imageList=eval(imageRef[pN][pName]);		// name of image array
	var cT="",imgList=imageRef[pN][pImages].split(" "),iRef=imgList[iN-1];
//	alert(imageList[iRef][iLink]);
	var iM=(imageList[iRef][iLink].indexOf("jpg")>0)?true:false;
	var iRoot=(iM)?imageRoot:"";		//change root if not image
	
	cT += '<div align="center">';
	cT += '<a href="'+iRoot+imageList[iRef][iLink] + '" ';
	if (iM) cT+= 'rel="lightbox[photos]" ';
	if (iM) cT += ' title="Ottawa Photographer Alan Dean - '+imageList[iRef][iTitle]+'"';
	cT += '>';
	cT += '<img src="'+imageRoot+imageList[iRef][iLoc] + '" alt="' + imageList[iRef][iTitle] + '" ';
	cT += '" title="'+imageList[iRef][iTitle] + '" width="'+imageRef[pN][pWidth]+'" height="'+imageRef[pN][pHeight]+'" border="0">';
	cT += '</a>';
	cT += '</div>';
	cT += (imageList[iRef][iCaption]!="")?'<div class="imgTitle">' + imageList[iRef][iCaption] + '</div>':'';
	if(!oP) d.write(cT);
	iW=imageRef[pN][pWidth];iH=imageRef[pN][pHeight];
	return cT;
}


/* Function to write logo and link information into a cell */
function doWriteContactImage(inTxt,oP) {
	var cT="";
	cT += '<div align="center" valign="middle">';
	//cT += '<a href="index.php"><img src="images/alandean2.jpg" width="138" height="110" border="0"></a>';
	cT += '<a href="mailto:alandean@magma.ca"><img src="images/alandean2.jpg" width="138" height="110" border="0"></a>';
	cT += '<br>';
	cT += '<a href="mailto:alandean@magma.ca"><img src="images/cinfosmall.jpg" width="164" height="41" border="0"></a>';
	cT += '</div>';
	cT += '<div class="cText" style="width:' + iW + 'px;">' + inTxt +'</div>';
	if(!oP) d.write(cT);
	return cT;
}

function doWriteSubHeader(pRef,pNum) {
	var sT="";
	sT += '<div id="pageSubHeader">&nbsp;' + pageName[pRef][pNum] + '&nbsp;</div>';
	d.write(sT);
}

/* Function to write out link text on page */
function doWriteLinks(lRef) {
	var cT="",nL=(linksRef[lRef].length)/2;
	if (linksRef[lRef][0]=="") return;
	cT += '<table border="0" align="center" cellpadding="3" cellspacing="5" align="center" width="800">';
	cT += '<tr><td align="center">';
	cT += '<div class="linksBox">';
	for(x=0;x<nL;x++) {
		var lt=linksRef[lRef][2*x],lk=linksRef[lRef][2*x+1];
		cT += (lk!="")?'<a href="' + lk +'">':'';
		cT += '<span class="lText">' + lt + '</span>';
		cT += (lk!="")?'</a>':'';
		cT += (x!=(nL-1))?'<span class="lText"> - </span>':'';
	}
	cT += '</div></td></tr></table>';
	d.write(cT);
}

/* Function to write image and external link into a cell */
function doWriteText2Cell(pN) {
	var pRef=Number(pN),tT="";
	for(x=0;x<pageText[pRef].length;x++) {
		tT += '<p class="lTxt">' + pageText[pRef][x] + '</p>';
	}
	d.write(tT);
}


function doMainPage(gNum,pRef,pNum,cText) {
	var mT="",iS=8*(Number(pNum)-1);
	mT += '<table border="0" cellpadding="3" cellspacing="4" align="center">';
	mT += '<tr>';
	mT += '<td width="188" rowspan="3">';
		for(x=0;x<pageText[pRef].length;x++) {
			mT += '<p class="lTxt">' + pageText[pRef][x] + '</p>';
		}
	mT + '</td>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+1,true) + '</td>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+2,true) + '</td>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+3,true) + '</td>';
    mT += '<td width="188" rowspan="3" valign="top">';
    mT += '<div class="click">Click any image <br> to enlarge</div>';
    mT += '<hr width="80%">';
    for (x=0;x<pageName[pRef].length;x++) {
    	mT+='<div class="pages"><a href="' + location.pathname + '?page=' + x +'">' + pageName[pRef][x] + '</div>';
    }
    mT += '</td>';
    mT += '</tr>';

    mT += '<tr>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+4,true) + '</td>';
    mT += '<td>' + doWriteContactImage(cText,true) + '</td>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+5,true) + '</td>';
    mT += '</tr>';

    mT += '<tr>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+6,true) + '</td>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+7,true) + '</td>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+8,true) + '</td>';
    mT += '</tr>';
    mT += '</table>';
	d.write(mT);
}

function doMainPage2(gNum,pRef,pNum,cText) {
	var mT="",iS=8*(Number(pNum)-1);
	mT += '<table border="0" cellpadding="3" cellspacing="4" align="center">';
	mT += '<tr>';
	mT += '<td width="188" rowspan="3">';
		for(x=0;x<pageText[pRef].length;x++) {
			mT += '<p class="lTxt">' + pageText[pRef][x] + '</p>';
		}
	mT + '</td>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+1,true) + '</td>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+2,true) + '</td>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+3,true) + '</td>';
    mT += '<td width="188" rowspan="3" valign="top">';
    mT += '<div class="click">Click any image <br> to enlarge</div>';
    mT += '<hr width="80%">';
    for (x=0;x<pageName[pRef].length;x++) {
    	mT+='<div class="pages"><a href="' + location.pathname + '?page=' + x +'">' + pageName[pRef][x] + '</div>';
    }
    mT += '</td>';
    mT += '</tr>';

    mT += '<tr>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+4,true) + '</td>';
    mT += '<td>' + doWriteContactImage(cText,true) + '</td>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+5,true) + '</td>';
    mT += '</tr>';

    mT += '<tr>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+6,true) + '</td>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+7,true) + '</td>';
    mT += '<td>' + doWriteImage2Cell(pRef,iS+8,true) + '</td>';
    mT += '</tr>';
    mT += '</table>';
	d.write(mT);
}


-->

