

function popUp(URL, width, height) 
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + width + ",height=" + height + ",left = 490,top = 362');");
}

function SmallImageChanged($subdir)
{	
	document.getElementById("smlImg").src="../pictures/" + $subdir + document.getElementById("filenamesmall").value;
}

function LargeImageChanged($subdir)
{	
	document.getElementById("lgeImg").src="../pictures/" + $subdir + document.getElementById("filenamelarge").value;
}

function PopupImage()
{
	alert("over!");
}

var $picsPerPage = 10;

function GetNoOfPages($numberofPics)
{
	return Math.round($numberofPics / $picsPerPage);
}

function LayoutPageLinks($pages, $currentPage, $selectID)
{
	var linksstring = "";

	for(var index = 0; index < $pages; index++)
	{
		var linkNo = index + 1;

		if(linkNo != $currentPage)
		{
			linksstring += "<a onclick='Picker(&#39;" + $selectID + "&#39;, &#39;" + linkNo + "&#39;)' style='cursor:pointer;'>Page " + linkNo + "</a>";
		}
	}

	return linksstring;
}

function LayoutImages($page, $list, $selectID)
{
	var picsindexfrom = (($page * $picsPerPage) - $picsPerPage);
	var picsindexto = (picsindexfrom + $picsPerPage) - 1;
	var noOpts = $list.options.length;
	if(picsindexto > (noOpts - 1)) picsindexto = (noOpts - 1);

	var index = 0;
	var column = 0;
	var tableString = "";

	tableString = "<table border='1'>";

 	for (index=picsindexfrom;index<picsindexto + 1;index++)
	{
		var x = $list.options[index].text;
		if(x != "") 
		{
			if(column==0)
			{
				tableString += "<tr>";
			}
			tableString += "<td>" + column + "<a onclick='Picked(&#39;" + $selectID + "&#39;,&#39;" + x + "&#39;)' style='cursor:pointer;'><img src='../pictures/" + x + "' width='150px' /></a></td>";
		
			column++;
		}
		else
		{
			tableString += "<td>empty " + column  + "</td>"
		}	

		if(column==5)
		{
			tableString += "</tr>";
			column=0;
		}
	}

	if(tableString.substr(-5) != "</tr>") tableString += "</tr>";

	tableString += "</table>";

	return tableString;

}