function openIllustrationBank(idx)
{
	window.open("../Binariesbank/index_popup.asp?idx=" + idx,"Beelden_bank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=600, height=600")
}

function showmenu(elmnt)
{
	document.all(elmnt).style.visibility="visible"
}

function hidemenu(elmnt)
{
	document.all(elmnt).style.visibility="hidden"
}

function AddIllustration(previousBinaryId, binaryId, binaryFullPath, binaryFileName)
{
/*	'===============================================================
	'   NAME: 					AddIllustration
	'   CREATED ON: 			2004-07-21
	'   VERSION: 				1
	'   FUNCTION: 				Calls AddImageFieldset in the opener page
	'		IN:						imageOrderID - The 0-based order of the image in the imagelist. -1 indicates a new image
	'   IN: 					binaryID - ID of the image, for example 63
	'   IN: 					binaryFullPath - full path of the image, for example /Binaries/Images/63.jpg
	'   IN: 					binaryFileName - filename of the image, for example 63.jpg
	'===============================================================*/
	this.window.close();
	window.opener.AddImageFieldset(previousBinaryId, binaryId, binaryFullPath, binaryFileName);
}

function DeleteIllustration(binaryIndex)
{
/*	'===============================================================
	'   NAME: 					DeleteIllustration
	'   CREATED ON: 			2004-07-17
	'   VERSION: 				1
	'   FUNCTION: 				
	'   IN: 					binaryIndex - The index of the image in the table. 
	'===============================================================*/
	var cnfAn = confirm("Weet u zeker dat u deze illustratie wilt wissen?")
	if (cnfAn == true)
	{
		var oTable = document.getElementById('tblMainImagesTable');
		var numberOfRows = oTable.rows.length;
		for (var i = 0; i < numberOfRows; i++)
		{
			var oRow = oTable.rows[i];
			if (oRow.id == 'rowBinaryIndex_' + binaryIndex)
			{
				oTable.deleteRow(i);
				RenumberImageLabels();
				break;
			}
		}
	}
}	

function RenumberImageLabels()
{
/*	'===============================================================
	'   NAME: 					RenumberImageLabels
	'   CREATED ON: 			2004-07-17
	'   VERSION: 				1
	'   FUNCTION: 				Renames the image labels in the <legend> tags to a sequential order
	'===============================================================*/
	var myLegends = document.getElementsByTagName('legend');
	var legendCounter = 0;
	for (i = 0; i < myLegends.length; i++)
	{
		// There can be lots of <legends> on the page
		// All we're interested in are legends with an id that starts with binaryHeaderTitle
		if (myLegends[i].id.substr(0, myLegends[i].id.lastIndexOf('_')) == 'binaryHeaderTitle')
		{
			// alert('Is een goede legend');
			legendCounter++;	
			// Get part after _, which contains the image Index 
			var imageIndex = myLegends[i].id.substr(myLegends[i].id.lastIndexOf('_') + 1);
			// alert(imageIndex);
			document.getElementById('txtOrderID_' + imageIndex).value = (legendCounter);
			document.getElementById('binaryHeaderTitle_' + imageIndex).innerHTML = 'Afbeelding ' + (legendCounter);
		}
		else
		{
			// alert('Is NIET de goede legend tag');
		}
	}
	
	// Update the drop down with available images
	LoadImagesInList(legendCounter);
	return true;
}

function showmenu(elmnt)
{
	document.all(elmnt).style.visibility="visible"
}

function DeleteBin(strVar)
{
	var cnfAn = confirm("Weet u zeker dat u deze illustratie wilt wissen?")
		if (cnfAn == true)
		{
			document.location.href="delete.asp?Id="+strVar
		}


}

function AddEditBin(strVar)
{
	document.location.href="AddEdit.asp?Id="+strVar
}


function OpenLargeImage(dirBinaryVirt, sBinaryName)
{

	window.open('../Binariesbank/images_popup.asp?sPath='+dirBinaryVirt+'&BinName='+sBinaryName+'', 'Beeldenbank','directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=500, height=500"')

}


function checkimages()
{
	if (document.frmDCM.hid_SavedImage_Image.value=="Spacers/illuNA.jpg")
	{
		document.frmDCM.fndelete.style.visibility="hidden"
	}
}




