/**
 * Harmos Festival
 *
 * @version 1
 * @author  Rolling Mill, http://www.rolling-mill.pt
 * @created 2010-09-10
 * @updated 2010-11-30
 * @link    http://www.harmos.com
 */

	function createEdition(id)
	{
		//self.status = 'Ready to save node ' + nodeText + ' which is a sub item of ' + parentId;
		// Use an ajax method here to save this new node. example below:
		var el = document.getElementById(id);
		var edition = el.value;
		
		ajaxObjectArray[ajaxObjectArray.length] = new sack();
		var ajaxIndex = ajaxObjectArray.length-1;
		ajaxObjectArray[ajaxIndex].setVar('nome', edition);
		ajaxObjectArray[ajaxIndex].requestFile = siteURL+'backend/admin/editions/createEdition.cfm';
		ajaxObjectArray[ajaxIndex].onCompletion = function() { 
			//self.status = 'New node has been saved';
			//alert(ajaxObjectArray[ajaxIndex].response);
			switchDIV('frm')
			getEditions('edicoes');
		};	// Specify function that will be executed after file has been found	
		
		ajaxObjectArray[ajaxIndex].runAJAX();		// Execute AJAX function
				
	}
	
	function removeEdition(id)
	{
		//self.status = 'Ready to save node ' + nodeText + ' which is a sub item of ' + parentId;
		// Use an ajax method here to save this new node. example below:

		ajaxObjectArray[ajaxObjectArray.length] = new sack();
		var ajaxIndex = ajaxObjectArray.length-1;
		ajaxObjectArray[ajaxIndex].setVar('editionID', id);
		ajaxObjectArray[ajaxIndex].requestFile = siteURL+'backend/admin/editions/removeEdition.cfm';
		ajaxObjectArray[ajaxIndex].onCompletion = function() { 
			//self.status = 'New node has been saved';
			//alert(ajaxObjectArray[ajaxIndex].response);
			getEditions('edicoes');
		};	// Specify function that will be executed after file has been found	
		
		ajaxObjectArray[ajaxIndex].runAJAX();		// Execute AJAX function
				
	}
	
	function getEditions(div, cEdition, lang)
	{
		//self.status = 'Ready to save node ' + nodeText + ' which is a sub item of ' + parentId;
		// Use an ajax method here to save this new node. example below:
		var el = document.getElementById(div);
		ajaxObjectArray[ajaxObjectArray.length] = new sack();
		var ajaxIndex = ajaxObjectArray.length-1;
		ajaxObjectArray[ajaxIndex].requestFile = siteURL+'backend/admin/editions/getEditions.cfm?edition='+cEdition+'&lang='+lang;
		ajaxObjectArray[ajaxIndex].onCompletion = function() { 
			//self.status = 'New node has been saved';
			//alert(ajaxObjectArray[ajaxIndex].response);
			el.innerHTML = ajaxObjectArray[ajaxIndex].response;
		};	// Specify function that will be executed after file has been found	
		
		ajaxObjectArray[ajaxIndex].runAJAX();		// Execute AJAX function
				
	}
	
	function getEditionInfo(div, cEdition, lang, elemento, callback)
	{
		//self.status = 'Ready to save node ' + nodeText + ' which is a sub item of ' + parentId;
		// Use an ajax method here to save this new node. example below:
		var el = document.getElementById(div);
		ajaxObjectArray[ajaxObjectArray.length] = new sack();
		var ajaxIndex = ajaxObjectArray.length-1;
		ajaxObjectArray[ajaxIndex].requestFile = siteURL+'backend/admin/editions/getEditionInfo.cfm?edition='+cEdition+'&lang='+lang+'&element='+elemento;
		ajaxObjectArray[ajaxIndex].onCompletion = function() { 
			//self.status = 'New node has been saved';
			//alert(ajaxObjectArray[ajaxIndex].response);
			el.innerHTML = ajaxObjectArray[ajaxIndex].response;
			if (callback != null)
				eval(callback)();
		};	// Specify function that will be executed after file has been found	
		
		ajaxObjectArray[ajaxIndex].runAJAX();		// Execute AJAX function
				
	}
