<?php
include("config.inc.php");
function draw_salesmencommission($connection,$salesmen_code){




$query=" select id,salesmen_code,Immediate_payout,salesmen_mst,salesmen_cst,date_format(salesmen_startdate,'%d/%m/%Y'),date_format(salesmen_enddate,'%d/%m/%Y'),monthly_achievmentfrom,monthly_achievmentto,salesmen_sip from salesmen_budget where salesmen_code = '$salesmen_code'";
$result=mysql_query($query,$connection);


$i=0;

echo"<span style='font-size:15px;font-weight:bold;color:#1e87a5' >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i >Salesmen Commission</i></span><br><br>
<table border='0' 	align='CENTER' class='sample'  style='table-layout:fixed;border:0px solid black;font-size:10px;border-spacing:0;width:635px;' cellpadding='0' cellspacing='0'>
	";
echo"
	<col width=35>
	<col width=100>
	<col width=100>
	<col width=100>
	<col width=100>
	<col width=100>
	<col width=100>
	<col width=210>
	<col width=200>
	<col width=35>


	
	
	<tr ></tr>";	
	
	 echo"<tr bgcolor='#F6F6F6'>
		<td  height='25' align='left'><span class='style4'><input type='hidden' name='empid' id='empid' value='$empid'></span></td>
		
		<td  height='25' align='left'><span class='style4'>IPP '%'</span></td>
		<td  height='25' align='left'><span class='style4'>MST</span></td>
		<td  height='25' align='left'><span class='style4'>CST</span></td>
		<td  height='25' align='left'><span class='style4'>Start Date</span></td>
		<td  height='25' align='left'><span class='style4'>End Date</span></td>
		<td  height='25' align='left'><span class='style4'>SIP '%'</span></td>
		<td  height='25' align='left'><span class='style4'>Monthly Achievement From '%'</span></td>
		<td  height='25' align='left'><span class='style4'>Monthly Achievement To '%'</span></td>
	
		
	";
	
		
		
		echo"<input type='hidden' name='selectedtr_loan' id='selectedtr_loan' value='$selectedtr_loan'>
		 <input type='hidden' name='selectedtrcolor_loan' id='selectedtrcolor_loan' value='$selectedtrcolor_loan'>";

	$columnsarray = array("salesmen_code", "immediate_payout", "salesmen_mst", "salesmen_cst","salesmen_startdate", "salesmen_enddate","salesmen_sip","monthly_achievmentfrom","monthly_achievmentto");
	$columnslist = implode(',', $columnsarray);
	
while($row=mysql_fetch_row($result)){
			
		if ($i%2==0)
		$bgcolor='#F5FAFF';
	else	
		$bgcolor='#FFFFFF';
		
	

		$salesmensbudgetid[$i] = $row[0];
		$salesmen_code[$i] = $row[1];
		$immediate_payout[$i] = $row[2];
		$salesmen_mst[$i] = $row[3];
		$salesmen_cst[$i] = $row[4];
		$salesmen_startdate[$i] = $row[5];
		$salesmen_enddate[$i] = $row[6];
		$monthly_achievmentfrom[$i] = $row[7];
		$monthly_achievmentto[$i] = $row[8];
		$salesmen_sip[$i] = $row[9];

		$onclick=" onclick='showrelationtoparameter(\"$row[0]\")' ";
			$KeyDown   = 'onkeydown="return dokey(event,this,'.$i.',\''.$columnslist.'\',\'imgSubmit['.$i.']\')"';

	$imgSubmit[$i]='imgSubmit['.$i.']' ;
		
	//	$KeyDown   = 'onkeydown="return dokey(event,this,'.$i.',\''.$columnslist.'\')"';
	
	
		
		
			
			echo"<tr height='20px' id='loan[$i]' onclick=\"returncolor(this,'selectedtr_loan','selectedtrcolor_loan')\"  style='background-color:$bgcolor'>";
			echo"<td  ><img src='img/delete.png' onmouseover=\"style.cursor='pointer'\" name='' title='Delete' onclick=\" deletesalesmencommission('$row[0]')\"></td>";
		
		
			
		
			echo"<td $onclick ><span class='style5'><input type='text'      name='immediate_payout[$i]' id='immediate_payout[".$i."]'    class='roundedtext_quota' value='".$immediate_payout[$i]."' ".$KeyDown." ></span></span>";
			
		echo"</td>";
				
			echo"<td $onclick ><span class='style5'><input type='text'  class='roundedtext_quota' name='salesmen_mst[$i]' id='salesmen_mst[$i]' value='".$salesmen_mst[$i]."' ".$KeyDown." > </span>
			</td>";
			
				echo"<td $onclick ><span class='style5'><input type='text'  class='roundedtext_quota' name='salesmen_cst[$i]' id='salesmen_cst[$i]' value='".$salesmen_cst[$i]."' ".$KeyDown." > </span>
			</td>";
	
	echo"<td $onclick height='25' align='left'><span class='style5'><input type='text'  $KeyDown  readonly class='roundedtext_datee'  name='salesmen_startdate[$i]' id='salesmen_startdate[$i]' value='".$salesmen_startdate[$i]."' > </span>
		
		</td>";
			
			echo"<td $onclick ><span class='style5'><input type='text'  class='roundedtext_datee' readonly $KeyDown name='salesmen_enddate[$i]'   id='salesmen_enddate[$i]' value='".$salesmen_enddate[$i]."'> </span></td>";
			
							echo"<td $onclick ><span class='style5'><input type='text'  class='roundedtext_quota' name='salesmen_sip[$i]' id='salesmen_sip[$i]' value='".$salesmen_sip[$i]."' ".$KeyDown."> </span></td>";

			echo"<td $onclick ><span class='style5'><input type='text' style='width:170px' class='roundeddate_quota' name='monthly_achievmentfrom[$i]' id='monthly_achievmentfrom[$i]' value='".$monthly_achievmentfrom[$i]."' ".$KeyDown."> </span></td>";
			echo"<td $onclick ><span class='style5'><input type='text' style='width:170px' class='roundeddate_quota' name='monthly_achievmentto[$i]' id='monthly_achievmentto[$i]' value='".$monthly_achievmentto[$i]."' ".$KeyDown."> </span></td>";
			echo"<td align = 'left' ><img src='img/confirm.png' onmouseover=\"style.cursor='pointer'\" id = '$imgSubmit[$i]' name='$imgSubmit[$i]' title='Save' onclick=\"submitsalesmenbudget('$i','$row[0]')\"></td>";
			echo"</tr>";
			echo"<span class='style5'><input type='hidden'  name='auto[$i]' id='auto[$i]' value='".$auto[$i]."' ></span>";
			
			$i+=1;
			
		}$onclick=" onclick='showrelationtoparameter(\"$row[0]\")' ";
					$KeyDown   = 'onkeydown="return dokey(event,this,'.$i.',\''.$columnslist.'\',\'imgSubmit['.$i.']\')"';

echo"<tr height='20px' id='loan$i' onclick=\"returncolor(this,'selectedtr_loan','selectedtrcolor_loan')\"  style='background-color:$bgcolor'>";
		echo"<td $onclick><img src='img/undo.png' onmouseover=\"style.cursor='pointer'\" name='' title='Clear' onclick=\"clearloan('$i')\"></td>";
	
			echo"<td $onclick><span class='style5'><input type='text'     name='immediate_payout[$i]' id='immediate_payout[".$i."]'    class='roundedtext_quota' value='".$immediate_payout[$i]."' ".$KeyDown." ></span></span>";
			
		echo"</td>";
				
			echo"<td $onclick><span class='style5'><input type='text' class='roundedtext_quota' name='salesmen_mst[$i]' id='salesmen_mst[$i]' value='".$salesmen_mst[$i]."' ".$KeyDown." > </span>
			</td>";
				echo"<td $onclick ><span class='style5'><input type='text'  class='roundedtext_quota' name='salesmen_cst[$i]' id='salesmen_cst[$i]' value='".$salesmen_cst[$i]."' ".$KeyDown." > </span>
			</td>";
			
	
	echo"<td height='25' align='left' $onclick ><span class='style5'><input type='text'  class='roundedtext_datee' readonly name='salesmen_startdate[$i]' id='salesmen_startdate[$i]' value='".$salesmen_startdate[$i]."'  ".$KeyDown."> </span>
		
		</td>";
			
			echo"<td $onclick><span class='style5'><input type='text'  class='roundedtext_datee'  name='salesmen_enddate[$i]' readonly  id='salesmen_enddate[$i]' value='".$salesmen_enddate[$i]."' ".$KeyDown."> </span></td>";
			
							echo"<td $onclick ><span class='style5'><input type='text' 	 class='roundedtext_quota' name='salesmen_sip[$i]' id='salesmen_sip[$i]' value='".$salesmen_sip[$i]."' ".$KeyDown."> </span></td>";

			echo"<td $onclick><span class='style5'><input type='text' style='width:170px' class='roundedtext_quota' name='monthly_achievmentfrom[$i]' id='monthly_achievmentfrom[$i]' value='".$monthly_achievmentfrom[$i]."' ".$KeyDown."> </span></td>";
			echo"<td $onclick><span class='style5'><input type='text' style='width:170px' class='roundedtext_quota' name='monthly_achievmentto[$i]' id='monthly_achievmentto[$i]' value='".$monthly_achievmentto[$i]."' ".$KeyDown."> </span></td>";
		
			echo"<td$onclick ><img src='img/confirm.png' onmouseover=\"style.cursor='pointer'\" name='imgSubmit[$i]' id = 'imgSubmit[$i]' title='Save' onclick=\"insertsalesmenbudget('$i')\"></td>";
			echo"</tr>";
			echo"<span class='style5'><input type='hidden'  name='auto[$i]' id='auto[$i]' value='".$auto[$i]."' ></span>";
echo"</table>";			
}




