<?xml   version="1.0"  encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Quadratic Equation Solver" 
category="tools"
category2="technology"
description="This script will factor and solve for both values of X, any quadratic equation that has real number solutions." 
title_url="http://gadget-blog.ro/" 
author="Johnny Kind" 
author_email="wattaman.a@gmail.com"  
author_photo="http://farm7.static.flickr.com/6104/6266524214_0d6f3254ec_m.jpg" 
author_aboutme="Hey, check out http://cafebar.ro/" 
author_location="Bangkok, Thailand"
author_quote="I like doing gadgets!"
author_link="http://real-estate-th.com/author/wattaman" 
screenshot="http://farm8.staticflickr.com/7172/6470916139_ebb55f9489.jpg" 
thumbnail="http://farm8.staticflickr.com/7172/6470916139_ebb55f9489.jpg" 
height="225" width="240">
  </ModulePrefs>
<Content type="html" view="home">
<![CDATA[

<script language="javascript" type="text/javascript">
var a,b,c,x1,x2
function getValues(){
signB=(document.form.firstSign.value=="+")? 1 :-1
signC=(document.form.secondSign.value=="+")? 1 :-1
a=document.form.x2Coef.value
b=document.form.xCoef.value*signB
c=document.form.endValue.value*signC}
function solveForX(){
x1=((-1*b)+Math.sqrt((b*b)-4*a*c))/(2*a)
x2=((-1*b)-Math.sqrt((b*b)-4*a*c))/(2*a)
if(document.form.round.checked){
x1=Math.round(x1*1000)/1000
x2=Math.round(x2*1000)/1000}}
function factorEq(){
if((Boolean(x1)!=false)&&(Boolean(x2)!=false)){
x1Print=((x1*-1)>0)? "+"+(x1*-1): x1*-1
x2Print=((x2*-1)>0)? "+"+(x2*-1): x2*-1
aPrint=(a>1 || a<0)? a : ""
document.getElementById('testing').innerHTML="<font color=\"red\">The Solutions Are:</font><br>x1 = "+x1+"; x2 = "+x2+"<br><font color=\"red\"> The Equation Is:</font><br> "+aPrint+"(x "+x1Print+") (x "+x2Print+")"
}else{
document.getElementById('testing').innerHTML="<font color=\"red\"><b>YOUR INPUT PRODUCED AN ERROR:</b></font><br> You have entered a non-integer into one of the fields above, or the solution(s) for your equation is(are) an imaginary(s) number!"}}
function SolveEq(){
getValues()
solveForX()
factorEq()}
</script><center><iframe border=0 frameborder=0 height=60 marginheight=0 marginwidth=0 name=explain scrolling=no src=http://atat.ro/about.html title=Portal width=234></iframe></center>
<form name="form"><b><input type="text" name="x2Coef" size="2" value="1"> X<sup>2</sup> <select name="firstSign"><option value="+">+</option><option value="-">-</option></select> <input typle="text" name="xCoef" size="2" value="1"> X <select name="secondSign"><option value="+">+</option><option value="-">-</option></select> <input type="text" name="endValue" size="2"> <br><input type="button" style="float:right;right:3px" value="Solve!" onClick="SolveEq()">Round? <input type="checkbox" name="round"> Yes      </b></form><p id="testing">The Solution Will Appear Here!</p>

<br><span style="float:right"><a href="http://gadget-blog.ro">Gadget Blog</a></span>

]]>
</Content>
</Module>