<%-- 
    Document   : templates
    Created on : Feb 25, 2010, 8:27:57 AM
    Author     : Sreekanth
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        
        <script language="javascript" type="text/javascript">
      
function fun2()
{
       //window.alert("you are exceeding the max marks given");
         
         //status=!status;
         //document.getElementById(x).disabled = status;
       
        var x=0;
        var y=0;
        var marks = document.getElementById("tmarks").value;
        if(marks==null || marks=="")
            {
              window.alert("PLEASE ENTER THE MAXIMUM MARKS");
               f1.tmarks.select();
               
            }
        var count=0,id=0,count1=0;
        
        for(i=1;i<=5;i++)
            {   
               
                var a = document.getElementById("l"+i).value;
                           
                var b = document.getElementById("t"+i).value;
                
                var c = document.getElementById("m"+i).value;
                y = y+parseInt(a);
                x = x+((parseInt(a)-parseInt(c))* parseInt(b));
                document.f1.tq.value=y;
                document.f1.tm.value=x;
                if(marks<x)
                    {
                        count++;
                        
                    }
               else if(marks>x)
                    count1++;
                  else

                       document.f1.tm.value=x;
                 
            }
                if(count>0)
                {
                       window.alert("YOU ARE EXCEEDING THE MAX MARKS GIVEN");
                       document.f1.tm.value=0;
                       document.f1.tq.value=0;
                       if(count==1)
                       {    
                           f1.lq.value=0;
                            document.getElementById("l"+i).value=0;
                           f1.la.value=0;
                            
                       }         
                       
                }  
                

}
var i=1;
function fun(status,i)
{          
           status=!status;
           //window.alert(status);
           document.getElementById("id"+i).disabled = status;
           document.getElementById("id"+i).value = "0";
           //document.f1.getElementById("id"+i).disabled = status;
           if(status==true)
            document.getElementById("id"+i).value="0"; 
            //document.getElementById("id"+i).value = 0;           
           //i++;
           //document.getElementById("la"+i).disabled = status;
          
          //document.getElementById("lg"+i).disabled = status;
           
          // document.getElementById("lr"+i).disabled = status;
         //document.getElementById("le"+x).disabled = status;
         // i++;
        //document.f1.("le"+i).disabled=false;*/
}
var id=0,x,eng=0,apt=0,rail=0,gk=0,tot=0;
function fun3(i)
{   
    //window.alert("hi");
                
        
        //document.getElementById("l"+i).select();  
                 var a= document.getElementById("l"+i).value;
                
                 eng = parseInt(document.getElementById("id"+i).value);
                                  
                 apt = parseInt(document.getElementById("id"+(i+5)).value);
                
                 gk = parseInt(document.getElementById("id"+(i+10)).value);
               
                 rail = parseInt(document.getElementById("id"+(i+15)).value);
                
                x=parseInt(a);
                
                tot=(eng+apt+gk+rail);
                window.alert("Total = "+tot);
                
                if(tot>x)
                {    
                       window.alert("TOTAL NOT MATCHED... It was exceeded by"+(tot-x));
                       
                       //f1.id(i).select();
                }
                 else if(tot<x)
                 {    
                       window.alert("TOTAL NOT MATCHED... ");
                       
                       //f1.id(i).select();
                       
                 }
           // else if(id<a)   
             //          window.alert("error");  */              
}

</script>

        <style>
div
{
color:#ffff33;
width:180;
font-family:Comic Sans MS;
text-align:center;
}
td
{
    color:black;
    font-weight: strong;
}
        </style>
    </head>
    <body background="images\bg.jpg">
        <jsp:include page="menu.jsp"></jsp:include>
        <script language="javascript" type="text/javascript" src="datetimepicker.js">

         </script>
        
        <br>
        <form name="f1" action="qpaper.jsp" method="post">
            <center><p style="text-align:center; font-family:Comic Sans MS; font-size:20px; color:red;">Question Paper Generator</p></center>
    <div><center>
        <table border="0" >
  <tr>
