/***************************************
* this file contains functions that are used
* throughout the ACP
***************************************/
function confirmDelete(url) {
	if (confirm("Are you sure you want to delete this item?")) location.href=url;	
}

function openwindow(url, name, option) {
	var newwindow = window.open(url, name, option);
	if (!newwindow) { 
		alert("The pop-up window has been blocked. Please check your pop-up blocker setting."); 
	} else { 
		newwindow.focus(); 
	}
}

function chooseSelected(formName, fieldName, newValue){
		eval("window.opener.document." + formName + "." + fieldName).value = newValue;
		window.opener.focus();
		self.close();
}

// open acp window uses a switch to get the proper window options.  This is more repeatable in code.
function openACPWindow(url, name) {
	
	var option;
	
	switch(name){
		
		case 'sitepageedit':
		  	option = 'toolbar=no,resizable=yes,scrollbars=yes,width=700,height=650,left=20,top=0';
		  	break
		case 'sectionedit':
		  	option = 'toolbar=no,resizable=yes,scrollbars=yes,width=900,height=650,left=40,top=0';
		  	break
		case 'sectioncategoryedit':
		  	option = 'toolbar=no,resizable=yes,scrollbars=yes,width=600,height=300';
		  	break
		case 'registereduseredit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=800,height=650';
			break
		case 'adminuseredit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=800,height=650';
			break
		case 'lookupmember':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=500,height=500';
			break
		case 'channeledit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=900,height=650';
			break
		case 'sidecontent':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=650,height=650';
			break
		case 'mediaedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=900,height=650';
			break
		case 'sitecssedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=600,height=300';
			break
		case 'reportview':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=800,height=650';
			break
		case 'mediaview':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=700,height=500';
			break
		case 'retrievepassword':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=500,height=300';
			break
		default:
			  option = '';
	}
	
	var newwindow = window.open(url, name, option);
	if (!newwindow) { 
		alert("The pop-up window has been blocked. Please check your pop-up blocker setting."); 
	} else { 
		newwindow.focus(); 
	}
}

