function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}


/*

SI HAY PROBLEMAS DE CARACTERES Y CODIFICACION

	//ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	//ajax.setRequestHeader("Accept-Charset", "UTF-8");

*/


function onSubmit_contacto(p1,p2,p3,p4){
	div = document.getElementById('envio_contacto');
	div.innerHTML= '<img src="../images/anim.gif">';
	ajax=objetoAjax();
	str="ajax/envio_contacto.php?r="+Math.round(Math.random()*999990)+"&Nombre="+p1+"&Email="+p2+"&Telefono="+p3+"&Observaciones="+p4;
	ajax.open("GET", str);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			div.innerHTML = ajax.responseText		
		}
	}
	ajax.send(null)	
}



function onSubmit_tarjetavip(p1,p2,p3,p4,p5){
	div = document.getElementById('envio_tarjetavip');
	div.innerHTML= '<img src="../images/anim.gif">';
	ajax=objetoAjax();
	str="ajax/envio_tarjetavip.php?r="+Math.round(Math.random()*999990)+"&Nombre="+p1+"&Fecha="+p2+"&Telefono="+p3+"&CP="+p4+"&Email="+p5;
	ajax.open("GET", str);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			div.innerHTML = ajax.responseText		
		}
	}
	ajax.send(null)	
}




// Parseador de codigo JAVASCRIPT en "inyecciones" AJAX

			//info:
/*		
	http://www.forosdelweb.com/f77/javascript-dentro-div-traido-por-ajax-430741/
	http://www.forosdelweb.com/f77/howto-ejecutar-javascript-que-viene-ajax-510438/
*/


 var tagScript = '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)';
/**
* Eval script fragment
* @return String
*/
String.prototype.evalScript = function()
{
		return (this.match(new RegExp(tagScript, 'img')) || []).evalScript();
};
/**
* strip script fragment
* @return String
*/
String.prototype.stripScript = function()
{
		return this.replace(new RegExp(tagScript, 'img'), '');
};
/**
* extract script fragment
* @return String
*/
String.prototype.extractScript = function()
{
		var matchAll = new RegExp(tagScript, 'img');
		return (this.match(matchAll) || []);
};
/**
* Eval scripts
* @return String
*/
Array.prototype.evalScript = function(extracted)
{
		var s=this.map(function(sr){
				 var sc=(sr.match(new RegExp(tagScript, 'im')) || ['', ''])[1];
				 if(window.execScript){
					  window.execScript(sc);
				 }
				else
			   {
				   window.setTimeout(sc,0);
				}
		});
		return true;
};
/**
* Map array elements
* @param {Function} fun
* @return Function
*/
Array.prototype.map = function(fun)
{
		if(typeof fun!=="function"){return false;}
		var i = 0, l = this.length;
		for(i=0;i<l;i++)
		{
				fun(this[i]);
		}
		return true;
};  