Finding the imaginary part of the complex number
var imaginary = s . substr ( i + 1 , l - 1 ) ; var x = parseInt ( real ) ; var y = parseInt ( imaginary ) ; if ( x > 0 && y > 0 ) document . write ( " " ) ; else if ( x < 0 && y > 0 ) document . write ( " " ) ; else if ( x < 0 && y < 0 ) document . write ( " " ) ; else if ( x > 0 && y < 0 ) document . write ( " " ) ; else if ( x == 0 && y > 0 ) document . write ( " " + " " ) ; else if ( x == 0 && y < 0 ) document . write ( " " + " " ) ; else if ( y == 0 && x < 0 ) document . write ( " " + " " ) ; else if ( y == 0 && x > 0 ) document . write ( " " + " " ) ; else document . write ( " " ) ; }