function DisplayScreenshot(pageNo)
{
	var xmlDoc;
	
	try //Internet Explorer
	{
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	}
	catch(e)
	{
		try //Firefox, Mozilla, Opera, etc.
		{
			xmlDoc=document.implementation.createDocument("","",null);
		}
		catch(e)
		{
			alert(e.message);
			return;
		}
	}
	
		
	xmlDoc.async=false;
	xmlDoc.load("XML/wallpaper.xml");
	
	var fileElements = xmlDoc.getElementsByTagName("WALLPAPER");
	var output = '';
	var totalPerPage = 6;
	
	var totalNo = fileElements.length;
	var maxNoOfPage = Math.ceil(totalNo/totalPerPage);
	var firstIdx = (pageNo-1)*totalPerPage;
	var lastIdx		= firstIdx + 5;
	if(lastIdx >= totalNo)
	{
		lastIdx = totalNo - 1;
	}
	
	output += '<table width="100%" border="0px" cellpadding="0" cellspacing="0">\n';
	output += '<tr>\n';
	var curIdx = firstIdx;
	var columnIdx = 0;
	while(curIdx <= lastIdx)
	{
		var nameElement 		= fileElements[curIdx].getElementsByTagName("FILE_NAME")[0];
		var size1Element 		= fileElements[curIdx].getElementsByTagName("SIZE1")[0];
		var size1NameElement 	= fileElements[curIdx].getElementsByTagName("SIZE1_FILE_NAME")[0];
		var size2Element 		= fileElements[curIdx].getElementsByTagName("SIZE2")[0];
		var size2NameElement 	= fileElements[curIdx].getElementsByTagName("SIZE2_FILE_NAME")[0];

		var fileName		= nameElement.childNodes[0].nodeValue;
		var size1 			= size1Element.childNodes[0].nodeValue.split(",");
		var size1FileName	= size1NameElement.childNodes[0].nodeValue;
		var size2 			= size2Element.childNodes[0].nodeValue.split(",");
		var size2FileName	= size2NameElement.childNodes[0].nodeValue;

		output += '	<td align="left" valign="top" width="33%" >\n';
		output += '		<div class="wallpaper_imgShadow"><a href="images/download/wallpaper/' + fileName + '" rel="lytebox[wallpaper]" onMouseDown="myLytebox.start(this);">\n';
		output += '			<img src="images/download/wallpaper/' + fileName + '"  border="0" alt="' + fileName + '" width="140px" height="105px" />\n';
		output += '		</a></div>\n';
		output += '		<div class="wallpaper_imgDownload" align="left" >\n';
		output += '			&nbsp;<img src="images/download/wallpaper_btn.gif" border="0"/>\n';
		output += '			<a href="download/wallpaper/' + size1FileName + '" target="_blank">\n';
		output += '				' + size1[0] + ' X ' + size1[1] + '\n';
		output += '			</a>\n';
		output += '			&nbsp;&nbsp;\n';
		output += '			<a href="download/wallpaper/' + size2FileName + '" target="_blank">\n';
		output += '				' + size2[0] + ' X ' + size2[1] + '\n';
		output += '			</a>\n';
		output += '		</div>\n';
		output += '		<br />\n';
		output += '	</td>\n';
		
		if(columnIdx == 2)
		{
			output += '</tr><tr>';
		}
		
		++curIdx;
		++columnIdx;
	}
	output += '</tr>\n';
	output += '<tr><td colspan="3" align="center">\n';
	output += '<BR /><BR /><BR />\n';
	
	
	// ---------- page number display ----------- //
	//Display the first page	
	if(pageNo != 1)
	{
		output += '<span style="color:#333333;text-weight:bold;text-decoration:none;cursor:pointer;" onMouseUp="DisplayScreenshot(1);">';
		output += 'First :</span>\n';
	}
			
	//Display the previous page
	if(pageNo > 1)
	{
		output += '<span style="color:#666666;text-weight:bold;text-decoration:none;cursor:pointer;" onMouseUp="DisplayScreenshot(' + (pageNo-1) + ');">';
		output += '&gt;&gt; Previous</span>\n';
	}
	
	//Display the page number
	var i = 1;
	while(i<=maxNoOfPage)
	{			
		if(i == pageNo)
		{
			output += '<b><u>' + i + '</u></b>';
		}
		else
		{
			output += '<span style="color:#666666;text-weight:bold;text-decoration:none;cursor:pointer;" onMouseUp="DisplayScreenshot(' + i + ');">';
			output += i + '</span>\n';
		}
		output += " | ";
		
		++i;
	}
	
	//Display the next page
	if(pageNo < maxNoOfPage)
	{
		output += '<span style="color:#666666;text-weight:bold;text-decoration:none;cursor:pointer;" onMouseUp="DisplayScreenshot(' + (pageNo+1) + ');">';
		output += '&gt;&gt; Next</span>\n';
	}

	//Display the last page
	if(pageNo != maxNoOfPage)
	{
		output += '<span style="color:#666666;text-weight:bold;text-decoration:none;cursor:pointer;" onMouseUp="DisplayScreenshot(' + maxNoOfPage + ');">';
		output += ': Last</span>\n';
	}
	
	output += '<BR /><BR /><BR />\n';
	output += '</td></tr>\n';
	output += '</table>\n';
	
	document.getElementById("wallpaperDiv").innerHTML = output;
}




