//menu flotante

var menu_top=0;
var menu_max_top=0;
var obj_max_top=false;
var obj_mf= false;
var obj_cn= false;
var menu_left=0;
var menu_width=0;
var menu_height=0;
var menu_pos_act=-1;
var sc_Top=0;
var sc_Left=0;
var menu_avance=20; //velocidad al desplegar/ocultar el menu flotante
var menu_t_vista=1; //tiempo en segundos que dura el menu flotante desplegado
var menu_min_height=250; //altura minima del menu flotante

var cvget = ""; // contiene la variable GET para actualizar la ligas de las paginas
function scroll_pp()
	{
	if( document.body && document.body.scrollTop )
		sc_Top = document.body.scrollTop
	else if( document.documentElement && document.documentElement.scrollTop )
		sc_Top = document.documentElement.scrollTop;
	else
		sc_Top = 0;
	
	if( document.body && document.body.scrollLeft )
		sc_Left= document.body.scrollLeft;
	else if( document.documentElement && document.documentElement.scrollLeft )
		sc_Left= document.documentElement.scrollLeft;
	else
		sc_Left= 0;
	}
function inicia_pp()
	{
	$("div.bus_pp").show();
	resalt_secc('txt_resaltar');
	ini_pos_secc();
	
	scroll_pp();
	
	obj_mf= document.getElementById('menu_f');
	obj_cn= document.getElementById('contenedor');
	obj_max_top= document.getElementById('d_men_inf');
	
	/*menu_flotante*/	
	if (obj_m_c=document.getElementById('menu_f_c'))
	{	
		obj_m_c.style.display="block";
		
		menu_height=Math.max(obj_m_c.offsetHeight,menu_min_height);					
		
		menu_width=obj_m_c.offsetWidth;	
		obj_m_c.style.display="none";
		obj_m_c.style.width=menu_avance+"px";
		obj_m_c.style.height=menu_height+"px";
		obj_m_c.style.overflow="hidden";	
		if (obj_m_l=document.getElementById('menu_lv'))
			obj_m_l.style.height=menu_height-12+"px";
	}
	
	if(obj_mf)
	{
		obj_mf.style.visibility= "visible";
		menu_top=obj_mf.offsetTop;		
	}
	menu_max_top= obj_max_top? obj_max_top.offsetTop : 0;

	if(obj_cn)
		menu_left=obj_cn.offsetLeft;
	
	menu_pos_act=-1;
	
	//	mostrar los controles de scroll para imagenes
	var tabla_= document.getElementById('t_contf');
	var controles_= document.getElementById('ctr_fot');
	if( tabla_ && controles_ && parseInt(tabla_.style.width)>=740 )
		controles_.style.visibility= "visible";
	mueve_menu();
	iniV();
	gV();
	}
function inicia_pp_c()
	{	
	scroll_pp();
	menu_max_top= obj_max_top? obj_max_top.offsetTop : 0;
	mueve_menu();
	iniV();
	}
function reinicio_pp()
	{
	menu_left= obj_cn? obj_cn.offsetLeft : 0;
	menu_pos_act= -1;
	mueve_menu();
	}
