
function Validar_Entero(ctr){
	var pos = -1;
	for (var i=0;i<ctr.value.length;i++) {
		if (ctr.value.charAt(i)<'0'||ctr.value.charAt(i)>'9'){
			ctr.value='';
			break;
		}
		if (pos==-1&&ctr.value.charAt(i)!='0'){
			pos=i;
		}
	}
	ctr.value=(ctr.value=='')?'':parseInt(ctr.value.substr(pos));
}

function abrirPopup(){
    prop = "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=1000, height=380, top=100, left=150"
	codia1 = document.getElementById('hdnCodia1').value;
	codia2 = document.getElementById('hdnCodia2').value;
	if((codia1 != "") && (codia2 != "")){
		window.open('indice_comparacion.aspx?codia1=' + codia1 + '&codia2=' + codia2, 'PopUp2', prop);
	}else{
		alert('No se pueden comparar los vehiculos, si no estan ambos seleccionados.');
	}
	resetValores(2);
	resetValores(1);
	return false;
}

function resetValores(id){
	document.getElementById('hdnFila').value = id;	
	document.getElementById('hdnCodia' + id).value = "";
	document.getElementById('txtMarca' + id).value = "";
	document.getElementById('txtModelo' + id).value = "";
	document.getElementById('txtVersion' + id).value = "";
	document.getElementById('txtPrecio' + id).value = "";
	document.getElementById('txtResultado' + id).value = "";		
}