/************************************************************************

Description :  This function takes all of the images that are in the array 
and displays them in a table three wide

Variables   :argCounter = the number of values in the array of images

************************************************************************/


function getImageList(argCounter){
var iCounter = 1;
if (strDescription != ""){
	document.write('<TR><TD colspan=3 align="center">' + strDescription + '</td></tr>');
}




document.write('<TR><TD colspan=3 align="center"><font color="#0000CC"><i>Click on picture to view larger image</i></font><BR>&nbsp;</td></tr>');
for (x = 1; x <= argCounter; x++ ){
if (iCounter == 1) {
document.write('<tr>');
}

document.write('<td align="center" height="153" width="33%">');
document.write('<table border="3" bordercolordark="#400000" align="center" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" bordercolorlight="#FFFFFF">');
document.write('<tr>');
document.write('<td height="15"><a href="default.html?ID=' + x + '"><img src="thumbs/' + arrImages[x][2] + '" height="137" border="0"></a></td>');
document.write('</tr>');
document.write('</table>');
document.write('</td>');

if (iCounter == 3) {
document.write('</tr>');
iCounter = 1
}else{
iCounter = iCounter + 1;
}
}

for (y = iCounter; y <= 3; y++){
if (y = 3 ){
document.write('</tr>');
}else{
document.write('<TD>&nbsp;</TD>');
}
}

return;

}


/************************************************************************

Description :  Function used for pop up window to display picture and 
next previous button

Variables   :

************************************************************************/

function getImage(argCounter,argValue){

var query = location.search; //get the URL query string
var value = query.substring(query.indexOf("ID=") + 3, query.length); //get an ID if any
    value = parseFloat(value);   //convert the id to numeric


var back;
var next;
if (argValue > 0 ) {
if (argValue == 1 ){
back = argCounter;
next = argValue + 1
}else{
if (argValue == argCounter) {
next = 1;
back = argValue - 1;
}else{
back = argValue - 1;
next = argValue + 1;
}
}
}







document.write('<TR><TD><div align="center"><img src="images/' + arrImages[argValue][2] + '"><BR><BR>');
document.write('<font face=arial size=2><i>' + arrImages[argValue][1] + '</i></font><BR><BR><BR>');
document.write('<Table width="450" align="center">');
document.write('<TR>');

if (back == argCounter){
document.write('<TD align="left" width="150">&nbsp;</TD>');
}else{
document.write('<TD align="left" width="150"><a href="default.html?ID=' + back + '"><img src="/images/previous.gif" border="0"></a></TD>');
}
document.write('<TD align="center"><a href="default.html"><img src="/images/back.gif" border="0"></a></TD>');
if (next == 1){
document.write('<TD align="left" width="150">&nbsp;</TD>');
}else{
document.write('<TD align="right" width="150"><a href="default.html?ID=' + next + '"><img src="/images/next.gif" border="0"></a></TD>');
}

document.write('</TR>');
document.write('</table>');
document.write('</div></TD></TR>');

return;

}



function getPage(argCounter) {

//used for the next and previous button

var query = location.search; //get the URL query string
var value = query.substring(query.indexOf("ID=") + 3, query.length); //get an ID if any


if (value == ''){
getImageList(argCounter);
}else{
value = parseFloat(value);   //convert the id to numeric
getImage(argCounter,value)
}

}

function getMenuMap(){
document.write('<map name="main">');
document.write('  <area shape="rect" coords="603,25,701,59" href="/contact.html">');
document.write('  <area shape="rect" coords="465,23,586,59" href="/designs/">');
document.write('  <area shape="rect" coords="348,17,439,59" href="/basements/">');
document.write('  <area shape="rect" coords="239,27,322,59" href="/additions/">');
document.write('  <area shape="rect" coords="122,28,214,59" href="/bathrooms/">');
document.write('  <area shape="rect" coords="15,28,100,59" href="/kitchens/">');
document.write('</map> <map name="po">');
document.write('  <area shape="rect" coords="562,14,749,49" href="/">');
document.write('</map>');
}