var mueve_menu= function ()
{
	scroll_pp();
	monV();
	//window.status=sc_Top+"-"+menu_top+"-"+menu_height+"-"+menu_max_top+"-"+menu_left;
	var p_m= calcula_mp();
	var pos_top=sc_Top;
	if(pos_top!=menu_pos_act && obj_mf)
	{			
		if ( ((sc_Top+menu_height) < menu_top) || ((sc_Top+menu_height)>menu_max_top))
		{
			obj_mf.style.display='none';
			/*
			if( (sc_Top+menu_height)>=menu_max_top )
				setTimeout("resalt_secc('d_men_inf')", 50);
			*/
		}
		else
		{	
			altura=Math.max(0,p_m["height"]);
			centro_top=(altura-menu_height)/2;
			obj_mf.style.top=(pos_top+centro_top)+"px";
			obj_mf.style.left=(menu_left-5)+"px";
			obj_mf.style.display='block';
			menu_pos_act=pos_top;
		}
	}
	setTimeout("mueve_menu()",100);
}
var menu_f_act=false;
var menu_s_act=false;
var menu_s_div=false;
var menu_creciendo=false;
function menu_ver()
	{
	if (menu_creciendo)
		return;
	if (!menu_f_act)//abre el menu
		{
		if (img_l=document.getElementById('sp_mn_flt'))
			img_l.innerHTML=txt_sh;
		if (img_b=document.getElementById('menu_img_bv'))
			img_b.src="/pr/imagenes/menu_fo.jpg";
		if (men_c=document.getElementById('menu_f_c'))
			{			
			men_c.style.display="block";				
			crece_menu();
			}
		menu_f_act=true;
		menu_s_act=true;
		menu_cierra();
		}
	else  //abre el menu
		{
		if (img_l=document.getElementById('sp_mn_flt'))
			img_l.innerHTML=txt_hd;
		if (img_b=document.getElementById('menu_img_bv'))
			img_b.src="/pr/imagenes/menu_fv.jpg";
		if (men_c=document.getElementById('menu_f_c'))
			{
			//men_c.style.display="none";
			decrece_menu();
			}
		menu_f_act=false;
		menu_s_act=true;
		}
	}
function menu_cierra()
{
	if (menu_s_act)
	{
		if (!menu_s_div)
			menu_s_act=false;
		setTimeout("menu_cierra()",(menu_t_vista*1000));
	}
	else
	{
		menu_f_act=true;
		menu_ver();
	}
}
function crece_menu()
	{
	if (men_c=document.getElementById('menu_f_c'))
		{
		var wid=parseInt(men_c.style.width);
		if (wid<menu_width)
			{
			menu_creciendo=true;
			men_c.style.width=wid+menu_avance+"px";
			setTimeout("crece_menu()",1);
			}
		else
			menu_creciendo=false;
		}
	}
function decrece_menu()
	{
	if (men_c=document.getElementById('menu_f_c'))
		{
		var wid=parseInt(men_c.style.width);		
		if (wid>0)
			{
			menu_creciendo=true;
			men_c.style.width=Math.max(wid-menu_avance,0)+"px";
			setTimeout("decrece_menu()",1);
			}
		if (wid<=menu_avance)
			{
			menu_creciendo=false;
			men_c.style.display="none";
			}
		}
	}
//fin menu flotante
//funciones pantalla
function calcula_mp() 
	{	
	var med=new Array();
	med["width"]=0;
	med["height"]=0;
    if (window.innerWidth) 
		{
		med["width"] = window.innerWidth;
		med["height"] = window.innerHeight;
		}
	else if (document.documentElement && document.documentElement.clientWidth) 
		{
		med["width"] = document.documentElement.clientWidth;
		med["height"] = document.documentElement.clientHeight;
		}
	else if (document.body && document.body.clientWidth) 
		{
		med["width"] = document.body.clientWidth;
		med["height"] = document.body.clientHeight;
		}
	return med;
	}

function setStyle(objId, style, value)
{
	if( document.getElementById(objId) )
		document.getElementById(objId).style[style] = value;
}
function aS(div, fnt)// ~put_button2 : ampliar y disiminuir
{
	var input= fnt;
	var iner= new String( input.innerHTML );
	var obj_div= document.getElementById(div);
	var alto_real=0;
	if( !obj_div || input.innerHTML== "&nbsp;" )
		return;

	if( iner.indexOf('+')!= -1 )// se amplia
	{
		input.innerHTML= tx_disminuir+" <font class=\"f\">&nbsp;-&nbsp;</font>";
		setStyle(div, 'height', 'auto');
		obj_div= document.getElementById(div);
		alto_real= obj_div.offsetHeight;
		if( alto_real<180 )
			input.innerHTML= "&nbsp;";
	}
	else
	{
		input.innerHTML= tx_ampliar+" <font>&nbsp;+&nbsp;</font>";
		setStyle(div, 'height', '180px');
	}
	inicia_pp_c();
}
function ppsub(id_form)//sin uso en pp
{
	if (forma= document.getElementById(id_form))
		forma.submit();
}
move=false;
function der()
{
	if( !document.getElementById('dv_secc_fotos_p') )
		return;
	document.getElementById('dv_secc_fotos_p').scrollLeft+=10;	
	setTimeout("prueba(1)",50);
}
function izq()
{
	if( !document.getElementById('dv_secc_fotos_p') )
		return;
	document.getElementById('dv_secc_fotos_p').scrollLeft-=10;
	setTimeout("prueba(2)",50);
}
function prueba(c)
{
	if(move)
	{
		if(c==1)
			der();
		if(c==2)
			izq();
	}
}
var dv_comm_act=0;
function sh_comm(id_apo,scc)//sin uso en pp
{
	if(dv_comm_act)
	{
		dv_comm_act.style.visibility="hidden";
		dv_comm_act.style.display="none";
	}
	dv_comm_act=document.getElementById('dv_com_'+scc+'_ap_'+id_apo);
	dv_comm_act.style.visibility="visible";
	dv_comm_act.style.display="block";	
}

