function deleteImages() {
	var count	= countImageSelectedCheckBoxes();
	var action	= document.getElementById('viewAction');
	if (count > 0) {
		if (confirm(count + ' ' + SbGetLocaleByKey('SURE-TO-DELETE'))) {
			var form = document.forms['SB_WizardForm'];
			//form.tab.value = 'image_management';
			form.action = action.value+'/Modules/ImageGallery/Image/Delete';

			top.sbApplyChangesObject.registerForcedSaving(); 
			//sbNavigationObject.setPostBackUrl('<xsl:value-of select="/SITEBUILDER-PAGE/VIEW-CONTENT/@ACTION"/>/Modules/ImageGallery/Image/Delete');
			sbNavigationObject.go();
		}
	}
	else {
		alert(SbGetLocaleByKey('SELECT-FOR-DELETE'));
	}
}

function countImageSelectedCheckBoxes() {
	result = 0;
	var form = document.forms['SB_WizardForm'];
	for (var n = 0; n < form.elements.length; n++) {
		if (form.elements[n].type == 'checkbox' && form.elements[n].name=='imageId[]') {
			if (form.elements[n].checked) {
				++result;
			}
		}
	}
	return result;
}

function setImageCheckboxStatus(status) {
	var form = document.forms['SB_WizardForm'];
	for (var n = 0; n < form.elements.length; n++) {
		if (form.elements[n].type == 'checkbox' && form.elements[n].name=='imageId[]') {
			if (!form.elements[n].disabled) {
				form.elements[n].checked = status;
			}
		}
	}
}
