function centrar(ancho,alto){
	var anchoCentro,altoCentro
	anchoCentro=window.screen.width/2-parseInt(ancho)/2;
	altoCentro=window.screen.height/2-parseInt(alto)/2-30;
	window.moveTo(anchoCentro,altoCentro);	
}
		
function validarFecha(f){
	var d=f.value;
	var a=d.indexOf("/")
	var z=d.lastIndexOf("/")
	if(f!=""){
		dia=d.substring(0,a);
		mes=d.substring(a+1,z);
		anio=d.substring(z+1,d.length);
		if(a<0 || (a==z)){
			alert("Fecha Incorrecta, el formato debe ser --/--/----");
		}
	}
}

function confirmar(){
	if(window.confirm("Desea borrar el registro?")==true){
		return true;
	}else{
		return false;	
	}
}

function confirmar2() {
    if (window.confirm("Desea descartar la imagen?") == true) {
        return true;
    } else {
        return false;
    }
}

function borrar(objeto){
	objeto.value=""
}

function checkboxes (chk, id) { 
	var frm = document.forms[0];
	var nombre;
	for (i=0;i<frm.length; i++) {
		if(id.indexOf ("chkSeleccionarTodas") != -1) {
			if(chk == true) {
				if(frm.elements[i].id.indexOf("chkSeleccionar")!=-1){
					frm.elements[i].checked = true;
				}
			} else {
				if(frm.elements[i].id.indexOf("chkSeleccionar")!=-1){
					frm.elements[i].checked = false;
				}
			}
		} else if (id.indexOf ("chkSeleccionar") != -1) {
			if(frm.elements[i].checked ==false) {
				frm.chkSeleccionarTodas.checked = false;
			}
		}
	}
}

function confirmarCheckbox () {
	var frm=document.forms[0];
	for (i=0;i<frm.length; i++) {
		if(frm.elements[i].id.indexOf("chkSeleccionar") !=-1) {
			if(frm.elements[i].checked) {
				return confirm ("Desea borrar el(los) registro(s)?");
			}
		}
	}
}

function registro(){
	var frm=document.forms[0];
	if(frm.chkPrivacidad.checked==true){
		frm.submit();
	}
}

function facturacion(){
	var frm=document.forms[0];

	if(frm._ctl0_contenido_chkFacturacion.checked==true){
		frm._ctl0_contenido_txtDireccionFacturacion.value=frm._ctl0_contenido_txtDireccionPostal.value;
		frm._ctl0_contenido_txtLocalidadFacturacion.value=frm._ctl0_contenido_txtLocalidadPostal.value;
		frm._ctl0_contenido_txtProvinciaFacturacion.value=frm._ctl0_contenido_txtProvinciaPostal.value;
		frm._ctl0_contenido_txtCPFacturacion.value=frm._ctl0_contenido_txtCPPostal.value;
		frm._ctl0_contenido_txtPaisFacturacion.value=frm._ctl0_contenido_txtPaisPostal.value;
	}
}

function popUp(URL,nombreVentana) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL,nombreVentana, 'toolbar=NO,scrollbars=yes,location=0,statusbar=1,status=1,menubar=0,resizable=1,width=766,height=600');");
}

function cambiar(fila, link) {
    fila.style.backgroundColor = "white";
    link.style.color = "gray"
    //link.style.color = "gray";
}

function restaurar(fila, link) {
    fila.style.backgroundColor = "gray";
    link.style.color = "white";
}

function cambiar2(fila, link) {
    fila.style.backgroundColor = "white";
    link.style.color = "gray"
    //link.style.color = "gray";
}

function restaurar2(fila, link) {
    fila.style.backgroundColor = "gray";
    link.style.color = "black";
}

function preloadImages() {
  var d=document; 
  if(d.images){ 
	if(!d.p) d.p=new Array();
	var i,j=d.p.length,a=preloadImages.arguments; 
	for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}
  }
}
