

function getPage(page) {
         document.location = page;
}

function newWindow(pag)  {
		window.open(pag);
   }

function setValue(element, value) {
	
      if(value!="undefined" && value!=null)  {
        value = trim(value);
        document.getElementById(element).value = value;
      }
   }
   
function trim(cadena)
{
	for(i=0; i<cadena.length; )
	{
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(i+1, cadena.length);
		else
			break;
	}

	for(i=cadena.length-1; i>=0; i=cadena.length-1)
	{
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(0,i);
		else
			break;
	}
	return cadena;
}   
function isEmpty(value, name, msg) {
var resul = " ";
value = document.getElementById(value).value;
 for (var i=0; i<value.length; i++) { 
   if ((" \t\n\r").indexOf(value.charAt(i))==(-1)) 
		 return resul;
 }
 return (name+" "+msg+"\n");    
}

function show(pID)   {
  	var obj = document.getElementById(pID);
	document.getElementById(pID).style.display ="block";
}

function hide(pID)   {
  	var obj = document.getElementById(pID);
	document.getElementById(pID).style.display ="none";
}

function printit(){  
var NS = (navigator.appName == "Netscape");
if (NS) {
    window.print() ;  
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
}
}

function  selectInCombo(form,comboName,code) {

    var attributes = form.elements;
    
    var h=0;
    var end=false;
    while ((end==false)&&(h<attributes.length)){

	    if (attributes[h].type == "select-one") {
	    
	    	if (attributes[h].name==comboName) {   		    	
	    		var selection=1; var done=false;

	    		while ((done==false)&&(selection<attributes[h].options.length))
	    		{
			    	if (attributes[h].options[selection].value==code) {
			    		attributes[h].selectedIndex = selection;
			    		done=true;
			    	}		
 	
			    	selection++;
			    }	
			    end=true;		    	
			}		  	         					
		}
		h++;
      }
    } 
    
function overStar(id)
{
	var txt;
	if(id == 1)
		txt = "<br><b>Muy Malo</b>";
	if(id == 2)
		txt = "<br><b>Malo</b>";
	if(id == 3)
		txt = "<br><b>Regular</b>";
	if(id == 4)
		txt = "<br><b>Bueno</b>";
	if(id == 5)
		txt = "<br><b>Muy Bueno</b>";
	if(id == 0)
		txt = document.getElementById('votacion_inicial').value;		
	document.getElementById('votacion').innerHTML= txt;
}
    
function traducirNivel(id)
{
	var txt;
	if(id == 0)
		txt = "Principiante";
	if(id == 1)
		txt = "Amateur";
	if(id == 2)
		txt = "Avanzado";
	if(id == 3)
		txt = "Profesional";
	document.write(txt);
}    

function traducirDias(id)
{
	var txt;
	if(id == 0)
		txt = "Indiferente";
	if(id == 1)
		txt = "Diario";
	if(id == 2)
		txt = "F. Semana";
	document.write(txt);
} 

function traducirHoras(id)
{
	var txt;
	if(id == 0)
		txt = "Indiferente";
	if(id == 1)
		txt = "Maņana";
	if(id == 2)
		txt = "Tarde";
	if(id == 3)
		txt = "Noche";
	document.write(txt);
} 

function traducirStatus(id)
{
	var txt;
	if(id == 0)
		txt = "<font color='#895642'>Nuevo</font>";
	if(id == 1)
		txt = "<font color='#00DD00'>Aceptado</font>";
	if(id == 2)
		txt = "En curso";
	if(id == 3)
		txt = "<font color='#DD0000'>No aceptado</font>";
	if(id == 4)
		txt = "<font color='#DD0000'>Cerrado</font>";
	document.write(txt);
} 

function nameStatus(nameUs, id)
{
	var txt;
	if(id == 0)
		txt = "<font color='#895642' style='font-size: 14px;'>"+nameUs+"</font>";
	if(id == 1)
		txt = "<font color='#00DD00' style='font-size: 14px;'>"+nameUs+"</font>";
	if(id == 2)
		txt = "En curso";
	if(id == 3)
		txt = "<font color='#DD0000' style='font-size: 14px;'>"+nameUs+"</font>";
	if(id == 4)
		txt = "<font color='#DD0000' style='font-size: 14px;'>"+nameUs+"</font>";
	document.write(txt);
} 

function traducirSexo(id)
{
	var txt;
	if(id == 0)
		txt = "Hombre";
	if(id == 1)
		txt = "Mujer";			
	document.write(txt);
} 

function traducirEdad(id)
{
	var txt;
	if(id == 0)
		txt = "hasta 9 aņos";
	if(id == 1)
		txt = "10 a 19 aņos";
	if(id == 2)
		txt = "20 a 29 aņos";
	if(id == 3)
		txt = "30 a 39 aņos";
	if(id == 4)
		txt = "40 a 49 aņos";
	if(id == 5)
		txt = "50 a 59 aņos";
	if(id == 6)
		txt = "60 a 69 aņos";
	if(id == 7)
		txt = "+ 70 aņos";
			
	document.write(txt);
}

