function read(){
	var a = document.getElementById("a").value;
	var b = document.getElementById("b").value;
	var c = document.getElementById("c").value;

	var coef=[a,b,c];

	return coef;
}

function solveDelta(coef){
	var deltaa=coef[1]*coef[1] - 4*coef[0]*coef[2];
	return deltaa;

}

function solveRoots(coef,delta){
	var x1=x2=x1im=x2im=0;
	if(delta==0){
		x1=(-coef[1])/(2*coef[0]);
		x2=(-coef[1])/(2*coef[0]);
	}
	else if(delta<0) {
		x1=(-coef[1])/2*coef[0];
		x1im=Math.sqrt(-delta)/2*coef[0];
		x2=(-coef[1])/2*coef[0];
		x2im=-Math.sqrt(-delta)/2*coef[0];
		// document.getElementById("x1").innerHTML =x1.toString()+"+"+x1im.toString()+"i";
		// document.getElementById("x2").innerHTML =x2.toString()+x2im.toString()+"i";	
	}
	else if(delta>0){
		x1 = ((-coef[1])+Math.sqrt(delta))/(2*coef[0]);
		x2 = ((-coef[1])-Math.sqrt(delta))/(2*coef[0]);
		// document.getElementById("x1").innerHTML = "x1 =" + x1;
		// document.getElementById("x2").innerHTML = "x2 =" + x2;
	}
	var radacini=[x1,x2,x1im,x2im];
	return radacini;
}

function showAnswer(radacini){

	document.getElementById("x1").innerHTML = "x1 =" + radacini[0] + "+" + radacini[2] + "i";
	document.getElementById("x2").innerHTML = "x2 =" + radacini[1] + radacini[3] + "i";
}

function solve(){
			x1=x2=x1im=x2im=0;
			var coef = read();
			var deltaa = solveDelta(coef);
			var radacini=solveRoots(coef,deltaa);
			
			// document.getElementById("delta").innerHTML = "Delta=" + delta;
			showAnswer(radacini);
			document.getElementById("delta").innerHTML = "Delta=" + deltaa;
			document.getElementById("aa").innerHTML = "a= " + coef[0];
			document.getElementById("bb").innerHTML = "b= " + coef[1];
			document.getElementById("cc").innerHTML = "c= " + coef[2];



			
		}	

@@ -220,17 +220,16 @@
 ar delta
-a
 =coef%5B1%5D
@@ -271,17 +271,16 @@
 rn delta
-a
 ;%0A%0A%7D%0A%0Afu
@@ -560,174 +560,8 @@
 %5B0%5D;
-%0A%09%09// document.getElementById(%22x1%22).innerHTML =x1.toString()+%22+%22+x1im.toString()+%22i%22;%0A%09%09// document.getElementById(%22x2%22).innerHTML =x2.toString()+x2im.toString()+%22i%22;
 %09%0A%09%7D
@@ -681,20 +681,139 @@
 f%5B0%5D);%0A%09
-%09// 
+%7D%0A%09var radacini=%5Bx1,x2,x1im,x2im%5D;%0A%09return radacini;%0A%7D%0A%0Afunction showAnswer(radacini)%7B%0A%09if(radacini%5B2%5D%7C%7Cradacini%5B3%5D!=0)%7B%0A%09%09
 document
@@ -859,17 +859,49 @@
 %22 + 
-x1
+radacini%5B0%5D + %22+%22 + radacini%5B2%5D + %22i%22
 ;%0A%09%09
-// 
 docu
@@ -951,101 +951,52 @@
 %22 + 
-x2;%0A%09%7D%0A%09var radacini=%5Bx1,x2,x1im,x2im%5D;%0A%09return radacini
+radacini%5B1%5D + radacini%5B3%5D + %22i%22
 ;%0A
+%09
 %7D%0A
-%0Afunction showAnswer(radacini)%7B%0A%0A
+%09else%7B%0A%09
 %09doc
@@ -1058,36 +1058,11 @@
 i%5B0%5D
- + %22+%22 + radacini%5B2%5D + %22i%22
 ;%0A
+%09
 %09doc
@@ -1120,38 +1120,23 @@
 acini%5B1%5D
- + radacini%5B3%5D + %22i%22;%0A
+;%0A%09%7D %0A%09
 %7D%0A%0Afunct
@@ -1151,16 +1151,19 @@
 e()%7B%0A%09%09%09
+// 
 x1=x2=x1
@@ -1207,17 +1207,16 @@
 ar delta
-a
  = solve
@@ -1269,85 +1269,11 @@
 elta
-a
 );%0A
-%09%09%09%0A%09%09%09// document.getElementById(%22delta%22).innerHTML = %22Delta=%22 + delta;%0A
 %09%09%09s
@@ -1357,17 +1357,16 @@
  + delta
-a
 ;%0A%09%09%09doc

Split functions.