function abre_ventanuko(urle,ancho,alto,barras,nomventana)
{
	var nombre
	if (nomventana==undefined) {nombre='ventanuko'}
	else {nombre=nomventana}
	window.open(urle,nombre,"toolbar=no,resizable=no,location=no,directories=no,status=no,menubar=no,scrollbars="+barras+",top=0,left=0,innerWidth="+ancho+",width="+ancho+",height="+alto);
}

function colocaBoton(ruta,link)
{
    document.write('<a href="'+link+'"><img src="img/'+ruta+'.jpg" onmouseout="document.getElementById(\''+ruta+'\').src = \'img/'+ruta+'.jpg\';" onmouseover="document.getElementById(\''+ruta+'\').src = \'img/'+ruta+'_R.jpg\';" id="'+ruta+'" /></a>');
}

function colocaBotonPNG(ruta,link)
{
    document.write('<a href="'+link+'"><img src="img/'+ruta+'.png" onmouseout="document.getElementById(\''+ruta+'\').src = \'img/'+ruta+'.png\';" onmouseover="document.getElementById(\''+ruta+'\').src = \'img/'+ruta+'_R.png\';" id="'+ruta+'" /></a>');
}

function ebConversion(conversionID, redirURL, targetWin)
{
	try
	{
		var elem = document.createElement("SCRIPT");
		elem.src = "http://bs.serving-sys.com/BurstingPipe/ActivityServer.bs?cn=as&ActivityID=" + conversionID + "&rnd=" + (Math.round(Math.random() * 1000000));
		document.body.appendChild(elem);
		
		if(typeof(redirURL) != "undefined")
		{
			if(typeof(targetWin) == "undefined" || targetWin == "_blank")
			{
				window.open(redirURL);
			}
			else
			{
				
				var redirFunction = function() {document.location.href = redirURL};
				setTimeout(redirFunction, 1000);
			}
		}
	}
	catch(e) {}
}

function cmail(email){ 
 var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ 
 return email.match(re) 
}

function getHTTPObject() {
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
       try {
          xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (E) { xmlhttp = false; }
       }
    @else
    xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
       try {
          xmlhttp = new XMLHttpRequest();
       } catch (e) { xmlhttp = false; }
    }
    return xmlhttp;
}

function rellenarDias(ultimodia){
    //alert(document.forms.formRegistro.dia.selectedIndex);
    var diaSeleccionado = (document.forms.formRegistro.dia.selectedIndex);
    if (diaSeleccionado == -1) diaSeleccionado = 0;

    document.forms.formRegistro.dia.options.length = 0;

    for(i=1;i<=ultimodia;i++){
    
        var elOptNew = document.createElement('option');
        elOptNew.text = i;
        elOptNew.value = i;                                                
    
        try {
        document.forms.formRegistro.dia.add(elOptNew, null); // standards compliant; doesn't work in IE
        }
        catch(ex) {
        document.forms.formRegistro.dia.add(elOptNew); // IE only
        }                                                                                                
    
    }
    
    if (diaSeleccionado>document.forms.formRegistro.dia.options.length) diaSeleccionado = 0;
    else document.forms.formRegistro.dia.selectedIndex = diaSeleccionado;
  
}

function rellenarMes(){

    for(i=1;i<=12;i++){
    
        var elOptNew = document.createElement('option');
        elOptNew.text = i;
        elOptNew.value = i;                                                
    
        try {
        document.forms.formRegistro.mes.add(elOptNew, null); // standards compliant; doesn't work in IE
        }
        catch(ex) {
        document.forms.formRegistro.mes.add(elOptNew); // IE only
        }                                                                                                
    
    }                                            

}

function rellenarAnyos(){
	//alert("H");
    for(i=2010;i<=2011;i++){
    
        var elOptNew = document.createElement('option');
        elOptNew.text = i;
        elOptNew.value = i;
        if(i==2011) elOptNew.selected = true;                                                
    
        try {
        document.forms.formRegistro.anyo.add(elOptNew, null); // standards compliant; doesn't work in IE
        }
        catch(ex) {
        document.forms.formRegistro.anyo.add(elOptNew); // IE only
        }                                                                                                
    
    }                                            

}
function rellenarAnyosReg(){
	//alert("H");
    for(i=1900;i<=2011;i++){
    
        var elOptNew = document.createElement('option');
        elOptNew.text = i;
        elOptNew.value = i;
        if(i==1970) elOptNew.selected = true;                                                
    
        try {
        document.forms.formRegistro.anyo.add(elOptNew, null); // standards compliant; doesn't work in IE
        }
        catch(ex) {
        document.forms.formRegistro.anyo.add(elOptNew); // IE only
        }                                                                                                
    
    }                                            

}

function daysInMonth(month,year) {
	//alert(year);
    var dd = new Date(year, month, 0);
    return dd.getDate();
}                 

function cambiaDias(){
    rellenarDias(daysInMonth(document.forms.formRegistro.mes.selectedIndex+1,document.forms.formRegistro.anyo.selectedIndex));
}  

var numb = "0123456789";
var alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
var alphanumb = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
function res(t,v){
    var w = "";
    for (i=0; i < t.value.length; i++) {
    x = t.value.charAt(i);
    if (v.indexOf(x,0) != -1)
    w += x;
    }
    t.value = w;
}

function showPopupValor(mostrar)
{
	document.getElementById("popupValor").style.visibility = mostrar;

}