function cV(cad_elemento, tipo)// ~cambiaVisibilidad
{
	var ley_txt= false;
	var div_cont;
	var imagen;
	var nvo_src= '/pr/iconos/comentario';
	var temp= '';
	var txt_si= '';
	var txt_no= '';

	div_cont= document.getElementById(cad_elemento);
	imagen= document.getElementById('img_'+cad_elemento);
	ley_txt= document.getElementById('txt_'+cad_elemento);
	if( !div_cont || !imagen )
		return;
	var mostrar= div_cont.style.display!="block"? true : false;
	if( ley_txt )
		temp= new String(ley_txt.innerHTML);
	if( cad_elemento.indexOf('comentario')!= -1 )
	{
		txt_si= tx_ver_rpts;
		txt_no= tx_no_rpts;
	}
	else
	{
		txt_si= tx_ver_cmt;
		txt_no= tx_no_cmt;
	}
	div_cont.style.display= mostrar? "block" : "none";
	div_cont.style.visibility= mostrar? "visible" : "hidden";
	imagen.src= !mostrar? nvo_src+'.gif' : nvo_src+'_esc.gif';
	if( tipo==2 && temp!='' )
		if(!mostrar)
			ley_txt.innerHTML= temp.replace(txt_no, txt_si);
		else
			ley_txt.innerHTML= temp.replace(txt_si, txt_no);
	iniV();
	if( marcado_extra )
		marcado_extra.className= mostrar? marcado_extra.className+" resalta" : marcado_extra.className.replace(" resalta","");
}
var marcado_extra=null;
var elemento_foto=null;
var div_foto=null;

function cVF(elemento)// ~cambiaVisibilidad_foto
{
	var id_ap= elemento.split("_");
	
	if(elemento_foto!=null) // cierra los comentarios de la foto abierta actualmente
	{
		marcado_extra= document.getElementById(div_foto);//+
		cV(elemento_foto, 1);
		marcado_extra= null;//+
	}
	
	if( elemento_foto==elemento )
	{
		elemento_foto=null;
		div_foto=null;//+
	}
	else
	{
		div_foto= "ap_"+id_ap[2];//+
		marcado_extra= document.getElementById(div_foto);//+
		cV(elemento, 1);
		marcado_extra= null;//+
		elemento_foto= elemento;
	}
}

var opc_sin=0;
function lista_sinonimos(opcion, val)//sin uso en pp
{
	if (opc_sin==val){
		document.getElementById('enca_s').innerHTML="";
		document.getElementById('lista_s').style.display = "none";
		document.getElementById('lista_s').style.visibility = "hidden";
		opc_sin=0;
	}
	else{
		document.getElementById('enca_s').innerHTML=opcion;
		document.getElementById('lista_s').style.display = "block";
		document.getElementById('lista_s').style.visibility = "visible";
		opc_sin=val;
	}
}
function selec_pr(id, total, pro_rel)
{
	for (inicio=0; inicio<total; inicio++)
	{
		sinonimo=document.getElementById('pr_s_'+id+"_"+inicio);
		if (sinonimo)
			sinonimo.checked=pro_rel.checked;
	}
}
function selec_pr_rev(id,  pro_rel)
{
	inicio=0;
	princ=document.getElementById("pr_"+id);
	princ.checked=pro_rel.checked;
	while (true)
	{	
		sinonimo=document.getElementById("pr_s_"+id+"_"+inicio);
		if (sinonimo)
		{
			if (sinonimo)
			{
				sinonimo.checked=pro_rel.checked;
				inicio++;
			}
		}
		else
		{
			return false;
			break;
		}
	}
}

