rendered paste body function pageRequest(url,shift) {
var maincont = document.getElementById("maincont");
try
{
maincont.removeChild(document.getElementById("gallerytbl"));
}
catch(e){}
page=page+shift;
document.getElementById("pagenum").innerHTML="page "+page+" of "+pagecnt;
if(page<=1){
document.getElementById("back").style.visibility="hidden";
}else{
document.getElementById("back").style.visibility="visible";
}
if(page>=pagecnt){
document.getElementById("next").style.visibility="hidden";
}else{
document.getElementById("next").style.visibility="visible";
}
var httpRequest;
if (window.XMLHttpRequest) { // Mozilla
httpRequest = new XMLHttpRequest();
}
else if (window.ActiveXObject) { // IE
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {}
}
}
if (!httpRequest) {
alert('Cannot create an XMLHTTP instance');
return false;
}
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
if (document.implementation && document.implementation.createDocument)
{
xmlDoc = document.implementation.createDocument("", "", null);
}
else if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function () {
if (xmlDoc.readyState == 4) fillList()
};
}
else
{
alert('Your browser can\'t handle this script');
return;
}
var tbl = document.createElement("table");
tbl.setAttribute("id","gallerytbl");
var tblBody = document.createElement("tbody");
var hitend=0;
xmlDoc=httpRequest.responseXML;
for (i=0; i < 9; i++){
if(i < xmlDoc.firstChild.childNodes.length){
if((i%3)==0){
var row = document.createElement("tr");
//alert(i);
}
var cell = document.createElement("td");
var a = document.createElement("a");
a.setAttribute("id","img"+(i+1)+"lnk");
a.setAttribute("src","data/"+galleryid+"/tb_"+xmlDoc.firstChild.childNodes[i].nodeName);
a.setAttribute("href","data/"+galleryid+"/"+xmlDoc.firstChild.childNodes[i].nodeName);
a.style.visibility="visible";
a.setAttribute("rel","lightbox[group]");
if(xmlDoc.firstChild.childNodes[i].childNodes.length>0){
a.setAttribute("title",xmlDoc.firstChild.childNodes[i].firstChild.nodeValue);
}else{
a.setAttribute("title"," ");
}
var img = document.createElement("img");
img.setAttribute("id","img"+(i+1));
img.setAttribute("src","data/"+galleryid+"/tb_"+xmlDoc.firstChild.childNodes[i].nodeName);
a.appendChild(img)
cell.appendChild(a);
row.appendChild(cell);
if(((i-1)%3)==0)
{
tblBody.appendChild(row);
}
if(i==8)
{
var hitend=1;
tbl.appendChild(tblBody);
maincont.insertBefore(tbl,document.getElementById("caption_pagenum"));
}
}else{
if((hitend==0)&&((i%3)==0)&&(i!=0)){
var hitend=1;
tblBody.appendChild(row);
tbl.appendChild(tblBody);
maincont.insertBefore(tbl,document.getElementById("caption_pagenum"));
}
if(hitend!=1){
var cell = document.createElement("td");
var a = document.createElement("a");
a.setAttribute("id","img"+(i+1)+"lnk");
a.setAttribute("href","");
a.style.visibility="hidden";
a.setAttribute("title","");
var img = document.createElement("img");
img.setAttribute("id","img"+(i+1));
img.setAttribute("src","");
a.appendChild(img)
cell.appendChild(a);
row.appendChild(cell);
}
}
myLightbox.updateImageList();
}
} else {
alert('Request Failed.');
}
}
};
httpRequest.open('GET', url+page+"&galleryrqnm="+galleryid, true);
httpRequest.send('');
}