	// Post JS Ajax submission
	function postAjax(form_name, script, rules, ret) {
		if (!ret && ret != false)
			ret = true;
		if (performCheck(form_name, rules, 'classic') == false) 
			return false;
		// Delete existing update text
		$('post_message').innerHTML = '';
		var postString = 'ajax=1&'+Form.serialize(form_name);
		// Show saving text
		$('post_wait').removeClass('hide');
		
		new Ajax (script, {
			postBody: postString,
			update: $('post_message'),
			onComplete: function() { $('post_wait').addClass('hide'); }
		}).request();

		return ret;
	}

	function ajaxDelete(script, name, id, i) {
		if (confirm("Are you sure you want to delete this image?")) {
			// Delete existing update text
			$('post_message').innerHTML = '';
			var postString = 'option=delete_image&ajax=1&'+name+'='+id+'&i='+i;
			alert(postString);
			if ((!i || i == '') && i != 0)
				i = '';
			else
				i = '_'+i;
			// Show saving text
			$('post_wait').removeClass('hide');
			new Ajax (script, {
				postBody: postString,
				update: $('post_message'),
				onComplete: function() { $('post_wait').addClass('hide'); $('row_'+id+i).addClass('hide'); }
			}).request();
		}
	}

	// Get Ajax Select
	function getAjaxSelect(script, string) {
		var postString = 'option=view&'+string;
		$('post_wait').removeClass('hide');
		new Ajax (script, {
			postBody: postString,
			onComplete: populateList
		}).request();

		return true;
	}

	// Populate dropdwn from XML
	function populateList(responseText, responseXML) {
		var nodes = responseXML.documentElement.getElementsByTagName('item');
		var name = responseXML.documentElement.attributes[0].nodeValue;
		var list = $(name);

		for (var count = list.options.length-1; count >= 0; count--)
			list.options[count] = null;
	
		var idValue;
		var selectedValue = false;
		var textValue; 
		var optionItem;
		// populate the dropdown list with data from the xml doc
		for (var count = 0; count < nodes.length; count++) {
			textValue = GetInnerText(nodes[count]);
			idValue = nodes[count].getAttribute("id");
			selectedValue = nodes[count].getAttribute("selected");
			optionItem = new Option( textValue, idValue, false, selectedValue);
			list.options[list.length] = optionItem;
		}
		$('post_wait').addClass('hide');
	}
		
	// returns the node text value 
	function GetInnerText (node) {
		 return (node.textContent || node.innerText || node.text || node.firstChild.nodeValue || '') ;
	}
	
	function cent(amount) {
	// returns the amount in the .99 format 
		amount -= 0;
		amount = (Math.round(amount*100))/100;
		return (amount == Math.floor(amount)) ? amount + '.00' : (  (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
	}
