
function confirmBatchDelete() {
	if(!confirm('THIS WILL DELETE ALL OCCURRENCES OF THIS EVENT.\n\nAre your sure you want to delete these?')) {
		return false;
	} else {
		return true;
	}
}

function confirmDelete() {
	if(!confirm('Are your sure you want to delete this record?')) {
		return false;
	} else {
		return true;
	}
}

function winPop(str) {
	hWindow = window.open("","A","height=60,width=500,resizable=no");

	var strPopup = "<html>\n";
	strPopup += "<head><title>Band Info</title></head>\n";
	strPopup += '<body onBlur="window.close()" style="background-color:#E9E9E9;"><p>' + str + '</p></body>\n ';
	strPopup += "</html>";

	hWindow.document.write(strPopup);
	hWindow.document.close(strPopup);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function divShowHide(div) {
	var divEl = document.all[div];
	
	divEl.style.display = (divEl.style.display == "none") ? "block" : "none";
}

function getLink(e) {

	tRange  = document.selection.createRange();

	var myTitle = tRange.text;
	var myText = showModalDialog("../templates/createLink_popup.htm",
								 myTitle,      // str or obj specified here can be read from dialog as "window.dialogArguments"
								 "resizable: yes; help: no; status: no; scroll: no; ");

	editor_insertHTML(e, myText,null);

}

function editor_insertHTML(objname, str1,str2, reqSel) {
  if (str1 == null) { str1 = ''; }
  if (str2 == null) { str2 = ''; }

  var sRange;

	objname.focus();
	sRange  = document.selection.createRange();
	var sText   = sRange.text;

	// insert HTML
	if (sText.length) {                                 // if content selected
	  if (str2) { sRange.text = str1 +sText+ str2; }  // surround
	  else      { sRange.text = str1; }               // overwrite
	} else {                                            // if insertion point only
	  if (reqSel) { return alert("Unable to insert HTML.  You must select something first."); }
	  sRange.text = str1 + str2;                        // insert strings
	}
  sRange.collapse(false); // move to end of range
  sRange.select();        // re-select

}	




// variable holding whether or not browser supports functionality needed
var isDom  = (document.getElementById && document.createTextNode);

// receives the id of an element, creates an object, and then changes that object's css properties to none or block (hide or show)
function switchStatus(id){
	if (isDom){														// test browser capability
		f=document.getElementById(id);						// create an object which inherently gets all the tag (element) attributes (like style)
		d=f.style.display;											// find out what current status is
		f.style.display=(d=="block")?"none":"block";	// set style to opposite of what it is
		clearOccurrence();
	}
} 


function clearOccurrence(){
	document.theform.event_timestamp_end.value = "";
	document.theform.reoccur_m.checked = false;
	document.theform.reoccur_t.checked = false;
	document.theform.reoccur_w.checked = false;
	document.theform.reoccur_th.checked = false;
	document.theform.reoccur_f.checked = false;
	document.theform.reoccur_sa.checked = false;
	document.theform.reoccur_su.checked = false;
}

function showElement(id){
	if (isDom){														
		f=document.getElementById(id);						
		//d=f.style.display;								
		f.style.display="block";	
	}
} 


function highlightError(id) {
	if(id != "") {
		if (isDom){														// test browser capability		
			f=document.getElementById(id);					// create an object which inherently gets all the tag (element) attributes (like style)
			d=f.style.color;												// find out what current status is
			b=f.style.background;										// find out what current status is
			f.style.color=(d=="green")?"green":"red";		// set style to opposite of what it is
			f.style.background=(b=="")?"yellow":"";			// set style to opposite of what it is
		}	
	}
}

