/* 
jQuery.post(
	// see tip #1 for how we declare global javascript variables
	MyAjax.ajaxurl,
	{
		// here we declare the parameters to send along with the request
		// this means the following action hooks will be fired:
		// wp_ajax_nopriv_myajax-submit and wp_ajax_myajax-submit
		action : 'myajax-submit',
		
		// other parameters can be added along with "action"
		postID : MyAjax.postID,
		postCommentNonce : MyAjax.postCommentNonce
	},
	function( response ) {
		alert( response );
	}
);
*/

var dynamicContent_ajaxObjects = new Array(); 
var jsCache = new Array();
var enableCache = true; 

function ajax_loadContent(divId,pathToFile) {
	if(enableCache && jsCache[pathToFile]){
		document.getElementById(divId).innerHTML = jsCache[pathToFile];
		return;
	}
		  
	var ajaxIndex = dynamicContent_ajaxObjects.length;
	document.getElementById(divId).innerHTML = '';
	dynamicContent_ajaxObjects[ajaxIndex] = new sack();
	dynamicContent_ajaxObjects[ajaxIndex].requestFile = pathToFile;

	dynamicContent_ajaxObjects[ajaxIndex].onCompletion = 
		function(){ ajax_showContent(divId,ajaxIndex,pathToFile); };  
	dynamicContent_ajaxObjects[ajaxIndex].runAJAX();  
} 

function ajax_showContent(divId,ajaxIndex,pathToFile)
{
	document.getElementById(divId).innerHTML =
	dynamicContent_ajaxObjects[ajaxIndex].response;
	if(enableCache){
		jsCache[pathToFile] = 
		dynamicContent_ajaxObjects[ajaxIndex].response;
	}
	dynamicContent_ajaxObjects[ajaxIndex] = false;
}