// ordenamiento
var ordenF= 'ordF_vts';//primer ordenamiento
var ordInfoClase='';
function mi_ordena_fotos(obj)
{
	ordInfoClase= 'foto_cont_ap';
	if( ordenF=="ordF_vts" )// como se va a ordenar
	{
		//alert("ordenar por votos desc");
		ordInfo('t_contf', 'viapsft', 'sumVts', false);
		//'ordenar imagenes cronologicamente (descendente)';
		ordenF= 'ordF_cro';//sig ordenamiento
	}
	else	//	id
	{
		//alert("ordenar por id desc");
		ordInfo('t_contf', 'viapsft', 'viap', false);
		//'ordenar imagenes por votos (descendente)';
		ordenF= 'ordF_vts';//sig ordenamiento
	}
	try{
		obj.value= leyenda[ordenF];
		document.getElementById('ley_ord_f').innerHTML= ordenF=="ordF_vts"? leyenda['orden_fechas'] : leyenda['orden_votos'];
	}catch(weg){
		obj.value= ordenF;
	}
}
/*busqueda en esta pagina*/
var NS4 = (document.layers);
var IE4 = (document.all);
var win = window;
var n = 0;
function BuscarPalabras(str) 
{
	var txt, i, found;
	if (str == "")
		return false;
	if (NS4)
	{
		if (!win.find(str))
			while(win.find(str, false, true))
				n++;
		else
			n++;
		if (n == 0)
			alert(leyenda['no_encontrado']);
	}
	if (IE4)
	{
		txt = win.document.body.createTextRange();
		for (i = 0; i <= n && (found = txt.findText(str)) != false; i++)
		{
			txt.moveStart("character", 1); txt.moveEnd("textedit");
		}
	}
	if(found)
	{
		txt.moveStart("character", -1);
		txt.findText(str); txt.select(); txt.scrollIntoView(); n++;
	}
	else
	{
		if (n > 0)
		{
			n = 0; BuscarPalabras(str);
		}
		else
			alert(leyenda['no_encontrado']);
	}
	//}
		
	return false;
}
/*busqueda en esta pagina*/
/*conversiones*/
function set_ajax()
{
	var regresa_p;
	if (window.XMLHttpRequest) 
	{
		// Si es Mozilla, Safari etc
		regresa_p = new XMLHttpRequest();
	}
	else
		if (window.ActiveXObject)
		{ 
			// pero si es IE
			try 
			{
				regresa_p = new ActiveXObject("Msxml2.XMLHTTP");
			} 
			catch (e)
			{ // en caso que sea una versión antigua
				try
				{
					regresa_p = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e){}
			}
		}
		else
			return false

	return regresa_p;
}
function convierte_prop(p,flag,value,ap)
{
	url="/pr/im/ticcsrv.php";
	id_contenedor="cont_"+flag+"_apo_"+p;	
	var pagina_requerida = false;
	pagina_requerida=set_ajax();
	pagina_requerida.onreadystatechange=function()
	{
		 if (pagina_requerida.readyState==1)
			document.getElementById(id_contenedor).innerHTML = "<img src='/pr/imagenes/wait.gif' align='center' />";
		 if (pagina_requerida.readyState==4)
		 {
			if(pagina_requerida.status==200)
				document.getElementById(id_contenedor).innerHTML= pagina_requerida.responseText;
			else
				id_contenedor.innerHTML= leyenda['error_ajax'];
		}
	}
	if(flag=='p')
		name_f="pide_val";
	else
		name_f="pide_val_c";
	valorpost="func="+name_f+"&propiedad="+p+"&nw_conv="+value;
	pagina_requerida.open('POST', url, true);
	pagina_requerida.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	pagina_requerida.send(valorpost);
}
/*conversiones*/
//--noticias
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
	if(popUpWin && !popUpWin.closed)
		popUpWin.close();
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=yes,menub ar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	popUpWin.focus();
}
//noticias--
function now()
{
	var Stamp = new Date();
	var tm_tmp = '';
	var Hours;
	var Mins;
	var Segs;
	var Time;
	Hours = Stamp.getHours();
	if (Hours >= 12)
		Time = " P.M.";
	else
		Time = " A.M.";
	if (Hours > 12)
		Hours -= 12;
	if (Hours == 0)
		Hours = 12;
	Mins = Stamp.getMinutes();
	if (Mins < 10)
		Mins = "0" + Mins;
	Segs = Stamp.getSeconds();
	if ( Segs < 10 )
		Segs = "0" + Segs;
	tm_tmp += Hours + ":" + Mins + ":" + Segs + Time;
	return tm_tmp;
}
//--ajx
var cont_din_ini= '<div class="contenido limpio"><div class="centro_pp">';
var cont_din_fin= '</div></div>';
var sign_act= ''; //cont_din_ini+'<p><h1>ACTUALIZADO!!</h1></p>'+cont_din_fin;
function upSeccPP(secc)
{
	//alert("upSeccPP("+secc+")");
	if( secc!=0 && secc!='seccion-0' && secc!="" )
		return getSeccPP(secc);
	return false;
}
var muestra_mensaje=true;
function cambia_ligas()
{
	seG="";
	cvget="";
   $.post("/funciones/v.php", "update=update", function(theResponse){
				cvget = theResponse[0];
				seG = theResponse[1];
				
				muestra_mensaje = true;
				$("a").each(function(){
					  var href = new String( $(this).attr("href")+"" );
					  //href = href.toString();
					  var patt = /http:/gi;
					  
					  var result=href.search(patt);
					  
					  var patt2 = /[#]/gi;
					  var result2=href.search(patt2);
					  
					  if (result >= 0 && result2 == -1)
					  {
						  patt3 = /\?/gi;
						  patt4 = /=/gi;
						  patt5 = /&/gi;
						  cadena_buscar = cvget+"=[^&]*";
						  exp_reg = new RegExp(cadena_buscar,"gi");
						  if(href.search(exp_reg)>=0)
						  {
							  respuesta = href.match(exp_reg);
							  href = href.replace(respuesta, cvget+"="+seG);
						  }
						  else
						  {
							  var queryString = "";
							  if(href.search(patt3)>=0 ||href.search(patt4)>=0 ||href.search(patt5)>=0)
							  {
								  queryString = "&"+cvget+"="+seG;
							  }
							  else
							  {
								  queryString = "?"+cvget+"="+seG;
							  }
							  href+=queryString;
						  }
						  $(this).attr("href", href);
						  
					  }
				   });
			
		},"json");
}
function getSeccPP(secc)
{
	//alert('getSeccPP('+secc+')');
	var dc= document.getElementById(secc);
	if( !dc )
		return false;
	
	url_= '/pr/ap/r.php';
	var manejador= set_ajax();
	manejador.onreadystatechange= function() {
		if (manejador.readyState==4)
		{
			if(manejador.status==200)
			{
				html_extra="";
				/*html_extra= '<div class="secc_actualizada centro_pp" id="'+secc+'_ia">'+leyenda['secc_actualizada']+'&nbsp;'+now()+'&nbsp;<a href="#" onclick="setStyle(\''+secc+'_ia\', \'display\', \'none\'); return false;">'+leyenda['cerrar']+'</a></div><div class="limpia"></div>';*/
				//alert(html_extra);
				dc.innerHTML = html_extra+manejador.responseText+sign_act;
				//iniResSecc(secc);
				setTimeout('abrir_secciones()', 3000);
				cambia_ligas();
			}
			else
			{
				dc.innerHTML= leyenda['error_ajax'];
			}
			getMenPP();
		}
	}
	//alert("ya mero pide el ajx:"+url_);
	manejador.open('POST', url_, true);
	manejador.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
	if(typeof otro_pRef!='undefined')
		pRef= otro_pRef;
   manejador.send( "qn="+pRef+seP+ipRef+seP+secc );
	//alert("ajx:\n\n"+"qn="+pRef+seP+ipRef+seP+secc);
	return true;
}

var ctr_res= 0;
var secc_res= '';
function iniResSecc(secc)
{
	if( secc_res!= secc && secc_res!= '' )
	{
		ctr_res=0;
		setStyle(secc_res, 'border', '');
	}
	secc_res= secc;
	resSecc();
}
function resSecc()
{
	if( ctr_res<=3 && secc_res!= '' )
	{
		if( ctr_res%2==0 )
			setStyle(secc_res, 'border', '2px dashed RED');
		else
			setStyle(secc_res, 'border', '');
		if( ctr_res<=2 )
		{
			ctr_res++;
			setTimeout('resSecc()', 2000);
			return ;
		}
	}
	ctr_res= 0;
	secc_res= '';
}
function getMenPP()
{
	var menu_top= document.getElementById('d_men_sup');
	var menu_bottom= document.getElementById('d_men_inf');
	
	if( !menu_top || !menu_bottom )
		return;
	
	url_= '/pr/ap/r.php';
	var manejador= set_ajax();
	manejador.onreadystatechange= function() {
		if (manejador.readyState==4)
		{
			if(manejador.status==200)
			{
				var resp_ajx= manejador.responseText;
				//alert('menu regreso:\n'+resp_ajx);
				menu_top.innerHTML = resp_ajx+sign_act;
				
				var arr_nvo_texto= resp_ajx.split('<!-- tag_bus -->');
				if( typeof arr_nvo_texto[0]!='undefined' && typeof arr_nvo_texto[2]!='undefined' )
					menu_bottom.innerHTML = arr_nvo_texto[0]+arr_nvo_texto[2];
				$("div.bus_pp").show();
			}
			else
				menu_top.innerHTML= leyenda['error_ajax'];
		}
	}
	
	manejador.open('POST', url_, true);
	manejador.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
   manejador.send( "qn="+pRef+seP+ipRef+seP+"d_men" );
	//alert("ajx2_,menu:\n\n"+"qn="+pRef+seP+ipRef+seP+"d_men");
}
//ajx--
var paleta_col= new Array();
paleta_col[0]="#DAFFE9";
paleta_col[1]="#FCDDED";
paleta_col[2]="#FFFFC6";
paleta_col[3]="#E7CCFF";
paleta_col[4]="#FFEBC2";
var palabra_color= new Array();
var color_tmp=0;
function un_color(palabra)
{
	if( typeof palabra_color[palabra]=='undefined' )
	{
		palabra_color[palabra]= paleta_col[color_tmp % 5];
		color_tmp++;
	}
	return palabra_color[palabra]; //"#ff0";
}
function resalt_monitor(msg)
{
	var cont_= document.getElementById('monitor_busqueda');
	if( !cont_ )
		return;
	cont_.innerHTML= msg;
}
var timerResaltSecc;
function resalt_secc(secc)
{
	var textoNuevo;
	var regex;
	var cont_secc= document.getElementById(secc);
	if( !cont_secc || typeof gRef!= 'object' || gRef.length==0 )
		return;

	if( secc!='txt_resaltar' && secc!='nombre_rs' && secc!='d_men_sup' )
		window.setTimeout("resalt_monitor('<br />'+leyenda['buscando']+' <b>"+nombre_secc(secc)+"</b>')", 1);

	for(p_g in gRef)
	{
		textoNuevo = "$1<span style=\"background-color:"+un_color(gRef[p_g])+"; font-weight: bold;\">$2</span>$3"; //define el texto a insertar por cada coincidencia de la regex
		//regex con modificadores ig, o sea no sensible a mayúsculas y minúsculas (i) y reemplazar todas las existencias (g)
		regex = new RegExp('(.*>[^<]*)('+ gRef[p_g] +')([^>]*<.*)', 'ig');
		
		cont_secc.innerHTML = cont_secc.innerHTML.replace(regex, textoNuevo);
	}
	
	if( secc!='txt_resaltar' && secc!='nombre_rs' && secc!='d_men_sup' )
	{
		timerResaltSecc= setTimeout("next_secc()", 300);
	}
}

var arr_secc_v= new Array();


//es importante el orden de este array
var seccio= new Array();
//seccio['nombre_rs']= 0;
//seccio.push('d_men_sup');
seccio.push('d_sin');
seccio.push('d_trad');
seccio.push('d_fot');
seccio.push('d_prod_otros');
seccio.push('d_prod_rel');
seccio.push('d_prov');
seccio.push('d_comp');
seccio.push('d_clt');
seccio.push('d_emp');
seccio.push('d_ofer');
seccio.push('d_pre');
//seccio.push('d_not');
seccio.push('d_for');
seccio.push('d_car');

seccio.push('d_prop_f');
seccio.push('d_prop_q');
seccio.push('d_prop_fq');
seccio.push('d_prop_cuantitativas');
seccio.push('d_prop_salud');
seccio.push('d_prop_seguridad');

//seccio.push('d_art');
seccio.push('d_fra');

//NUEVAS SECCIONES, 22-05-2009
seccio.push('d_apli');
seccio.push('d_def');
seccio.push('d_sug');
seccio.push('d_apor_com');
seccio.push('d_masi');
seccio.push('d_preg');

seccio.push('d_men_inf');

var recorre_arr_secc;
var cancela_resalt_secc= true;
function ini_pos_secc()
{
	resalt_secc('nombre_rs');
	resalt_secc('d_men_sup');
}
function verif_secc()
{
	if( gRef.length==0 )
	{
		document.getElementById('echo_string').innerHTML="";
		return;
	}
	setStyle('img_resalt_inicia', 'display', 'none');
	setStyle('img_resalt_cancela', 'display', 'block');
	
	cancela_resalt_secc= false;
	recorre_arr_secc= (seccio.join()).split(',');
	ini_pos_secc();
	next_secc();
}
function next_secc()
{
	if( recorre_arr_secc.length>0 )
	{
		if( cancela_resalt_secc )
		{
			setStyle('img_resalt_cancela', 'display', 'none');
			setTimeout("setStyle('img_resalt_inicia', 'display', 'block')", 450);
			
			window.clearTimeout(timerResaltSecc);
			recorre_arr_secc= new Array();
			resalt_monitor(leyenda['txt_cancelando']+'...');

			setTimeout("resalt_monitor('&nbsp;')", 500);
			return;
		}
		sig_secc= recorre_arr_secc.shift();
		resalt_secc(sig_secc);
	}
	else
	{
		resalt_monitor('&nbsp;');
		setStyle('img_resalt_cancela', 'display', 'none');
		setStyle('img_resalt_inicia', 'display', 'block');
	}
}
function cambioString()
{
	var regex_aux;
	gRef= new Array();
	var usuRef= new String( document.getElementById('string').value );
	if( usuRef=="" )
	{
		document.getElementById('echo_string').innerHTML="";
		return;
	}
	regex_aux = new RegExp('(\\s+)([a-z]{1,2})(\\s+)', 'ig');// le falta optimizarce
	usuRef= usuRef.replace(regex_aux, ' ');

	regex_aux = new RegExp('([^\\sa-zñáéíóúàèìòùàãâäêîĩôõûũ]+)', 'ig');
	usuRef= usuRef.replace(regex_aux, ' ');

	regex_aux = new RegExp('([\\s]+)', 'ig');
	usuRef= usuRef.replace(regex_aux, ' ');
	if( usuRef=="" )
	{
		document.getElementById('echo_string').innerHTML="";
		return;
	}
	gRef= usuRef.split(/\s/g);
	if( gRef.length==0 )
	{
		document.getElementById('echo_string').innerHTML="";
		return;
	}
	document.getElementById('echo_string').innerHTML= '&quot;'+gRef.join(' ')+'&quot;';
	resalt_secc('txt_resaltar');
}
var leyendas_secc= new Array();
function nombre_secc(secc)
{
	return leyendas_secc[secc]? leyendas_secc[secc] : secc;
}

$(function(){
	inicia_pp();
});
$(window).resize(function(){
  reinicio_pp();
});