var scrollID = 0;

function VerPanel(seccion) {	
	if(document.getElementById(seccion)) {
		if (document.getElementById(seccion).style.display == 'none') {
			document.getElementById(seccion).style.display = 'block';
		} else	{
			document.getElementById(seccion).style.display = 'none';
		}
	}
	scrollID = setTimeout("doscroll()",800);
}

function doscroll(){
   clearTimeout(scrollID);
   window.scrollTo(0, 0);
}

function ocultar_votos_ventana() {
	document.getElementById('VotosVentanaYaVoto').style.display = 'none';
}


function Flash(movie, w, h, flashvars, transparent) {
	document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">');
	document.write ('	<param name="movie" value="'+ movie +'">');
	document.write ('	<param name="quality" value="high">');
	document.write ('	<param name="flashvars" value="'+ flashvars +'">');
	document.write ('	<param name="menu" value="0">');
	document.write ('	<param name="wmode" value="'+ transparent +'">');
	document.write ('	<embed src="'+ movie +'" flashvars="'+ flashvars +'" wmode="'+ transparent +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ w +'" height="'+ h +'"></embed>');
	document.write ('</object>');
}

function o(td) {
	td.style.backgroundColor='';
}
function h(td) {
	td.style.backgroundColor='F0F0F0'; td.style.cursor="hand";
}

function hrf(url) {
	document.location.href = url;
}

function ow(page, name, w, h) {
  window.open(page,name,"resizable=0,width="+w+",height="+h+",left=10,top=10,scrollbars=no");
}

function ows(page, name, w, h) {
  window.open(page,name,"resizable=0,width="+w+",height="+h+",left=50,top=50,scrollbars=yes");
}

function hrf(url) {
	document.location.href = url;
}

function foco(obj) {
	if (obj) { obj.focus(); }
}

function confirmar(url, mensaje) {
	if ( confirm(mensaje) )
	document.location.href = url;
}

function resize() {
	if (document.images[0]) window.resizeTo(document.images[0].width+10, document.images[0].height+29);
		self.focus();
	}

function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
		//otherwise, update 'characters left' counter;
	else
		countfield.value = maxlimit - field.value.length;
}

function cambiar_estilo(objeto, nombre_estilo, estilo_restaurar) {
	if (objeto) {
		if (document.getElementById(objeto).className == nombre_estilo) {
				document.getElementById(objeto).className = estilo_restaurar;
			}
		else {
				document.getElementById(objeto).className = nombre_estilo;
		}
	}
}

function encuesta_validar(form) {
	var f = form;
	var i;
	for(i=0;i<f.votes.length;i++) {
		if (f.votes[i].checked == true)
			return true;
	}
	//alert('Debe seleccionar alguna opción!');
	return false;
}

function seleccionarTodos(objeto) {
	var i;
	var f = document.form;
	for(i=0;i<f.elements.length;i++)
	{
		e = f.elements[i];

		if (e.type == 'checkbox' && e.name == objeto) {
			e.checked =f.chkTodos.checked;
		}

	}
}

function seleccionarTodosTR(objeto, tr_prefijo, tr_estilo, tr_estilo_restaurar) {
	var i;
	var f = document.form;
	for(i=0;i<f.elements.length;i++)
	{
		e = f.elements[i];

		if (e.type == 'checkbox' && e.name == objeto) {
			e.checked = f.chkTodos.checked;

			if (e.checked) {
				document.getElementById(tr_prefijo + e.value).className = tr_estilo;
			} else {
				document.getElementById(tr_prefijo + e.value).className = tr_estilo_restaurar;
			}
		}

	}
}

function ref()
{
  self.location.reload();
}

function enviacontacto(){
   var ctrl = $('tablacontacto');
   if (ctrl!=null) {
      ctrl.style.display = 'none';
   } 
   var ctrl = $('cargandocontacto');
   if (ctrl!=null) {
      ctrl.style.display = '';
   }                     
}


var strWait = '<div style="margin-top:30px; margin-left:50px;"><center><img src="../Images/preloader.gif" /><br /><br /> <img src="../Images/buscando.gif" /></center></div>';

function showWaitLog(ms){

    if (Page_ClientValidate()){

    $('frml0g').hide();
    $('waitl0g').innerHTML = strWait.replace('%MS%', ms);
    
    }
    
}