<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
	body, td {
		font-size: 10pt;
	}
	input{
		font-size:10pt;
		font-family:monospace;
	}
	input[type="button"]{
		font-family: Times;
</style>
<script type="text/javascript">
    var theLanguage = parent.theLanguage;
    var pathPrefix = "../../../"; // path to base directory
    function addText(x,y){return(theLanguage=="en")?x:y}
</script>
<script type="text/javascript" src = "SVGLite.js"></script>
<script type="text/javascript" src = "grapherCode.js"></script>
<script type="text/javascript">
//<![CDATA[
var boxWidths=450;

graphDocNameGiven = true;
var theDocObj=document;
var grapher1 = new grapher("grapher1",400,300);
with(grapher1) {
        curvesColors = ["red","palegreen","orange","darkviolet","yellow","lightskyblue","green","blue","olive","steelblue","indianred","purple","teal","magenta","cyan","lime","sienna","hotpink"];
	curveWt = 0.5;
	//adaptive = true;
	isPopup=false;
	popupURL="graphWindow.html"
	pointsPerCurve = 2; // after all, these are straight lines...
	showCoords = 1;
	showScalex=true;
	showScaley=true;
        //nudgeRightyValues=.05;
	//nudgeDownxValues=.1; // actually nudeges them up......
        //yValuesShown = [0,1,2];
	coordsColor ="black";
	gridColor = "silver";
	pointsColor = "indianred";
	backgroundColor = "white";
	surroundColor = "white";
	borderColor="teal";
	yGrid = "on";
	xGrid = "on";
	yAxis = "on";
	yGridStep = 1;
	xGridStep = 1;
	xLabelsBelow = true;
	yLabelsLeft = true;
	edgeBuffer = 2;
	leftMargin=10;
	rightMargin=10;
	topMargin=10;
	bottomMargin=10;
	ifrMargin=20;
	window = [0,10,0,10];
	clipMargins=[0,0,0,0];
	draggableBars = 0;
	plottedCurves = [];
	//plottedPointsX = parent.plottedPointsX;
	//plottedPointsY = parent.plottedPointsY;
	tracing = 1;
	traceColor = "firebrick";
	xLabelFontSize=10;
	yLabelFontSize=10;
	}
xHeight = 4;
dotRadius=4;
var deltaYShift=(SAFJS)? 2:0;


//alert(grapher1.totHt)



// function putText(theGraph, inStr, theStyle, theFontSize,  x1,y1, offsetX, offsetY, areScreenCoords, overrideBorders,bgColor,centering)


function showLanguage(theLanguage) {
if (theLanguage == "en") var inarray = document.getElementsByTagName("es");
else var inarray = document.getElementsByTagName("en");
var numInlines = inarray.length;
for (var i = 0; i <= numInlines-1; i++) {
	inarray[i].innerHTML = '';
	}
    }
	
function initialActions() {
showLanguage(theLanguage)
xMin=0;xMax=10;yMin=0;yMax=10; // bad programming - sometiemes call then a, b, c, d is the problemm
setUpGraph(grapher1);
var graphDoc = getDoc (grapher1);
var graphElt= graphDoc.getElementById("myGraph");
graphElt.setAttributeNS(null,"viewBox"," 0 0 " + grapher1.totWdth + " " + grapher1.totHt);

}


function readBasics() {
// get the information from the web page
	for (var k = 1; k <= 1; k++)
	{
	var aa = document.theForm.a.value; 
	if (aa == "") { document.theForm.output.value = "You have not entered a number for xMin."; okToRoll = false; break;}
	a = eval(aa);
	if (isNaN(a) ) { document.theForm.output.value = "You have not entered a number for xMin."; okToRoll = false; break;}
	var bb = document.theForm.b.value; 
	if (bb == "") { document.theForm.output.value = "You have not entered a number for xMax."; okToRoll = false; break}
	b = eval(bb); 
	if (isNaN(b) ) { document.theForm.output.value = "You have not entered a number for xMax."; okToRoll = false; break;}
	if ( (okToRoll) && (a >= b)) { document.theForm.output.value = "xMax should be larger than xMin"; okToRoll = false; break;}
	var cc = document.theForm.c.value; 
	if (cc == "") { document.theForm.output.value = "You have not entered a number for yMin"; okToRoll = false; break}
	c = eval(cc); 
	if (isNaN(c) ) { document.theForm.output.value = "You have not entered a number for yMin."; okToRoll = false; break;}
	var dd = document.theForm.d.value; 
	if (dd == "") { document.theForm.output.value = "You have not entered a number for yMax."; okToRoll = false; break}
	d = eval(dd); 
	if (isNaN(d) ) { document.theForm.output.value = "You have not entered a number for yMax."; okToRoll = false; break;}
	if ( (okToRoll) && (c >= d)) { document.theForm.output.value = "yMax should be larger than yMin"; okToRoll = false; break;}
	var xk = document.theForm.xg.value;
	if (xk == "") xGridStep = 0;
	else xGridStep = eval(xk);
	var yk = document.theForm.yg.value;
	if (yk == "") yGridStep = 0;
	else yGridStep = eval(yk);
	} // end of single loop
}
//************** Miscellanous constants:

if (theLanguage == "en") {
	var gridLinesXSet = "X-Gridlines every:";
	var gridLinesYSet = "Y-Gridlines every:";
	var unitsWord = "units";
	var enterXMinMsg = "You have not entered a number for xMin.";
	var enterXMaxMsg = "You have not entered a number for xMax.";
	var maxLtMinMsg = "xMax should be greater than xMin";
	var maxyLtMinMsg = "yMax should be greater than yMin";
	var yMinMsg = "Enter a number for yMin or check 'Auto'."; 
	var yMaxMsg = "Enter a number for yMax or check 'Auto'.";
	var numSigDigMsg = "The Number of Significant Digits must be a number. I am setting it back to 5. Change it to another number if you like.";

	}
else {
	var gridLinesXSet = "L&#237;neas de cuadr&#237;cula X cada:";
	var gridLinesYSet = "L&#237;neas de cuadr&#237;cula X cada:"; 
	var gridLinesRSet = "L&#237;neas radiales cada &pi;/";
	var unitsWord = "unidades";
	var enterXMinMsg = "No has ingresado un n&uacute;mero para xMin.";
	var enterXMaxMsg = "No has ingresado un n&uacute;mero para xMax.";
	var maxLtMinMsg = "xMax debe ser mayor que xMin";
	var maxyLtMinMsg = "yMax debe ser mayor que yMin";
	var yMinMsg = "Ingresa n&uacute;mero para yMin o marca 'Auto'."; 
	var yMaxMsg = "Ingresa n&uacute;mero para yMax o marca 'Auto'.";
	var numSigDigMsg = "El n&uacute;mero de d&#237;gitos significados debe ser un n&uacute;mero. Estoy cambiando su valor a 5. Puedes cambiarlo a un otro n&uacute;mero si quieres.";
	}




//]]>
</script>
</head>
<body onload="initialActions()">
    
    <!-- setup box -->
    <div id="setupbox" style="width: 450px; height: 500px; max-height: 500px; position:absolute;top:10px;left:0px; border: thin solid #009933; background-color: #CCCCCC">
	<center> 
	<table style="background-color:#CCCCCC; width: 450px; border-collapse:collapse;padding:0px">
	<tr>
	    <td style="text-align:center" colspan="2">
	<en>Enter the linear programming problem here:</en>
	<es>Ingrese el problema de programaci&#243;n lineal aqu&#237;:</es>
	</td>
	</tr>
	<tr>
	    <td style="text-align:left">
		<div style="inline-block; margin-right:-5px;">
		<input type = "radio" checked="true" name = "R1" id = "R10" onclick = "maximization=true;graphingOnly=false"></input> 
		<en>Maximize</en><es>Maximizar</es>
		<br /><input type = "radio" name = "R1"  id = "R11" onclick = "maximization=false;graphingOnly=false;"></input>
		<en>Minimize</en><es>Minimizar</es>
		</div>
	    </td>
	    <td nowrap="nowrap">
		&#160; &#160; <i>z</i> = <input type="text" value="" name="objbox" id="objbox" width="20"></input> &#160; &#160;
		<en>subject to the constraints:</en>
		<es>sujeta a las restricciones:</es>
		<br />&#160; &#160; &#160; &#160;<span style="color:indianred" class="comment"><i>z</i> <en>should be in the form</en><es>debe ser en la forma</es> </span><span style="font-weight:bold; font-family: courier; color: blue;" class="tech">ax+by</span>
	    </td>
	</tr>
	<tr>
	    <td style="text-align:left" colspan="2">
		<input type = "radio" name = "R1" id = "R12" onclick = "graphingOnly=true;maximization=false;"></input>
		    <en>Show only the region defined by the following contraints:</en>
		    <es>Solo dibujar la regi&#243;n definida por las siguientes retricciones:</es>
	    </td>
	</tr>
	<tr>
	    <td colspan="2" align="center">
	
	<br /><textarea name = "input" id = "input" value = "" rows = "7" cols = "40"></textarea>
	</td>
	</tr>
	
	<tr>
	    <td colspan="2" align = "center">
		<input type="button" id="showbt" value = "Show LP Example" onclick="calc(1)"></input>
		 &#160; 
		<input type="button" id="gbt" value = "Graphing Example" onclick="calc(0)"></input>
		 &#160; 
		<input type="button" id="solvebt" value = "Solve" onclick=" calc(2);"></input>
		<br />
		<en>Rounding:</en><es>Redondear:</es> <input type="text" size="2" value="4" id="acc" name="acc"></input> <en>decimal places</en><es>posiciones decimales</es>
		 &#160; <en>Fraction Mode</en><es class="es">Modo fracci&#243;n</es> <input type="checkbox" id="fracModeButton" name="fracModeButton" defaultChecked = "false"></input>
		<br />
		<input type="button" id="erbt" value = "Erase Everything" onclick="calc(3)"></input>
		<br />
		<script type="text/javascript">
		    //<![CDATA[
		    document.getElementById("showbt").value=addTextF("LP Examples","Ejemplos de PL");
		    document.getElementById("gbt").value=addTextF("Graphing Examples","Ejemplos de trazar");
		    document.getElementById("solvebt").value=addTextF("Solve","Solucionar");
		    document.getElementById("erbt").value=addTextF("Erase Everything","Borrar todo");
		    //]]>
		</script>
	</td>
	</tr>
	<tr>
	<td align = "center" colspan = "2">
	<!-- *** Evaluating the function *** -->
	
	<en>The solution will appear below.</en>
	<es>La soluci&#243;n aparecer&#225; abajo.</es>
	<table>
	    <tr>
		<td>
		    <div id="output" style="width:400px;max-height:205px;overflow-x:hidden; overflow-y:auto;background:white">
		    </div> 
		</td>
	    </tr>
	</table>
	
	
	</td>
	</tr>
	</table>
	</center>
    </div>
    
    <!-- grapher box -->
    <div id="grapherbox" style="max-width: 450px; height: 500px; overflow:hidden; background-color:#CCCCCC; position:absolute;top:10px;left:495px; border: thin solid #009933;">
	<div id = "scratch" style="font-size:5px"></div><span id = "ruler"></span>
	<div id="grapher1Div" style="width: 450px;margin-top:0px;margin-bottom:0px">
	    <center>
	<svg xmlns="http://www.w3.org/2000/svg"
	  xmlns:xlink="http://www.w3.org/1999/xlink" 
	  width="480" height="300" id="myGraph" style="background-color: white;position:relative;left:-30px;padding-bottom: 10px">
	<defs id="graphdefs">
	<marker id="arrowHead" viewBox="0 0 10 10" refX="10" refY="5" 
	    markerUnits="strokeWidth" orient="auto"
	    markerWidth="40" markerHeight="20">
	    <polyline id="myArr" points="0,0 10,5 0,10 3,6 0,5 3,4" />
	</marker>
	<clipPath id="rectClip">
	
	    <rect id="cliprect" width="150" height="150" x="25" y="25" fill="white" />
	    <!-- The above is adjusted by the js in SVGGraph --> 
	</clipPath>
	</defs>
	
	<g id="firstGroup">
		<rect id="gSurround" width="400" height="300" x="0" y="0" fill="lightblue" />
		<rect id="grid" width="350" height="250" x="25" y="25" fill="white" />
	</g>
	<g id="gridGroup">
	</g>
	<g id="curves">
	</g>
	<g id="polygons">
	</g>
	<g id="dots">
	</g>
	<g id="circles">
	</g>

	<g id="xs">
	</g>        
	<g id="lines">
	</g>
	<g id="text">
	</g>
	</svg>
	</center>
	</div>
	<div id="routput" onclick="flipLegends()" style="cursor: pointer; position:relative; top:-5px; margin-top: -10px; padding-bottom: 5px; width:450px;height:70px;overflow-x:hidden; overflow-y:auto;background:white">
	</div> 
	
	
	<!-- ************ SETTINGS ************ -->
	<div id="controls" style="margin-left:0px;margin-right:0px;padding-top:5px; background-color:#CCCCCC;width:450px;">
	    <table style="border-collapse:collapse;padding:0px;width:100%">
	    <tr>
		<td align = "center">
		    <form name = "theFormB">
			<table>

			<tr>
			<td valign = "top" nowrap="nowrap">
			    <span id = "xMinName">Xmin: </span>
			    <input id = "xMinVal" type="text" size="6" value="" name="a" />&#160;&#160;&#160;
			    <span id =" xMaxName">Xmax: </span>
			    <input id = "xMaxVal" type="text" size="6" value="" name="b"/>
			</td>
			</tr>
			<tr>
			    <td nowrap="nowrap">
				<span id = "yMinName">Ymin:</span>
				<input id = "yMinVal" type="text" size="6" value="" name="c" onfocus = "document.theFormB.autoYButton.checked = false" />&#160;&#160;&#160;
				<span id = "yMaxName">Ymax: </span>
				<input  id = "yMaxVal" type="text" size="6" value="" name="d" onfocus = "document.theFormB.autoYButton.checked = false"/>
			    </td>
			</tr>
			<tr>
			    <td>
				<en>Gridlines</en><es>L&#237;neas de cuadr&#237;cula</es> X: <input  id = "xGridVal" type="text" size="4" value="" name="xg" onfocus = "document.theFormB.autoGridButton.checked = false" />
				&#160;&#160;&#160;
				Y: <input id = "yGridVal" type="text" size="4" value="" name="yg" onfocus = "document.theFormB.autoGridButton.checked = false" />&#160;&#160;
				<span id = "unitsSpan2"></span>
			    </td>
			</tr>
			<tr>
			    <td align = "center" colspan = "3">
				<input type="button" id="graphbutton" value = "" onclick="calc(4)" />
				<script type="text/javascript">
				//<![CDATA[
				document.getElementById("graphbutton").value=addTextF("Graph","Gr&#225;fica");
				//document.getElementById("resetbutton").value=addText("Reset","Reiniciar");
				//]]>
				</script>
				
				<en>Show vertex coordinates</en><es class="es">Motrar coordinades de v&#233;rtices</es> <input type="checkbox" id="vertexSButton" name="vertexSButton" checked = "true"></input>
			    </td>
			</tr>  
			</table>
	    </form>
	    </td>
	    </tr>
	    </table>
	</div>
    </div>



</body>
</html>
