function getUniqueId()
{
	var stamp = new Date();
	var id = stamp.getMonth().toString() + stamp.getDay() + stamp.getHours() + stamp.getMinutes() + stamp.getSeconds() + stamp.getMilliseconds() ;
	return id;
}

function ajaxPost(url, container, postParams, encoding)
{
	var xmlObj = createXMLRequest();
	if( url.indexOf('?') == -1 )
	{
		url += '?noCache=' + getUniqueId();
	}
	else
	{
		url += '&noCache=' + getUniqueId();
	}
	xmlObj.open('POST', url, false);
	if(encoding)
		xmlObj.setRequestHeader('Content-Type', encoding);
	else 
		xmlObj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
		
	xmlObj.send(postParams);
}

function ajaxLoad(url, container, callBack, imageLoading)/*THIS FUNCTION LOADS A PAGE INTO A DIV*/
{
	var xmlObj = createXMLRequest();
	
	if( imageLoading && imageLoading.length > 0 && $(container) )
	{
		$(container).innerHTML = imageLoading;
	}
	
	xmlObj.onreadystatechange=function(){
			loadPage(xmlObj, container, callBack)
	}
	if( url.indexOf('?') == -1 )
	{
		url += '?noCache=' + getUniqueId();
	}
	else
	{
		url += '&noCache=' + getUniqueId();
	}
	xmlObj.open('GET', url, true) // asignamos los métodos open y send
	xmlObj.send(null)
}

function ajaxLoadSync(url, container)/*THIS FUNCTION LOADS A PAGE INTO A DIV*/
{
	
	var xmlObj = createXMLRequest();
	
	if( url.indexOf('?') == -1 )
	{
		url += '?noCache=' + getUniqueId();
	}
	else
	{
		url += '&noCache=' + getUniqueId();
	}
	
	xmlObj.open('GET', url, false);
	xmlObj.send(null);
	
	if(container)container.innerHTML=xmlObj.responseText;
	return xmlObj.responseText;
}

function loadPage(request, container, callBack){
	if(request.readyState == 4)
	{
		if (container)container.innerHTML=request.responseText
		if(callBack){eval(callBack);}
	}
}

function createXMLRequest(){
var XMLObj;
if(window.XMLHttpRequest) {XMLObj = new XMLHttpRequest()} 
else if(window.ActiveXObject){
	try
	{XMLObj = new ActiveXObject("Msxml2.XMLHTTP")} 
	catch(e){try{XMLObj = new ActiveXObject("Microsoft.XMLHTTP")}catch (e){}}}
else
{
	return false
}
return XMLObj;
}

function loadAjaxFile(nameFile, nameDiv, callBack, ajaxLoading) {
	var div_pointer = $(nameDiv);
	ajaxLoad(nameFile,div_pointer,callBack, ajaxLoading);
}
