/** addDataItem (itemtype, itemID)
  * ADD Item Function is a global function used to add a particular piece of data from a particular area.
  * itemType = string; type of item to be removed (agenda, exhibitor, session, speaker, attendee, message, etc.)
  * itemID = int; record ID of item to be removed
  * 
  * Usage example:
  * <a href="javascript:void(0);" onclick="addDataItem('addform','SESSION',234);">[Add Icon]</a>
  **/
function addItem(elForm, itemtype, itemID) {
	objForm = document.forms[elForm];
	objAddDataItemID = objForm.itemID;
	objAddDataItemType = objForm.itemType;
	objAddDataCallURL = objForm.callURL;
	
	//add record ID to hidden form element.
	objAddDataItemID.value = itemID;
	
	//add type to matching hidden form element value, to let the the processing .asp know how to reference 
	//the specific type of thing being added.
	objAddDataItemType.value = itemtype;
	
	//submit the form
	objForm.submit();
}

/** singleaddItem(schedType, itemID, procType)
  * Used to add a single entity written inline with the page (for example, in the agenda list and grid). Compiles 
  * the required information, sends with query string to processing page. Does not require form to be written with 
  * add/remove links as on public site.
  * schedType = string; ATTENDEE or EXHIBITOR
  * itemType = string; type of item to be removed (agenda, exhibitor, session, speaker, attendee, message, etc.)
  * itemID = int; record ID of item to be removed
  * returns nothing
  **/
function singleaddItem(schedType, itemtype, itemID) {
	targetURL = 'proc_addDataItem.asp?schedulerType='+schedType;
	targetURL += '&itemType='+itemtype;
	targetURL += '&itemID='+itemID;
	targetURL += '&callURL='+window.location.href;
	
	//alert(targetURL);
	
	window.location.href = targetURL;
}

/** removeDataItem (itemtype, itemID)
  * Remove Item Function is a global function used to remove a particular piece of data from a particular area.
  * itemType = string; type of item to be removed (agenda, exhibitor, session, speaker, attendee, message, etc.)
  * itemID = int; record ID of item to be removed
  * 
  * Usage example:
  * <a href="javascript:void(0);" onclick="removeDataItem('removeform','SESSION',234);">[Remove Icon]</a>
  **/
function removeDataItem(elForm, itemtype, itemID) {
	objForm = document.forms[elForm];
	objDataItemID = objForm.itemID;
	objDataItemType = objForm.itemType;
	objDataCallURL = objForm.callURL;
	if (confirm("Are you sure you want to delete this item?")) {
		//add record ID to querystring.
		objDataItemID.value = itemID;
		
		//add type to querystring, to let the the processing .asp know how to reference the specific type of thing
		//being removed.
		objDataItemType.value = itemtype
		
		//submit the form
		objForm.submit();
	}
}

/** singleremoveDataItem(schedType, itemtype, itemID, redirURL, msgBox)
  * Used to remove a single entity written inline with the page (for example, in the agenda list and grid). Compiles 
  * the required information, sends with query string to processing page. Does not require form to be written with 
  * add/remove links as on public site.
  * schedType = string; ATTENDEE or EXHIBITOR
  * itemType = string; type of item to be removed (agenda, exhibitor, session, speaker, attendee, message, etc.)
  * itemID = int; record ID of item to be removed
  * redirURL = string (optional); redirect url
  * msgBox  = boolean (optional); to indicate whether or not we're in the message popup
  * returns nothing
  **/
function singleremoveDataItem(schedType, itemtype, itemID, redirURL, msgBox) {
	if (confirm("Are you sure you want to delete this item?")) {
		targetURL = 'proc_removeDataItem.asp?removeItem=1&schedulerType='+schedType;
		targetURL += '&itemType='+itemtype;
		targetURL += '&itemID='+itemID;
		if (redirURL) {
			targetURL += '&callURL='+redirURL;
		} else {
			targetURL += '&callURL='+window.location.href;
		}
		if(msgBox) { targetURL += '&MessageBox='+msgBox; }
		
		//alert(targetURL);
		
		window.location.href = targetURL;
	}
}