function draw_salesmenbudgetdt($connection,$vid){





$i=0;

echo"<span style='font-size:15px;font-weight:bold;color:#1e87a5'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>Salesmen Commission Detail</i></span><br><table border='0' 	align='center' class='sample'  style='table-layout:fixed;border:0px solid black;font-size:10px;border-spacing:0;width:350px;' cellpadding='0' cellspacing='0'>
	";
echo"
	<col width=180>
	<col width=100>
	<col width=100>




	
	
	";	
	
	 echo"<tr bgcolor='#F6F6F6'>
		<td  height='25' align='left'><span class='style4'>Monthly Achievement</span></td>
		<td  height='25' align='left'><span class='style4'>SIP</span></td>
		<td  height='25' align='left'><span class='style4'>CIP</span></td>


	
		
	";
	
		
		
		echo"<input type='hidden' name='selectedtr_loan' id='selectedtr_loan' value='$selectedtr_loan'>
		 <input type='hidden' name='selectedtrcolor_loan' id='selectedtrcolor_loan' value='$selectedtrcolor_loan'>";
		 
$query=" select salesmen_budgetdtid,salesmen_budgetid,concat(monthly_achievement,'%'),salesmen_budgetdt_sip,salesmen_budgetdt_cip from salesmen_budgetdt where salesmen_budgetid = '$vid' ";
$result=mysql_query($query,$connection);
	$columnsarray = array("absencetype", "fromyear", "toyear","group", "val");
	$columnslist = implode(',', $columnsarray);
	
while($row=mysql_fetch_row($result)){
			
		if ($i%2==0)
		$bgcolor='#F5FAFF';
	else	
		$bgcolor='#FFFFFF';
		
	

		$salesmen_budgetdtid[$i] = $row[0];
		$salesmen_budgetidd[$i] = $row[1];
		$monthly_achievementt[$i] = $row[2];
		$salesmen_budgetdt_sip[$i] = $row[3];
		$salesmen_budgetdt_cip[$i] = $row[4];
	

		$onclick=" onclick='showrelationtoparameter(\"$row[0]\")' ";
	
	$imgSubmit[$i]='imgSubmit['.$i.']' ;
		
	//	$KeyDown   = 'onkeydown="return dokey(event,this,'.$i.',\''.$columnslist.'\')"';
	
	
		
		
			
			echo"<tr height='20px' id='loann[$i]' onclick=\"returncolor(this,'selectedtr_loan','selectedtrcolor_loan')\"  style='background-color:$bgcolor'>";
			//echo"<td  ><img src='img/delete.png' onmouseover=\"style.cursor='pointer'\" name='' title='Delete' onclick=\" deletesalesmencommission('$row[0]')\"></td>";
		
		echo"<td  ><span class='style5'><input type='text'      name='monthly_achievementt[$i]' id='monthly_achievementt[".$i."]'    class='roundeddate_quota' value='".$monthly_achievementt[$i]."' ".$KeyDown." ></span></span>";
			
		echo"</td> ";
			echo"<td  ><span class='style5'><input type='text'      name='salesmen_budgetdt_sip[$i]' id='salesmen_budgetdt_sip[".$i."]'    class='roundedtext_quota' value='".$salesmen_budgetdt_sip[$i]."' ".$KeyDown." ></span></span></td>";
			echo"<td  ><span class='style5'><input type='text'      name='salesmen_budgetdt_cip[$i]' id='salesmen_budgetdt_cip[".$i."]'    class='roundedtext_quota' value='".$salesmen_budgetdt_cip[$i]."' ".$KeyDown." ></span></span></td>";
	
			//echo"<td align = 'left' ><img src='img/confirm.png' onmouseover=\"style.cursor='pointer'\" id = '$imgSubmit[$i]' name='$imgSubmit[$i]' title='Save' onclick=\"submitquota('$i','e','$row[0]')\"></td>";
			echo"</tr>";
			echo"<span class='style5'><input type='hidden'  name='auto[$i]' id='auto[$i]' value='".$auto[$i]."' ></span>";
			
			$i+=1;
			
		}

}
function draw_preparingvisits($connection){




$query=" select visit_id,ledger_number,ledger_name,visit_latitude,visit_logitude from visits";
$result=mysql_query($query,$connection);


$i=0;

echo"<span style='font-size:15px;font-weight:bold;color:#1e87a5' >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i ></span><br><br>
<table border='0' 	align='CENTER' class='sample'  style='table-layout:fixed;border:0px solid black;font-size:10px;border-spacing:0;width:635px;' cellpadding='0' cellspacing='0'>
	";
echo"
	<col width=35>
	<col width=100>
	<col width=500>
	<col width=100>
	<col width=100>

	<col width=35>


	
	
	<tr ></tr>";	
	
	 echo"<tr bgcolor='#F6F6F6'>
		<td  height='25' align='left'><span class='style4'><input type='hidden' name='empid' id='empid' value='$empid'></span></td>
		
		<td  height='25' align='left'><span class='style4'>Ledger Number</span></td>
		<td  height='25' align='left'><span class='style4'>Ledger Name</span></td>
		<td  height='25' align='left'><span class='style4'>Latitude</span></td>

		<td  height='25' align='left'><span class='style4'>Logitude</span></td>
	
		
	";
	
		
		
		echo"<input type='hidden' name='selectedtr_loan' id='selectedtr_loan' value='$selectedtr_loan'>
		 <input type='hidden' name='selectedtrcolor_loan' id='selectedtrcolor_loan' value='$selectedtrcolor_loan'>";

	$columnsarray = array("salesmen_code", "immediate_payout", "salesmen_mst", "salesmen_cst","salesmen_startdate", "salesmen_enddate","salesmen_sip","monthly_achievmentfrom","monthly_achievmentto");
	$columnslist = implode(',', $columnsarray);
	
while($row=mysql_fetch_row($result)){
			
		if ($i%2==0)
		$bgcolor='#F5FAFF';
	else	
		$bgcolor='#FFFFFF';
		
	

		$visit_id[$i] = $row[0];
		$ledger_number[$i] = $row[1];
		$ledger_name[$i] = $row[2];
		$visit_latitude[$i] = $row[3];
		$visit_logitude[$i] = $row[4];


		$onclick=" onclick='showrelationtoparameter(\"$row[0]\")' ";
			$KeyDown   = 'onkeydown="return dokey(event,this,'.$i.',\''.$columnslist.'\',\'imgSubmit['.$i.']\')"';

	$imgSubmit[$i]='imgSubmit['.$i.']' ;
		
	//	$KeyDown   = 'onkeydown="return dokey(event,this,'.$i.',\''.$columnslist.'\')"';
	
	
		
		
			
			echo"<tr height='20px' id='loan[$i]' onclick=\"returncolor(this,'selectedtr_loan','selectedtrcolor_loan')\"  style='background-color:$bgcolor'>";
			echo"<td  ><img src='img/delete.png' onmouseover=\"style.cursor='pointer'\" name='' title='Delete' onclick=\" deletevisit('$row[0]')\"></td>";
		
		
			
		
			echo"<td ><span class='style5'><input type='text'      name='ledger_number[$i]' id='ledger_number[".$i."]'    class='roundedtext_quota1' value='".$ledger_number[$i]."' ".$KeyDown." ></span></span>";
			
		echo"</td>";
				
			echo"<td ><span class='style5'><input type='text'  class='roundedtext_quota5' name='ledger_name[$i]' id='ledger_name[$i]' value='".$ledger_name[$i]."' ".$KeyDown." > </span>
			</td>";
			
				echo"<td ><span class='style5'><input type='text'  class='roundedtext_quota1' name='visit_latitude[$i]' id='visit_latitude[$i]' value='".$visit_latitude[$i]."' ".$KeyDown." > </span>
			</td>";
	
			echo"<td  ><span class='style5'><input type='text'  class='roundedtext_quota1' name='visit_logitude[$i]' id='visit_logitude[$i]' value='".$visit_logitude[$i]."' ".$KeyDown."> </span></td>";
			echo"<td align = 'left' ><img src='img/confirm.png' onmouseover=\"style.cursor='pointer'\" id = '$imgSubmit[$i]' name='$imgSubmit[$i]' title='Save' onclick=\"editvisit('$i','$row[0]')\"></td>";
			echo"</tr>";
			echo"<span class='style5'><input type='hidden'  name='auto[$i]' id='auto[$i]' value='".$auto[$i]."' ></span>";
			
			$i+=1;
			
		}
		
		$onclick=" onclick='showrelationtoparameter(\"$row[0]\")' ";
					$KeyDown   = 'onkeydown="return dokey(event,this,'.$i.',\''.$columnslist.'\',\'imgSubmit['.$i.']\')"';

echo"<tr height='20px' id='loan$i' onclick=\"returncolor(this,'selectedtr_loan','selectedtrcolor_loan')\"  style='background-color:$bgcolor'>";
		echo"<td $onclick><img src='img/undo.png' onmouseover=\"style.cursor='pointer'\" name='' title='Clear' onclick=\"clearloan('$i')\"></td>";
	
				
			echo"<td $onclick ><span class='style5'><input type='text'      name='ledger_number[$i]' id='ledger_number[".$i."]'    class='roundedtext_quota1' value='".$ledger_number[$i]."' ".$KeyDown." ></span></span>";
			
		echo"</td>";
				
			echo"<td $onclick ><span class='style5'><input type='text'  class='roundedtext_quota5' name='ledger_name[$i]' id='ledger_name[$i]' value='".$ledger_name[$i]."' ".$KeyDown." > </span>
			</td>";
			
				echo"<td $onclick ><span class='style5'><input type='text'  class='roundedtext_quota1' name='visit_latitude[$i]' id='visit_latitude[$i]' value='".$visit_latitude[$i]."' ".$KeyDown." > </span>
			</td>";
	
			echo"<td $onclick ><span class='style5'><input type='text'  class='roundedtext_quota1' name='visit_logitude[$i]' id='visit_logitude[$i]' value='".$visit_logitude[$i]."' ".$KeyDown."> </span></td>";
		
			echo"<td$onclick ><img src='img/confirm.png' onmouseover=\"style.cursor='pointer'\" name='imgSubmit[$i]' id = 'imgSubmit[$i]' title='Save' onclick=\"insertvisit('$i')\"></td>";
			echo"</tr>";
			echo"<span class='style5'><input type='hidden'  name='auto[$i]' id='auto[$i]' value='".$auto[$i]."' ></span>";
echo"</table>";			
}
function draw_mobiles($connection,$acc){




$query=" select mobile_id,mobile_buildnumber,mobile_name,mobile_Active from ".$acc.".mobile";

$result=mysql_query($query,$connection);


$i=0;

echo"<span style='font-size:15px;font-weight:bold;color:#1e87a5' >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i ></span><br><br>
<table border='0' 	align='CENTER' class='sample'  style='table-layout:fixed;border:0px solid black;font-size:10px;border-spacing:0;width:635px;' cellpadding='0' cellspacing='0'>
	";
echo"
	<col width=35>
	<col width=200>
	<col width=200>
	<col width=200>


	<col width=35>


	
	
	<tr ></tr>";	
	
	 echo"<tr bgcolor='#F6F6F6'>
		<td  height='25' align='left'><span class='style4'><input type='hidden' name='empid' id='empid' value='$empid'></span></td>
		
		<td  height='25' align='left'><span class='style4'>Mobile BuildNumber</span></td>
		<td  height='25' align='left'><span class='style4'>Mobile Name</span></td>
		<td  height='25' align='left'><span class='style4'>Mobile Active</span></td>

	
	";
	
		
		
		echo"<input type='hidden' name='selectedtr_loan' id='selectedtr_loan' value='$selectedtr_loan'>
		 <input type='hidden' name='selectedtrcolor_loan' id='selectedtrcolor_loan' value='$selectedtrcolor_loan'>";

	$columnsarray = array("salesmen_code", "immediate_payout", "salesmen_mst", "salesmen_cst","salesmen_startdate", "salesmen_enddate","salesmen_sip","monthly_achievmentfrom","monthly_achievmentto");
	$columnslist = implode(',', $columnsarray);
	
while($row=mysql_fetch_row($result)){
			
		if ($i%2==0)
		$bgcolor='#F5FAFF';
	else	
		$bgcolor='#FFFFFF';
		
	

		$mobile_id[$i] = $row[0];
		$mobile_buildnumber[$i] = $row[1];
		$mobile_name[$i] = $row[2];
		$mobile_active[$i] = $row[3];

			echo"<tr height='20px' id='loan[$i]' onclick=\"returncolor(this,'selectedtr_loan','selectedtrcolor_loan')\"  style='background-color:$bgcolor'>";
			echo"<td  ><img src='img/delete.png' onmouseover=\"style.cursor='pointer'\" name='' title='Delete' onclick=\" deletemobile('$row[0]')\"></td>";
		
		
			
		
	
				
			echo"<td ><span class='style5'><input type='text'  class='roundedtext_quota6' name='mobile_buildnumber[$i]' id='mobile_buildnumber[$i]' value='".$mobile_buildnumber[$i]."' ".$KeyDown." > </span>
			</td>";
			
				echo"<td ><span class='style5'><input type='text'  class='roundedtext_quota6' name='mobile_name[$i]' id='mobile_name[$i]' value='".$mobile_name[$i]."' ".$KeyDown." > </span>
			</td>";
	
			echo"<td  align = center ><span class='style5'><input type='checkbox' style='width:170px' class='roundedtext_quota6' name='mobile_active[$i]' id='mobile_active[$i]' onClick = \"editmobile2('$row[0]','$i')\"  value='".$mobile_active[$i]."' ";
			if($mobile_active[$i] == 1) echo "checked";
			echo"> </span></td>";
			
			
			echo"<td align = 'left' ><img src='img/confirm.png' onmouseover=\"style.cursor='pointer'\" id = '$imgSubmit[$i]' name='$imgSubmit[$i]' title='Save' onclick=\"editmobile('$i','$row[0]')\"></td>";
			echo"</tr>";
			echo"<span class='style5'><input type='hidden'  name='auto[$i]' id='auto[$i]' value='".$auto[$i]."' ></span>";
			
			$i+=1;
			
		}
		
echo"<tr height='20px' id='loan$i' onclick=\"returncolor(this,'selectedtr_loan','selectedtrcolor_loan')\"  style='background-color:$bgcolor'>";
		echo"<td $onclick><img src='img/undo.png' onmouseover=\"style.cursor='pointer'\" name='' title='Clear' onclick=\"clearloan('$i')\"></td>";
	
			echo"<td $onclick ><span class='style5'><input type='text'  class='roundedtext_quota6' name='mobile_buildnumber[$i]' id='mobile_buildnumber[$i]' value='".$mobile_buildnumber[$i]."' ".$KeyDown." > </span>
			</td>";
			
				echo"<td $onclick ><span class='style5'><input type='text'  class='roundedtext_quota6' name='mobile_name[$i]' id='mobile_name[$i]' value='".$mobile_name[$i]."' ".$KeyDown." > </span>
			</td>";
	
					echo"<td  align = center ><span class='style5'><input type='checkbox' style='width:170px' class='roundedtext_quota6' name='mobile_active[$i]' id='mobile_active[$i]' value='".$mobile_active[$i]."' ";
			if($mobile_active[$i] == 1) echo "checked";
			echo"> </span></td>";
			echo"<td$onclick ><img src='img/confirm.png' onmouseover=\"style.cursor='pointer'\" name='imgSubmit[$i]' id = 'imgSubmit[$i]' title='Save' onclick=\"insertmobile('$i')\"></td>";
			echo"</tr>";
			echo"<span class='style5'><input type='hidden'  name='auto[$i]' id='auto[$i]' value='".$auto[$i]."' ></span>";
echo"</table>";			
}
?>