    var mT='';
    function inicio(){
			request = new PeticionBD('faq/xweb_faq.lista.xml',['p_idetip','p_idecat'], cargaFaqs,errorBD);
			mT= "Preguntas-"+tipTxt(4)+"-"+catTxt(1);
    }
		function aHtmlent(tag){
			//alert('s');
			var cod=tag ;
			cod=cod.replace(/``/g,'"');
			cod=cod.replace(/`/g,"'");
			cod=cod.replace(/por cien/g,"%");
			cod=cod.replace(/%26/g,"&");
			return (cod.replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/``/g,'"'));
			}
	
    		function actualizaBD(idetip,idecat){
    		//alert(idecat);
    			var videcat;
    			var videtip=idetip;
    			if(idecat!= "undefined"&& idecat!=''){
					videcat=idecat;
				}else{
					videcat='1';
				}
			  // alert('tipo '+videtip+"   cate "+videcat);
			request.Iniciar([videtip, videcat]);
			}
    		function errorBD(datosError){
			   if (typeof(cargando2) != "undefined") {
			  		cargando2.display({descripcion: datosError.error.code + ' ' + datosError.error.message,
				                       boton_visible: true,
				                       gif_visible: true,
				                       img: 'error'});
			    } else {
			           alert (datosError.error.code + ' ' + datosError.error.message);
			           }
			}
			function cargaFaqs(pJson){
				borraFaq();
				creaListaFaqs('tipo','cate');
				var NumNodos = NumeroHijos(pJson.faqs.faq);
        		var Nodos = pJson.faqs.faq;
        		
        		if (NumNodos == 1){
					creaElementoFaq(0,Nodos["despre"],Nodos["desres"],Nodos["idefaq"]);
							 
					} else {
					
					for(z=0;NumNodos>z;z++){
					//alert(aHtmlent( Nodos[z]["despre"])+"\n"+aHtmlent(Nodos[z]["desres"]));
					  	creaElementoFaq(z,Nodos[z]["despre"],Nodos[z]["desres"],Nodos[z]["idefaq"]);
						}
							   
					}
			     cargando2.visible('off');
			}
		
		/*function carga(tip,cat){
				if(tip && cat){
					window.location = 'xweb_faq.lista.html?p_idetip='+tip+'&p_idecat='+cat;
				}else{
				
				}
		}*/            
		 function  showAnswer(answer,ide){
				var ans='answer-'+answer;
				var mImg='img-'+answer;
				var mCapa='capa-'+answer;
			//alert('si ');
				if(document.getElementById(ans).style.display=='none'){
				  try {
            pageTracker._trackEvent("Pepephone.com", mT ,"Pregunta_"+ide);
          } catch(err) {} 
					document.getElementById(ans).style.display='block'
					document.getElementById(mCapa).style.backgroundColor='#FFF';
					document.getElementById(mImg).src='/img/faqs/bullets/bullet_-.gif';
				}else{
					document.getElementById(ans).style.display='none';
					document.getElementById(mCapa).style.backgroundColor='#D7D7D7';
					document.getElementById(mImg).src='/img/faqs/bullets/bullet_+.gif';
				}
			
			}
		var img	= new Array();
			var di	= document.images;
			var currOn	= null;
			var currOn1	= null;
			
			function Rollover(imgName, imgOut, imgOver, imgClick, imgClickOut)
			{
				if(imgClick    == null)	imgClick 	= imgOver;
				if(imgClickOut == null)	imgClickOut	= imgClick;
			
				var roll = new Object;
			
				roll.out	= imgOut;
				roll.over	= new Image();
				roll.over.src	= imgOver;
				roll.click	= new Image();
				roll.click.src	= imgClick;
				roll.click_out	= new Image();
				roll.click_out.src = imgClickOut;
			
				img[imgName] = roll;	
			}
			function mOver(imgName)
			{
			    di[imgName].src = (imgName != currOn) ? img[imgName].over.src : img[imgName].click.src;
			}
			function mOut(imgName)
			{
				di[imgName].src = (imgName != currOn) ? img[imgName].out : img[imgName].click_out.src;
			}
			function mClickI(imgName)
			{
				if(currOn != null) di[currOn].src = img[currOn].out;
				currOn = imgName;
				di[currOn].src = img[currOn].click.src;
				
			}
			function mClickI1(imgName)
			{
				if(currOn1 != null) di[currOn1].src = img[currOn1].out;
				currOn1 = imgName;
				di[currOn1].src = img[currOn1].click.src;
							
			}
			function mClick(imgName,tip)
			{
				if(currOn != null) di[currOn].src = img[currOn].out;
				currOn = imgName;
				di[currOn].src = img[currOn].click.src;
				var tipo=document.getElementById('p_idetip');
				tipo.value=tip;
				mtipo=tipo.value;
				var categ=document.getElementById('p_idecat').value;
				mT='';
				mT= "Preguntas-"+tipTxt(mtipo)+"-"+catTxt(categ);
				try {
            pageTracker._trackEvent("Pepephone.com", mT ,"entrada");
          } catch(err) {} 
				actualizaBD(mtipo,categ);
			}
			/***************************************************/
			function mOver1(imgName)
			{
			    di[imgName].src = (imgName != currOn1 ) ? img[imgName].over.src : img[imgName].click.src;
			}
			function mOut1(imgName)
			{
				di[imgName].src = (imgName != currOn1) ? img[imgName].out : img[imgName].click_out.src;
			}
			function mClick1(imgName,cat)
			{
				if(currOn1 != null) di[currOn1].src = img[currOn1].out;
				currOn1 = imgName;
				di[currOn1].src = img[currOn1].click.src;
				var categ=document.getElementById('p_idecat');
				categ.value=cat;
				mcateg=categ.value;
				var tipo=document.getElementById('p_idetip').value;
				mT='';
				mT= "Preguntas-"+tipTxt(tipo)+"-"+catTxt(mcateg);
				try {
            pageTracker._trackEvent("Pepephone.com", mT ,"entrada");
          } catch(err) {} 
				
				actualizaBD(tipo,mcateg);
				
			}
			function catTxt(idecat){
        	var catxt='';
				  if(idecat==1){catxt='telefono';}
				  if(idecat==3){catxt='internet';}
				  return catxt;
      }
      function tipTxt(idetip){
          var titxt='';
				  if(idetip==1){titxt='Beneficios';}
				  if(idetip==2){titxt='Tarifas';}
				  if(idetip==3){titxt='Contratacion';}
				  if(idetip==4){titxt='Soporte';}
				  return titxt;
      }
			/*******************************************************/
			
			function mSelect(imgName)
			{
				mClick(imgName);
				mOut(imgName);
			}
			/* imgName, imgOut, imgOver, imgClick, imgClickOut*/
						Rollover('tarifas_img','/img/faqs/menu_sup/tarifas_off.gif','/img/faqs/menu_sup/tarifas_over.gif','/img/faqs/menu_sup/tarifas_on.gif');
				          Rollover('beneficios_img','/img/faqs/menu_sup/beneficios_off.gif','/img/faqs/menu_sup/beneficios_over.gif','/img/faqs/menu_sup/beneficios_on.gif');
				          Rollover('soporte_img','/img/faqs/menu_sup/soporte_off.gif','/img/faqs/menu_sup/soporte_over.gif','/img/faqs/menu_sup/soporte_on.gif');
				          Rollover('contratacion_img','/img/faqs/menu_sup/contratacion_off.gif','/img/faqs/menu_sup/contratacion_over.gif','/img/faqs/menu_sup/contratacion_on.gif');
				          Rollover('telefono_img','/img/faqs/menu_izq/telefono_off.gif','/img/faqs/menu_izq/telefono_over.gif','/img/faqs/menu_izq/telefono_on.gif');
				          Rollover('internet_img','/img/faqs/menu_izq/internet_off.gif','/img/faqs/menu_izq/internet_over.gif','/img/faqs/menu_izq/internet_on.gif'); 
			function borraFaq(){
				var cuadro=document.getElementById('lista_faqs');
				var xs=cuadro.parentNode;
				xs.removeChild(cuadro);
			}
			function creaListaFaqs(tipo,cate){
				var gen=document.getElementById("general_Faq")
				var faqG=document.createElement('div');
				faqG.id='lista_faqs';
				gen.appendChild(faqG);
				//document.getElementById("titulo").innerHTML='internet titulo';	
			}
			function creaElementoFaq(n,preg,resp,ide){

			var faqG=document.getElementById('lista_faqs');
			//alert(document.getElementById('lista_faqs').id);
			var capa=document.createElement('div');
			capa.id='capa-'+(n+1);
			capa.className='pregunta_faq';
			faqG.appendChild(capa);
			var div1=document.createElement('div');
			div1.className='question_img';
			div1['onclick']=new Function('showAnswer('+(n+1)+','+ide+')');//.setAttribute('onClick','showAnswer('+(n+1)+');');
			capa.appendChild(div1);
			var img1=document.createElement('img');
			img1.id='img-'+(n+1);
			img1.src="/img/faqs/bullets/bullet_+.gif";
			div1.appendChild(img1);
			var pr=document.createElement('div');
			pr.className='question_txt';
			pr.innerHTML=(n+1)+'. '+aHtmlent(preg);
			pr['onclick'] = new Function('showAnswer('+(n+1)+','+ide+')');
			//pr.setAttribute('onClick','showAnswer('+(n+1)+');');
			capa.appendChild(pr);
			var a=document.createElement('a');
			a.href='"javascript:showAnswer('+(n+1)+','+ide+');"';
			pr.appendChild(a);
			var re=document.createElement('div');
			re.style.display="none";
			re.className='answer_txt';
			re.id='answer-'+(n+1);
			//alert(resp);
			re.innerHTML=aHtmlent(resp);
			capa.appendChild(re);
			var fix1=document.createElement('div');
			fix1.className='clearfix';
			re.appendChild(fix1);
			var fix2=document.createElement('div');
			fix2.className='clearfix';
			capa.appendChild(fix2);
			
			}
			function aHtml(tag){
			//alert('s');
			var cod=tag ;
			cod=cod.replace(/``/g,'"');
			cod=cod.replace(/`/g,"'");
			cod=cod.replace(/por cien/g,"%");
			cod=cod.replace(/%26/g,"&");
			document.write(cod.replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/``/g,'"'));
			}
			/*
<div class="pregunta_faq" id="capa-1">
   <div onclick="javascript:showAnswer('1');" class="question_img">
      <img title="click para ver respuesta" alt="click para ver respuesta" src="/img/faqs/bullets/bullet_+.gif" id="img-1" />
   </div>
   <div class="question_txt">
      <a href="javascript:showAnswer('1');">1.     
<script>aHtml(" &iquest;Puedo mantener mi n&uacute;mero de tel&eacute;fono actual?");</script>
      </a>
   </div>

   <div STYLE="DISPLAY:none" class="answer_txt" id="answer-1">&nbsp;
<script>aHtml(" Por supuesto! pepephone.com te ofrece la posibilidad mantener tu actual n&uacute;mero de tel&eacute;fono (portabilidad) vengas de la compa&ntilde;&iacute;a que vengas. Tanto si eres un cliente de prepago (tarjeta) como si lo eres de postpago (contrato).");</script>
      <div class="clearfix">&nbsp;</div>
   </div>
   <div class="clearfix">&nbsp;</div>
</div>

			*/
			
			
		function despliegaFaq(){
		    var url = document.location.href;
            var pos = document.location.href.indexOf('#');
            if (pos >= 0){
                var answer = url.substring(pos+1);
                var ideans = '';
                if (answer=='24'){
                    ideans = '232';
                } else if (answer=='25'){
                    ideans = '235';
                } 
                showAnswer(answer,ideans);
            }
        }
