	function getXmlHttpRequestObject() {
		if (window.XMLHttpRequest) {
			return new XMLHttpRequest(); //Not IE
		} else if(window.ActiveXObject) {
			return new ActiveXObject("Microsoft.XMLHTTP"); //IE
		} else {
			alert("El browser que está usando no sorporta XmlHttpRequest object.");
			return false;
		}
	}

//Get our browser specific XmlHttpRequest object.
	var receiveReq = getXmlHttpRequestObject();
	
	function agregarComentario(nombre, email, comentario, idnoticia, idcliente){
		if(receiveReq.readyState == 4 || receiveReq.readyState == 0){
			var accion = 'agregar_comentario';
			var myRand = parseInt(Math.random()*999999999999999);
			var url = 'ajax/sitio.php';
			comentario = encodeURI(reemplazarCharURL(comentario));
			receiveReq.open("GET", url +"?accion="+accion+"&idnoticia="+ idnoticia +"&idcliente="+ idcliente +"&nombre="+ nombre  +"&email="+ email  +"&comentario="+ comentario  +"&rand="+myRand, true);
			receiveReq.onreadystatechange = function(){
				if (receiveReq.readyState == 4) {//alert(receiveReq.responseText);
					document.getElementById('mensajecomentario').innerHTML = receiveReq.responseText;
				}
			
			};		
			receiveReq.send(null);
		}
	}


	function getComentariosnotas(id,pagina,plantilla)
	{ 
		//alert("asfaf");
		
		if(receiveReq.readyState == 4 || receiveReq.readyState == 0)
		{
			if(parseInt(pagina)>1){
				location.href ='#comentarios';
			}
			var accion = 'ver_comentario';
			var myRand = parseInt(Math.random()*999999999999999);
			var url = 'ajax/sitio.php';
			plantilla = encodeURI(reemplazarCharURL(plantilla));
			urlfinal = url +"?accion="+accion+"&id="+ id +"&plantilla="+ plantilla +"&pagina="+ pagina  +"&rand="+myRand;
			//alert(urlfinal);
			receiveReq.open("GET", urlfinal, true);
			receiveReq.onreadystatechange = function(){
					if (receiveReq.readyState == 4) { 
						// alert(receiveReq.responseText);
						document.getElementById('div_comentario').innerHTML = receiveReq.responseText;
					}
				
				};		
			receiveReq.send(null);
		}
	}



	function votar(id,e, entrar){
		var arropciones =  getElementsByName_iefix('input','pregunta'+id);
		var opcion = '';
		for(var i=0; i< arropciones.length; i++ ){
			if(arropciones[i].checked == true){
				opcion = arropciones[i].value;	
			}	
		}
		
		if(entrar == true) opcion= 0;
		
		if(opcion != '' || entrar == true){
			if(receiveReq.readyState == 4 || receiveReq.readyState == 0){
				
				var accion = 'votar';
				var myRand = parseInt(Math.random()*999999999999999);
				var url = 'ajax/sitio.php';
				
				receiveReq.open("GET", url +"?accion="+accion+"&opcion="+ opcion +"&idencuesta="+ id +"&rand="+myRand, true);
				receiveReq.onreadystatechange = function(){
						if (receiveReq.readyState == 4) {
					//		GB_showCenter('Encuesta','http://www.planetajoy.com/encuesta.php?id='+id, 300, 600);
							//window.open('http://www.planetajoy.com/encuesta.php?id='+id , 'encuesta_'+ id , 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400');
							
							
							/*if(document.getElementById('resultados_votar'+id)){
								document.getElementById('resultados_votar'+id).innerHTML = receiveReq.responseText;
							}*/
						}
					
					};		
				receiveReq.send(null);
			}
		}else{
				
		}
	}



function zoomText(Accion,Elemento){
//inicializacion de variables y parámetros
	var obj=document.getElementById(Elemento);
	var max = 180 //tamaño máximo del fontSize
	var min = 100 //tamaño mínimo del fontSize
	if (obj.style.fontSize==""){
		obj.style.fontSize="100%";
	}
	
	var actual = parseInt(obj.style.fontSize); //valor actual del tamaño del texto
	var incremento = 20;// el valor del incremento o decremento en el tamaño
	
	//accion sobre el texto
	if( Accion=="reestablecer" ){
		obj.style.fontSize="100%"
	}
	if( Accion=="aumentar" && ((actual+incremento) <= max )){
		valor=actual+incremento;
		obj.style.fontSize=valor+"%"
	}
	if( Accion=="disminuir" && ((actual+incremento) >= min )){
		valor=actual-incremento;
		obj.style.fontSize=valor+"%"
	}
}


function validarEmail(e) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e.value)){
		//alert(”La dirección de email ” + e.value + ” es correcta.”)
		return (true)
	} else {
		alert('La dirección de email es incorrecta.');
		e.focus();
		e.value = '';
		return (false);
	}
}


	function byId(id){
		return document.getElementById(id);
	}
	
	
	function validarcampos(){
		var arrCampo = arrCampoValidar;
		var error = new Array();
		var j = 0
		for(var i=0; i< arrCampo.length; i++){
			byId('error_'+ arrCampo[i]).style.display = 'none';
			if(trim(byId(arrCampo[i]).value) == ''){
				error[j] = arrCampo[i];
				byId('error_'+ arrCampo[i]).style.display = 'block';
				j++;
			}														
		}
		if(error.length > 0){
			byId(error[0]).focus();
			return false;
		}
		return true;
	}


	function recomendarNota(){
		var minombre = byId('minombre_recomendar').value;
		var nombre = byId('nombre_recomendar').value;
		var email = byId('email_recomendar').value;
		var titulo = encodeURI(byId('titulo_nota').value);
		var url_nota = encodeURI(byId('url_nota').value);
		var id_nota = byId('id_nota').value;
		
		
		if(minombre != '' && nombre !='' && email != ''){
			var accion = 'recomendar';
			var myRand = parseInt(Math.random()*999999999999999);
			var url = 'ajax/sitio.php';
			
			receiveReq.open("GET", url +"?accion="+accion+"&minombre="+ minombre +"&nombre="+ nombre +"&email="+ email +"&titulo="+ titulo +"&url_nota="+ url_nota +"&id_nota="+ id_nota +"&rand="+myRand, true);
			receiveReq.onreadystatechange = function(){
					if (receiveReq.readyState == 4) {
						byId('form_recomendar').reset();
						if(receiveReq.responseText != '')
							byId('mensaje_recomendar').innerHTML = receiveReq.responseText;
						
						//byId('panel1').style.display='none'
				//		GB_showCenter('Encuesta','http://www.planetajoy.com/encuesta.php?id='+id, 300, 600);
						//window.open('http://www.planetajoy.com/encuesta.php?id='+id , 'encuesta_'+ id , 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400');
						
						
						/*if(document.getElementById('resultados_votar'+id)){
							document.getElementById('resultados_votar'+id).innerHTML = receiveReq.responseText;
						}*/
					}
				
				};		
			receiveReq.send(null);
		}
		
	}