var dd = window.location; 
dd=dd.toString(); 
var dd_array= dd.split("=");
if(dd_array.length==1){urlname=0;}
else{urlname=dd_array[dd_array.length-1];}
if (urlname>=imageNumber){urlname=0;}
ActiveVar = 0;	// Sets up the variable that counts the pictures.
var s = new Album();
var ActiveArray = new Array()	// Sets up the active array.
passvalue=0;

for (loop=0; loop < imageNumber; loop++) {
  ActiveArray[ActiveVar++] = new Array(imageArray[loop][0], imageArray[loop][1], imageArray[loop][2], imageArray[loop][3], imageArray[loop][4]);
}
pno=urlname/18+1;
if(imageNumber%18>0){
var totalpno=Math.ceil(imageNumber/18,0) ;
//alert(Math.ceil(imageNumber/18,0));
}else{
var totalpno=imageNumber/18;
}
document.write('<table border=0 width="90%"><tr valign="middle" height="20"><td align=right colspan=2 ><p><font size="2+" color="#000088">Page '+pno +' of '+ totalpno +'.</p></td></tr></table>');

document.write('<div style="visibility: hidden;"> <TABLE><tbody> ');
for(loop=urlname; loop < ActiveVar; loop++) {
  if(loop%3==0){	document.write(' <tr> '); }

document.write(' <td><div id="p'+loop+'" class="hover_profile" style="position: absolute; overflow: hidden; left: 651px; top: 151px; visibility: hidden;"> ');
document.write('   <table><tbody><tr> ');

document.write('   	<td valign="top"><a href="" class="P"><img src="'+ActiveArray[loop][1]+'" id="new_but'+loop+'" border="0"> </a></td> ');
document.write(' 	<td> ');
document.write(' 		<table border="0"><tbody> ');
document.write(' 		  <tr> ');
document.write(' 			<td width="6"></td> ');
x=new Image;x.src=ActiveArray[loop][2];iw=x.width;ih=x.height;
document.write(' 			<td class="text_label"> '+ActiveArray[loop][3]+' <br>');
// Image Dimensions='+iw+'*'+ih+'</td> ');

document.write(' 		  </tr> ');
document.write(' 		</tbody></table> ');
document.write(' 	</td> ');
document.write('  </tr></tbody></table></div></td> ');
 if((loop+1)%3==0){	document.write(' </tr> '); }
 if((loop+1)%18==0&&loop!=0){break;}
}
document.write(' </tbody></table></div> ');



function ViewImage(path){
window.open(path,"", "dependent, scrollbars=yes, resizable=yes, width=550, height=400, left=150,top=150");
}
temp=0;
if(ActiveVar%3!=0){temp = 3 - ActiveVar%3;ActiveVar=ActiveVar+3-ActiveVar%3;}

document.write(' <table border="6" width="100%" cellpadding="0" cellspacing="2" bgcolor="#e0ffe0" style="border-top: solid green; border-right: solid green; border-bottom: solid green; border-left:solid green;border-width: thick thick;"> ');
for(loop=urlname; loop < ActiveVar; loop++) {

	if((loop)%3==0){
		document.write(' <tr valign="middle" height="120"> '); 
	}
	if(loop==ActiveVar-temp && temp>0){
		for(k=0;k<temp;k++){
			document.write('<td> &nbsp;</td>');
		}
		document.write('</tr>');break;
	}else{
	document.write('   <div><td id="newsimage" align="center" width="32%" class="photo_square"><table border="0" cellpadding="0" cellspacing="0" width="100%" height=100%><tr valign="middle"><td colspan=2 align="center"> ');
	document.write('   	<a href="javascript:onClick=ViewImage('+"'"+ActiveArray[loop][2]+"'"+')"  class="P" > ');
	document.write(' 	<img src="'+ActiveArray[loop][0]+'" id="but'+loop+'" border="0" onmouseover="s.showProfile('+"'p"+loop+"'"+', this);" onmouseout="s.hideProfile('+"'p"+loop+"'"+');"></a>');
y=new Image;y.src=ActiveArray[loop][2];iw=y.width;ih=y.height;
	document.write('</td></tr><tr valign="bottom"><td align="right" class="sub2heading" width=40%>Date:</td><td align="left" class="sub2heading">'+ActiveArray[loop][4]+'</td></tr></table></td></div>');
	if( (loop+1)%3==0){	document.write(' </tr> '); }
	}
 passvalue=loop+1;
 if((loop+1)%18==0&&loop!=0){break;}
}
document.write(' </tbody></table> ');
ppassval=urlname-18;
if(ppassval<0)ppassval=0;
document.write('<table border=0 align="center" width="100%"><tr><td align=left>');
document.write('<table border=0 align="left"><tr valign="middle" height="20" class="newlnk"><tr><td align=left>');

if(pno!=1){
	document.write('<a id="news1" href="album.htm?spc='+passvalue+'" ><img src="images/prv.gif" border=0></a></td><td align=left><a id="news1" href="album.htm?spc='+ppassval+'">Previous</a>');
}
else{
	document.write('&nbsp;');
}
document.write('</td></tr></table>');
document.write('<table border=0  align="right"><tr valign="middle" height="20" class="newlnk"><tr><td align=left>');

if(pno != totalpno){
	document.write('<a id="news1" href="album.htm?spc='+passvalue+'">Next</a></td><td align=right>	<a id="news1" href="album.htm?spc='+passvalue+'" ><img src="images/nxt.gif" border=0></a>');
}
else{
	document.write('&nbsp;');
}
document.write('</td></tr></table>');

document.write('</td></tr></table>');


