<script  type="text/javascript">
function newrec(a)
{
//alert(a)
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
function stateChanged1()
{
if(httpxml.readyState==4 || httpxml.readyState=="complete")
{
  document.getElementById('mainpart').innerHTML=httpxml.responseText;
}
}
var url=a;
url=url+"?new="+'1';
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=stateChanged1;
httpxml.open("GET",url,true);
httpxml.send(null);
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function newrec1(a,b)
{
//alert(b)
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
function stateChanged1()
{
if(httpxml.readyState==4 || httpxml.readyState=="complete")
{
  document.getElementById('mainpart').innerHTML=httpxml.responseText;
}
}
var url=a;
url=url+"?new="+b;
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=stateChanged1;
httpxml.open("GET",url,true);
httpxml.send(null);
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function editrec(a,b)
{
//alert(a);
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
function stateChanged2()
{
if(httpxml.readyState==4 || httpxml.readyState=="complete")
{
  document.getElementById('mainpart').innerHTML=httpxml.responseText;

 //window.location="hesab_kol3.php";

}
}
var url=b;
url=url+"?q2="+a+"&mode="+'update';
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=stateChanged2;
httpxml.open("GET",url,true);
httpxml.send(null);
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function delrec(a,b)
{
//alert(a);
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
function stateChanged3()
{
if(httpxml.readyState==4 || httpxml.readyState=="complete")
{
  document.getElementById('mainpart').innerHTML=httpxml.responseText;
}
}
var url=b;
url=url+"?q2="+a+"&mode="+'delete';
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=stateChanged3;
httpxml.open("GET",url,true);
httpxml.send(null);
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function seerec(a,b)
{
//alert(a);
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
function stateChanged2()
{
if(httpxml.readyState==4 || httpxml.readyState=="complete")
{
  document.getElementById('mainpart').innerHTML=httpxml.responseText;

}
}
var url=b;
url=url+"?q2="+a+"&mode="+'see';
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=stateChanged2;
httpxml.open("GET",url,true);
httpxml.send(null);
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function seerec1(a,b)
{
//alert(a);
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
function stateChanged2()
{
if(httpxml.readyState==4 || httpxml.readyState=="complete")
{
  document.getElementById('mainpart').innerHTML=httpxml.responseText;

}
}
var url="getajax.php";
url=url+"?majet="+a+"&pg="+b;
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=stateChanged2;
httpxml.open("GET",url,true);
httpxml.send(null);
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function insert(a,b,c)
{
//alert(a)
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
httpxml.onreadystatechange = function() {
if(httpxml.readyState == 4 && httpxml.status == 200)
{
 document.getElementById('dval').value=httpxml.responseText;
 if(document.getElementById('dval').value=='success')
 {
   document.getElementById('d1').innerHTML='';
   alert('ثبت با موفقيت انجام شد');
 }

 else
 {
   document.getElementById('d1').innerHTML=httpxml.responseText;
   alert('ثبت انجام نشد');

 }



}
}
var field=new Array();
field=c.split(",");
var cou=0;
for(i=0;i<field.length;i++)
 {
  if(document.getElementById(field[i]).value="")
   {
	 cou++;
   }
 }
  var strChoices = "";
  var chk1 = document.getElementById('chk');
  if(chk1)
  {

    if (chk1.checked)
      strChoices='1';
    else
     strChoices ='0';
   }
   else
     strChoices ='0';
   var url=b;
   var params ="ins="+a+"&neew="+strChoices;
   httpxml.open("POST", url, true);
   httpxml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   httpxml.setRequestHeader("Content-length", params.length);
   httpxml.setRequestHeader("Connection", "close");
   httpxml.send(params);


}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function insert1(a,b,c)
{
//alert(a)
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
httpxml.onreadystatechange = function() {
if(httpxml.readyState == 4 && httpxml.status == 200)
{

 document.getElementById('m').innerHTML=httpxml.responseText;
 alert('ثبت با موفقيت انجام شد');
}
}
var strChoices = "";
  var chk1 = document.getElementById('chk');
  if(chk1)
  {
    if (chk1.checked)
      strChoices='1';
    else
     strChoices ='0';
  }
  else
     strChoices ='0';
  document.getElementById(c).value=""
   var url=b;
   var params ="ins1="+a+"&neew="+strChoices;
   httpxml.open("POST", url, true);
   httpxml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   httpxml.setRequestHeader("Content-length", params.length);
   httpxml.setRequestHeader("Connection", "close");
   httpxml.send(params);


}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function insert2(a,b,c,d)
{
//alert(a)
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
httpxml.onreadystatechange = function() {
if(httpxml.readyState == 4 && httpxml.status == 200)
{

 document.getElementById('main').innerHTML=httpxml.responseText;
 alert('ثبت با موفقيت انجام شد');
}
}
  document.getElementById(c).value=""
if(a==',,')
 alert(d)
else
{
   var url=b;
   var params ="ins2="+a+"&neew=1";
   httpxml.open("POST", url, true);
   httpxml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   httpxml.setRequestHeader("Content-length", params.length);
   httpxml.setRequestHeader("Connection", "close");
   httpxml.send(params);

}
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function insert3(a,b,c)
{
//alert(a)
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
httpxml.onreadystatechange = function() {
if(httpxml.readyState == 4 && httpxml.status == 200)
{

 document.getElementById('m').innerHTML=httpxml.responseText;
 alert('ثبت با موفقيت انجام شد');
}
}
  document.getElementById(c).value=""

   var url=b;
   var params ="ins3="+a+"&neew=1";
   httpxml.open("POST", url, true);
   httpxml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   httpxml.setRequestHeader("Content-length", params.length);
   httpxml.setRequestHeader("Connection", "close");
   httpxml.send(params);


}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function insert4(a,b,c,d)
{
//alert(a)
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
httpxml.onreadystatechange = function() {
if(httpxml.readyState == 4 && httpxml.status == 200)
{

document.getElementById('dval').value=httpxml.responseText;
 if(document.getElementById('dval').value=='success')
 {
   document.getElementById('m').innerHTML='';
    alert(d);
 }

 else
 {
   document.getElementById('m').innerHTML=httpxml.responseText;
   alert('اين كتاب قابل تمديد نمي باشد');

 }





}
}
  document.getElementById(c).value=""

   var url=b;
   var params ="ins4="+a+"&neew=1";
   httpxml.open("POST", url, true);
   httpxml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   httpxml.setRequestHeader("Content-length", params.length);
   httpxml.setRequestHeader("Connection", "close");
   httpxml.send(params);


}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function insert5(a,b,c,dv)
{

var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
httpxml.onreadystatechange = function() {
if(httpxml.readyState == 4 && httpxml.status == 200)
{
 document.getElementById('dval').value=httpxml.responseText;
 if(document.getElementById('dval').value=='success')
 {
   document.getElementById('d1').innerHTML='';
   alert('ثبت با موفقيت انجام شد');
 }

 else
 {
   document.getElementById('d1').innerHTML=httpxml.responseText;
   alert('ثبت انجام نشد');

 }

var field2=new Array();
field2=dv.split(",");
for(i=0;i<field2.length;i++)
 {
  document.getElementById(field2[i]).innerHTML=""

 }

}
}
var field=new Array();
field=c.split(",");
var cou=0;
for(i=0;i<field.length;i++)
 {
  if(document.getElementById(field[i]).value="")
   {
	 cou++;
   }
 }

  var strChoices = "";
  var chk1 = document.getElementById('chk');
  if(chk1)
  {

    if (chk1.checked)
      strChoices='1';
    else
     strChoices ='0';
   }
   else
     strChoices ='0';
   var url=b;
   var params ="ins="+a+"&neew="+strChoices;
   httpxml.open("POST", url, true);
   httpxml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   httpxml.setRequestHeader("Content-length", params.length);
   httpxml.setRequestHeader("Connection", "close");
   httpxml.send(params);


}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function update(a,b,c)
{
//alert(b);
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
var url=b;
var params ="edit="+a+"&id="+c;
httpxml.open("POST", url, true);
httpxml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httpxml.setRequestHeader("Content-length", params.length);
httpxml.setRequestHeader("Connection", "close");
httpxml.onreadystatechange = function() {//Call a function when the state changes.
if(httpxml.readyState == 4 && httpxml.status == 200)
{

document.getElementById('main').innerHTML=httpxml.responseText;
alert('ويرايش با موفقيت انجام شد');
}
}
httpxml.send(params);
}

////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function dele(b,c)
{
//alert(c)
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
var url=b;
var params ="del="+'1'+"&id="+c;
httpxml.open("POST", url, true);
httpxml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httpxml.setRequestHeader("Content-length", params.length);
httpxml.setRequestHeader("Connection", "close");
httpxml.onreadystatechange = function() {//Call a function when the state changes.
if(httpxml.readyState == 4 && httpxml.status == 200)
{

document.getElementById('mainpart').innerHTML=httpxml.responseText;
alert('حذف با موفقيت انجام شد');

}
}
httpxml.send(params);
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function deleconf(b,c,d)
{
//alert(c)
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}

var answer = confirm("براي حذف مطمئنيد ؟")
if (answer)
{
var url=b;
var params ="del="+'1'+"&id="+c;
httpxml.open("POST", url, true);
httpxml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httpxml.setRequestHeader("Content-length", params.length);
httpxml.setRequestHeader("Connection", "close");
httpxml.onreadystatechange = function() {//Call a function when the state changes.
if(httpxml.readyState == 4 && httpxml.status == 200)
{

  alert('حذف با موفقيت انجام شد');

}
}

}
else
{
	ajaxload(d);
}

httpxml.send(params);
}

////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function editrec1(a)
{
//alert(a);
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
function stateChanged2()
{
if(httpxml.readyState==4 || httpxml.readyState=="complete")
{
  document.getElementById('mainpart').innerHTML=httpxml.responseText;

 //window.location="hesab_kol3.php";

}
}
var recslen =  document.forms[0].length;
var checkboxes=""
for(i=1;i<recslen;i++)
{
	if(document.forms[0].elements[i].checked==true)
	checkboxes+= " " + document.forms[0].elements[i].value
}

if(checkboxes.length>0)
{

  //alert(checkboxes);
  var url=a;
  url=url+"?edit1="+checkboxes;
  url=url+"&sid="+Math.random();
  httpxml.onreadystatechange=stateChanged2;
  httpxml.open("GET",url,true);
  httpxml.send(null);
}
else
{
  alert("رکوردی انتخاب نشده است");

}
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function delrec1(a)
{
//alert(a);
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
function stateChanged2()
{
if(httpxml.readyState==4 || httpxml.readyState=="complete")
{
  document.getElementById('mainpart').innerHTML=httpxml.responseText;

 //window.location="hesab_kol3.php";

}
}
var recslen =  document.forms[0].length;
var checkboxes=""
for(i=1;i<recslen;i++)
{
	if(document.forms[0].elements[i].checked==true)
	checkboxes+= " " + document.forms[0].elements[i].value
}

if(checkboxes.length>0)
{

  alert(checkboxes);
  var url=a;
  url=url+"?del1="+checkboxes;
  url=url+"&sid="+Math.random();
  httpxml.onreadystatechange=stateChanged2;
  httpxml.open("GET",url,true);
  httpxml.send(null);
}
else
{
  alert("رکوردی انتخاب نشده است");

}
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function update1(a,b)
{
//alert(b);
var httpxml;
try
{
httpxml=new XMLHttpRequest();
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}

param1=document.getElementById('f').value;
//alert(param1)
var url=a;
var params ="param="+param1;
httpxml.open("POST", url, true);
httpxml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httpxml.setRequestHeader("Content-length", params.length);
httpxml.setRequestHeader("Connection", "close");
httpxml.onreadystatechange = function() {//Call a function when the state changes.
if(httpxml.readyState == 4 && httpxml.status == 200)
{
 //window.location="hesab_kol.php";

document.getElementById('mainpart').innerHTML=httpxml.responseText;
}
}
httpxml.send(params);
}

////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
</script>