<td>Department</td>
<td><input type="text" name="dname" value="" size="14" /></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="RIGHT">Division</td>
<td><input type="text" name="div" value="" size="14" /></td>
</tr>

<tr>
<td align="RIGHT">Post</td>
<td style="text-align:center; font-family:Comic Sans MS; font-size:20px; color:red;"><select name="post" size="1" >
    <option>Sr.Clerk &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </option>
<option>Asst.Clerk</option>
<option>Sr.Accountant</option>
<option>Ch.OS</option>
<option>ADME</option>
<option>Sr.Cashier</option>

</select></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="RIGHT">Scale</td>
<td><input type="text" name="scale" value="" size="14" /></td>
</tr>

<tr>
<td align="right">Date</td>
<td><input type="Text" name="date" id="demo1" maxlength="11" size="12"  ><a href="javascript:NewCal('demo1','ddmmmyyyy')"><img src="images/cal1.gif" width="16" height="18" border="0" alt="Pick a date"></a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="RIGHT">Max Marks</td>
<td><input type="text" name="tmarks" id="tmarks" value="" size="14" onblur="fun2()" /></td>
</tr>
<tr>
<td align="right">Duration</td>
<td><input type="text" name="dur" value="" size="14"  /></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="RIGHT">Time</td>
<td><input type="Text" name="tim" id="demo2" maxlength="11" size="14"></td>
</tr>
</table></center></div>
        <br><br><br>
        <center><table border="0" style="text-align:center; font-family:Comic Sans MS; font-size:20px; color:#150889;">
            <thead>
                <tr>
                    <th></th>
                    <th></th>
                    <th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp No.of Qos &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
                    <th align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp Marks/Qos &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
                    <th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp Choice &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
                    
                </tr>
            </thead>
            <tbody style="text-align:center; font-family:Comic Sans MS;  font-size:20px; color:white;">
                <tr>
                    <td style="text-align:center; font-family:Comic Sans MS;  font-size:20px; color:#150889;">Long Answer Type Qos</td>
                    <td></td>
                    <td><select name=lq id="l1" onchange="fun2()" >
                            <option value="0" selected>0</option>

                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                            <option value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                            <option value="19">19</option>
                            <option value="20">20</option>
                        </select></td>
                       <td><select name="lc" onchange="fun2()" id="t1">
                           <option value="0" selected>0</option>
                            <option value="1">1</option>
                            <option value=2>2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                            <option value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                            <option value="19">19</option>
                            <option value="20">20</option>
                        </select></td>
                    <td><select name="la" onchange="fun2()" id="m1">
                            <option value="0" selected>0</option>
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                        </select></td>              
                </tr>
                <tr>
                    <td>English</td><td></td><td><input type="checkbox" name="le" id="e1"  onclick="fun(this.checked,1)"  /><input type="text" name="id1" value="0" size="5" id="id1" disabled   onblur="fun3(1)" /></td>
                </tr>
                <tr>
                    <td>Aptitude</td><td></td><td><input type="checkbox" name="la" id="e2"  onclick="fun(this.checked,6)" /><input type="text" name="id6" value="0" size="5" id="id6" disabled  onblur="fun3(1)" /></td>
                </tr>
                <tr>
                    <td>G.K.</td><td></td><td><input type="checkbox" name="lg" id="e3"  onclick="fun(this.checked,11)" /><input type="text" name="id11" value="0" size="5" id="id11" disabled  onblur="fun3(1)" /></td>
                </tr>
                <tr>
                    <td>Railways</td><td></td><td><input type="checkbox" name="lr" id="e4"  onclick="fun(this.checked,16)"/><input type="text" name="id16" value="0" size="5" id="id16" disabled onblur="fun3(1)" /></td>
                </tr>
                <tr>
                    <td style="text-align:center; font-family:Comic Sans MS;  font-size:20px; color:yellow;">Short Answer Type Qos</td>
                    <td></td>
                    <td><select name="sq" onchange="fun2()" id="l2">
                         <option value="0" selected>0</option>
                          <option value="1">1</option>
                            <option value=2>2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                            <option value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                            <option value="19">19</option>
                            <option value="20">20</option
                        </select></td>
                        <td><select name="sc" onchange="fun2()" id="t2" >
                                <option value="0" selected>0</option>
                            <option value="1">1</option>
                            <option value=2>2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                            <option value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                            <option value="19">19</option>
                            <option value="20">20</option
                             </select></td>
                    <td><select name="sa" onchange="fun2()" id="m2">
                            <option value="0" selected>0</option>
                            <option value="1">1</option>
                            <option value=2>2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                            <option value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                            <option value="19">19</option>
                            <option value="20">20</option
                          </select></td>
   
                </tr>
                <tr>
                    <td>English</td><td></td><td><input type="checkbox" name="le" id="e1" value="ON" onclick="fun(this.checked,2)"  /><input type="text" name="le1" value="0" size="5" id="id2" disabled   onblur="fun3(2)" /></td>
                </tr>
                <tr>
                    <td>Aptitude</td><td></td><td><input type="checkbox" name="la" id="e2" value="ON" onclick="fun(this.checked,7)" /><input type="text" name="laa" value="0" size="5" id="id7" disabled  onblur="fun3(2)" /></td>
                </tr>
                <tr>
                    <td>G.K.</td><td></td><td><input type="checkbox" name="lg" id="e3" value="ON" onclick="fun(this.checked,12)" /><input type="text" name="lgg" value="0" size="5" id="id12" disabled  onblur="fun3(2)" /></td>
                </tr>
                <tr>
                    <td>Railways</td><td></td><td><input type="checkbox" name="lr" id="e4" value="ON" onclick="fun(this.checked,17)"/><input type="text" name="lrr" value="0" size="5" id="id17" disabled onblur="fun3(2)" /></td>
                </tr>
                
                <tr>
                    <td style="text-align:center; font-family:Comic Sans MS;  font-size:20px; color:yellow;">Fill in the Blanks</td>
                    <td></td>
                    <td><select name="fq" onchange="fun2()" id="l3">
                         <option value="0" selected>0</option>
                            <option value="1">1</option>
                            <option value=2>2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                            <option value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                            <option value="19">19</option>
                            <option value="20">20</option
                            <option value="21">21</option>
                            <option value=22>22</option>
                            <option value="23">23</option>
                            <option value="24">24</option>
                            <option value="25">25</option>
                            <option value="26">26</option>
                            <option value="27">27</option>
                            <option value="28">28</option>
                            <option value="29">29</option>
                            <option value="30">30</option>
                            <option value="31">31</option>
                            <option value=32>32</option>
                            <option value="33">33</option>
                            <option value="34">34</option>
                            <option value="35">35</option>
                            <option value="36">36</option>
                            <option value="37">37</option>
                            <option value="38">38</option>
                            <option value="39">39</option>
                            <option value="40">40</option>
                            <option value="41">41</option>
                            <option value=42>42</option>
                            <option value="43">43</option>
                            <option value="44">44</option>
                            <option value="45">45</option>
                            <option value="46">46</option>
                            <option value="47">47</option>
                            <option value="48">48</option>
                            <option value="49">49</option>
                            <option value="50">50</option>
                        </select></td>
                        <td><select name="fc" id="t3" onchange="fun2()">
                            <option value="0" selected>0</option>
                             <option value="1">1</option>
                            <option value=2>2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                        </select></td>
                        <td><select name="fa" id="m3" onchange="fun2()">
                            <option value="0" selected>0</option>
                             <option value="5">5</option>
                            <option value=10>10</option>
                            <option value="15">15</option>
                            <option value="20">20</option>
                            <option value="25">25</option>
                        </select></td>
                
                </tr>
                <tr>
                    <td>English</td><td></td><td><input type="checkbox" name="le" id="e1" onclick="fun(this.checked,3)"  /><input type="text" name="le1" value="0" size="5" id="id3" readonly   onblur="fun3(3)" /></td>
                </tr>
                <tr>
                    <td>Aptitude</td><td></td><td><input type="checkbox" name="la" id="e2"  onclick="fun(this.checked,8)" /><input type="text" name="laa" value="0" size="5" id="id8" disabled  onblur="fun3(3)" /></td>
                </tr>
                <tr>
                    <td>G.K.</td><td></td><td><input type="checkbox" name="lg" id="e3"  onclick="fun(this.checked,13)" /><input type="text" name="lgg" value="0" size="5" id="id13" disabled  onblur="fun3(3)" /></td>
                </tr>
                <tr>
                    <td>Railways</td><td></td><td><input type="checkbox" name="lr" id="e4"  onclick="fun(this.checked,18)"/><input type="text" name="lrr" value="0" size="5" id="id18" disabled onblur="fun3(3)" /></td>
                </tr>
                <tr>
                    <td style="text-align:center; font-family:Comic Sans MS;  font-size:20px; color:yellow;">Multiple Choice Qos</td>
                    <td></td>
                    <td><select name="mq" onchange="fun2()" id="l4">
                         <option value="0" selected>0</option>
                           <option value="1">1</option>
                            <option value=2>2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                            <option value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                            <option value="19">19</option>
                            <option value="20">20</option
                            <option value="21">21</option>
                            <option value=22>22</option>
                            <option value="23">23</option>
                            <option value="24">24</option>
                            <option value="25">25</option>
                            <option value="26">26</option>
                            <option value="27">27</option>
                            <option value="28">28</option>
                            <option value="29">29</option>
                            <option value="30">30</option>
                            <option value="31">31</option>
                            <option value=32>32</option>
                            <option value="33">33</option>
                            <option value="34">34</option>
                            <option value="35">35</option>
                            <option value="36">36</option>
                            <option value="37">37</option>
                            <option value="38">38</option>
                            <option value="39">39</option>
                            <option value="40">40</option>
                            <option value="41">41</option>
                            <option value=42>42</option>
                            <option value="43">43</option>
                            <option value="44">44</option>
                            <option value="45">45</option>
                            <option value="46">46</option>
                            <option value="47">47</option>
                            <option value="48">48</option>
                            <option value="49">49</option>
                            <option value="50">50</option>
                        </select></td>
                        <td><select name="mc" id="t4"onchange="fun2()">
                            <option value="0" selected>0</option>
                             <option value="1">1</option>
                            <option value=2>2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                        </select></td>
                    <td><select name="ma" id="m4" onchange="fun2()">
                        <option value="0" selected>0</option>
                             <option value="5">5</option>
                            <option value=10>10</option>
                            <option value="15">15</option>
                            <option value="20">20</option>
                            <option value="25">25</option>
                        </select></td>
               </tr>
               <tr>
                    <td>English</td><td></td><td><input type="checkbox" name="le" id="e1"  onclick="fun(this.checked,4)"  /><input type="text" name="id4" value="0" size="5" id="id4" disabled   onblur="fun3(4)" /></td>
                </tr>
                <tr>
                    <td>Aptitude</td><td></td><td><input type="checkbox" name="la" id="e2"  onclick="fun(this.checked,9)" /><input type="text" name="id9" value="0" size="5" id="id9" disabled  onblur="fun3(4)" /></td>
                </tr>
                <tr>
                    <td>G.K.</td><td></td><td><input type="checkbox" name="lg" id="e3"  onclick="fun(this.checked,14)" /><input type="text" name="id14" value="0" size="5" id="id14" disabled  onblur="fun3(4)" /></td>
                </tr>
                <tr>
                    <td>Railways</td><td></td><td><input type="checkbox" name="lr" id="e4"  onclick="fun(this.checked,19)"/><input type="text" name="id19" value="0" size="5" id="id19" disabled onblur="fun3(4)" /></td>
                </tr>
                <tr>
                    <td style="text-align:center; font-family:Comic Sans MS;  font-size:20px; color:yellow;">Expansions</td>
                    <td></td>
                    <td><select  name="eq"  onchange="fun2()" id="l5">
                         <option value="0" selected>0</option>
                          <option value="1">1</option>
                            <option value=2>2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                            <option value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                            <option value="19">19</option>
                            <option value="20">20</option
                            <option value="21">21</option>
                            <option value=22>22</option>
                            <option value="23">23</option>
                            <option value="24">24</option>
                            <option value="25">25</option>
                            <option value="26">26</option>
                            <option value="27">27</option>
                            <option value="28">28</option>
                            <option value="29">29</option>
                            <option value="30">30</option>
                            <option value="31">31</option>
                            <option value=32>32</option>
                            <option value="33">33</option>
                            <option value="34">34</option>
                            <option value="35">35</option>
                            <option value="36">36</option>
                            <option value="37">37</option>
                            <option value="38">38</option>
                            <option value="39">39</option>
                            <option value="40">40</option>
                            <option value="41">41</option>
                            <option value=42>42</option>
                            <option value="43">43</option>
                            <option value="44">44</option>
                            <option value="45">45</option>
                            <option value="46">46</option>
                            <option value="47">47</option>
                            <option value="48">48</option>
                            <option value="49">49</option>
                            <option value="50">50</option> 
                         
                        </select></td>
                        <td><select name="ec" id="t5" onchange="fun2()">
                            <option value="0" selected>0</option>
                             <option value="1">1</option>
                            <option value=2>2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                        </select></td>
                    <td><select name="ea" id="m5" onchange="fun2()">
                        <option value="0" selected>0</option>
                             <option value="5">5</option>
                            <option value=10>10</option>
                            <option value="15">15</option>
                            <option value="20">20</option>
                            <option value="25">25</option>
                        </select></td> 
                        
                </tr>
                <tr>
                    <td>English</td><td></td><td><input type="checkbox" name="le" id="e1"  onclick="fun(this.checked,5)"  /><input type="text" name="le1" value="0" size="5" id="id5" disabled   onblur="fun3(5)" /></td>
                </tr>
                <tr>
                    <td>Aptitude</td><td></td><td><input type="checkbox" name="la" id="e2" onclick="fun(this.checked,10)" /><input type="text" name="laa" value="0" size="5" id="id10" disabled  onblur="fun3(5)" /></td>
                </tr>
                <tr>
                    <td>G.K.</td><td></td><td><input type="checkbox" name="lg" id="e3"  onclick="fun(this.checked,15)" /><input type="text" name="lgg" value="0" size="5" id="id15" disabled  onblur="fun3(15)" /></td>
                </tr>
                <tr>
                    <td>Railways</td><td></td><td><input type="checkbox" name="lr" id="e4"  onclick="fun(this.checked,20)"/><input type="text" name="lrr" value="0" size="5" id="id20" disabled onblur="fun3(20)" /></td>
                </tr>
                <tr>
                    
                    <td></td>
                    <td></td>
                    <td><input type="text" name="tq" value="0" size="5" id="tq" /></td>
                    
                    <td><input type="text" name="tm" value="0" size="5" id="tot"/></td>
                </tr>
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                    <td></td>
                    <td><input type="reset" value="RESET" name="RESET" /></td>
                    <td><input type="submit" value="Confirm" name="Confirm" /></td>
                    
                </tr>
            </tbody>
        </table></center>
        
        </form>
    </body>
</html>
