<script>
var A= new Array(
new Array ('1','2','3'),
new Array ('2','5','1'),
new Array ('3','1','5'));
function Lin(x){
var size=2;
for (var dimension=0; dimension<size; dimension++){
for (var i=dimension; i<size;){
for(var j=dimension; j<size; j++){
if(A[dimension][dimension]!=0){
A[dimension][j]=A[dimension][j]/A[dimension][dimension];
A[i+1][j]=A[i+1][j]-A[i+1][dimension]*A[dimension][j];
i++;
}
else {
i++;
}
}
}
}
return A;
}
alert(Lin());
</script>