/***************************************
* this file contains functions that are used
* throughout the ACP
***************************************/

function emailLinkWindow() 
{ 
window.open('/emailLink.cfm?sendURL=%2FIndex%2Ecfm','jav','width=425,height=325,resizable=yes'); 
} 


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 bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}


// 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 'memberedit':
		  	option = 'toolbar=no,resizable=yes,scrollbars=yes,width=900,height='+ (screen.availHeight - 50)+',left=20,top=0';
		  	break
		case 'conferenceedit':
		  	option = 'toolbar=no,resizable=yes,scrollbars=yes,width=900,height=600,left=50,top=0';
		  	break
		case 'dataedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=500,height=300';
			break
		case 'roomscheduleedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=750,height=650';
			break
		case 'roomedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=750,height=225';
			break
		case 'articleedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=750,height=400';
			break
		case 'publicationedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=850,height=600,left=50,top=0';
			break
		case 'suspensionedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=500,height=325';
			break
		case 'submissionedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=750,height=500';
			break
		case 'issuedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=750,height=500';
			break
		case 'registrantedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=750,height=500';
			break	
		case 'relatedeventedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=500,height=300';
			break
		case 'siteedit':
		  	option = 'toolbar=no,resizable=yes,scrollbars=yes,width=900,height='+ (screen.availHeight - 80)+',left=30,top=0';
		  	break
		case 'sitetestedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=500,height=300';
			break
		case 'testadd':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=650,height=500';
			break
		case 'testedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=800,height=750';
			break
		case 'rateredit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=800,height=750';
			break
		case 'paymentedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=700,height=600';
			break
		case 'productedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=750,height=500';
			break
		case 'mergeedit':
		  	option = 'toolbar=no,resizable=yes,scrollbars=yes,width=800,height=600,left=50,top=0';
		  	break
		case 'ceuedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=750,height=550';
			break
		case 'courseedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=750,height=650';
			break
		case 'caseedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=850,height=750';
			break
		case 'epsworkedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=550,height=400';
			break
		case 'epsitemedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=550,height=300';
			break
		case 'emailedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=750,height=650';
			break
		case 'presentationedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=750,height=650';
			break
		case 'leadershipedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=600,height=300';
			break
		case 'surveyedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=800,height=500';
			break
		case 'questionedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=650,height=500';
			break
		case 'receiptview':
			option = 'toolbar=no,resizable=yes,scrollbars=yes';
			break
		case 'searchedit':
			option = 'toolbar=no,resizable=yes,scrollbars=yes,width=700,height=500';
			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(); 
	}
}

function clearText(thefield){
	if (thefield.defaultValue==thefield.value)
	thefield.value = ""
	}

