function disp_confirmf(code,locate)
{ 
	
  var r=confirm("Do you want to delete this field?");
 
  if (r==true)
    {
	
    	window.location=locate+".php?code="+code;
		
    }
}
function disp_confirm(code,locate)
{ 
	
  var r=confirm("Do you want to delete this field?");
 
  if (r==true)
    {
	
    	window.location=locate+".php?ID="+code;
		
    }
}
function disp_confirmation(code,locate)
{ 
	
  var r=confirm("Do you want to delete this field?");
 
  if (r==true)
    {
			
    	window.location=locate+".php?IDD="+code;
		
    }
}
function delete_file(code,locate,del)
{ 
	
  var r=confirm("Do you want to delete this File?");
 
  if (r==true)
    {
			
    	window.location=locate+".php?IDD="+code+"&del="+del;
		
    }
}
function delete_user(code,locate,del)
{ 
	
  var r=confirm("Do you want to delete this User?");
 
  if (r==true)
    {
			
    	window.location=locate+".php?IDD="+code+"&del="+del;
		
    }
}

function remove_file(code,locate,del,id)
{ 
	
  var r=confirm("Do you want to remove this File?");
 
  if (r==true)
    {
			
    	window.location=locate+".php?IDD="+code+"&del="+del+"&ID="+id;
		
    }
}
function disp_confirm1(code,locate)
{ 
	
  var r=confirm("Do you want to delete this field?");
  if (r==true)
    {
		
    	window.location=locate+".php?code1="+code;
		
    }
	else
	{
		window.close();
	}
}
function disp_confirm3(code,name,locate)
{ 
	//alert(code);
  var r=confirm("Are You Sure To Delete This Field...?");
  if (r==true)
    {
		
    	window.location=locate+".php?code="+code+"&name="+name;
    }
}
function delete_balance(id,locate)
{ 
	
  var r=confirm("Do you want to delete this field");
  if (r==true)
    {
		
    	window.location=locate+".php?id="+id;
		
    }
}
function disp_confirm1(code1,locate)
{ 
	
  var r=confirm("Do you want to delete this field");
  if (r==true)
    {
		
    	window.location=locate+".php?code1="+code1;
		
    }
}
 function disp_confirms(code,genid,locate)
{ 
	
  var r=confirm("Do you want to delete this field");
  if (r==true)
    {
		
    	window.location=locate+".php?code="+code+"&gid="+genid;
		
    }
} 
  
function confirm_details(id,id1,stat)
{
	//alert(stat)
	
		var answer = confirm("confirm position deletion ?");
	if (answer==true){
		alert("Position deleted");
		
		window.location = window.location.href+"&PosID="+id+"&stat="+stat+"&EventID="+id1;
		//alert(window.location)
	}
	else{
		alert("No action taken");
		}
}
function open_wini(cid) 
{
	//window.close();
	window.open("categoryedit1.php?cid="+cid,"mtls","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes,  copyhistory=yes, width=350, height=150");
	
}

function payoverdue(vno) 
{
	
window.open("pay_overdue.php?vno="+vno,"mtls","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes, width=300, height=150");
}
function open_wing() 
{
window.open("category.php","mtls","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes, width=300, height=150");
}
function open_downpay(vno) 
{
window.open("pay_downpayment.php?vno="+vno,"mtls","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes, width=300, height=150");
}
function open_print_payment(vno) 
{
	
	if(document.getElementById('hidfin').value==1)
	{
		window.open("print_payment_kar_all.php?vno="+vno,"mtls","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes");
	}
	else
	{
			window.open("print_payment_all.php?vno="+vno,"mtls","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes");
	}
}
function open_print_financedaily(name,searchdate) 
{
window.open("print_fainancedaily.php?name="+name+"&searchdate="+searchdate,"mtls","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes");
}
function open_print_companydaily(searchdate) 
{
window.open("print_companydaily.php?searchdate="+searchdate,"mtls","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes");
}
function open_print_financedate(name,searchdate1,searchdate2) 
{
window.open("print_financedate.php?name="+name+"&searchdate1="+searchdate1+"&searchdate2="+searchdate2,"mtls","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes");
}
function open_print_companydate(searchdate1,searchdate2) 
{
window.open("print_companyrange.php?searchdate1="+searchdate1+"&searchdate2="+searchdate2,"mtls","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes");
}
function open_client() 
{
window.open("add_client.php","mtls","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes, width=400, height=300");
}

function open_vehicle() 
{
window.open("add_vehicle.php","mtls","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes, width=400, height=230");
}

function CreateFolder(fn)
{      var myPath;
      var oas = new ActiveXObject("Scripting.FileSystemObject");
      myPath = "e:\anu";
      oas.CreateFolder(myPath);
      alert("Hello");
      //insert_filename(fn);
}


function disp_vehicle_expense(number) 
{
	window.open("vehicle_expense_display.php?number="+number,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes");
}
function print_loanpay() 
{
	window.open("print.php","","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes");
}
function printpage() 
{
	document.showpayment.submit();
	vehicleno=document.getElementById('hidvno').value;
	amount=document.getElementById('amount').value;
	
	if(document.getElementById('printbox').value==1)
	{
		if(document.getElementById('hidfin').value==1)
		{
				window.open("print_loan_karthika.php?vehicleno="+vehicleno+"&amount="+amount,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes,width=1000, height=500");
		}
		if(document.getElementById('hidfin').value!=1)
		{
				window.open("print_loan.php?vehicleno="+vehicleno+"&amount="+amount,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes,width=1000, height=500");
		}
	}
	
	
}
function printreceipt1() 
{
	document.receipt.submit();
	vehicleno=document.getElementById('hidvno').value;
	
	amount=document.getElementById('amount').value;
	
	installment=document.getElementById('installmentno').value;
	
	if(document.getElementById('printbox1').value==1)
	{
			
		if(document.getElementById('hidfin').value==1)
		{
				
				window.open("print_receipt_karthikeya.php?vehicleno="+vehicleno+"&amount="+amount+"&installment="+installment,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes,width=1000, height=500");
		}
		if(document.getElementById('hidfin').value!=1)
		{
				
				window.open("print_receipt.php?vehicleno="+vehicleno+"&amount="+amount+"&installment="+installment,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes,width=1000, height=500");
		}
	}
	
	
}

function printpagedate(id) 
{
	
		if(document.getElementById('hidfin').value==1)
		{
				window.open("print_loan_karthika_date.php?id="+id,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes,width=1000, height=500");
		}
		if(document.getElementById('hidfin').value!=1)
		{
				window.open("print_loan_date.php?id="+id,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes,width=1000, height=500");
		}
	
	
	
}

var id3='';
function hidselector(id1,id2)
{
	
	if(document.getElementById(id1).value!="" && id1!=id3)
	{
		i=document.getElementById(id2).value;
		document.getElementById(id2).value=parseInt(i)+1;
	
	}id3=id1;
}

function windvalid(id1,no)
{
	
	if(document.getElementById(id1).value==no)
	{
		 window.close();
		opener.location.reload(true);
		opener.location.reload(true);
	}
	else
	{
	 	//alert("Please fill all details");
		
	}
}
//for edit category
function close_wincat()
{
	
	if(document.form1.description.value=="")
	{
		alert("Please Fill a Description");
	}
	if(document.form1.description.value!="")
	{
	
    window.close();
	opener.location.reload(true);
	opener.location.reload(true);
	}
}

function counterUpdate(opt_countedTextBox,opt_maxSize) {
	
        var countedTextBox = opt_countedTextBox ;
        
        var maxSize = opt_maxSize;

        var field = document.getElementById(countedTextBox);

        if (field && field.value.length >= maxSize) {
                field.value = field.value.substring(0, maxSize);
        }
       
}
function deleteloan(locate)
{
		 var r=confirm("Do you want to delete this field");
		  if (r==true)
		 {
				code=document.getElementById('accountno').value;
				window.location=locate+".php?code="+code;
				
		 }
}
function results_per_page(val) {
		
		if(document.getElementById('current_url').value.indexOf('?') > 0 )
			loc = document.getElementById('current_url').value + '&show=' + val.value;
		else
			loc = document.getElementById('current_url').value + '?show=' + val.value;

		document.location.href = loc;
}

function chkcash(id,id1)
{
	if(document.getElementById(id1).checked==true)
		document.getElementById(id).style.display='block';
	else
		document.getElementById(id).style.display='none';
}
var divIdName =0;
function addElement() {
  var ni = document.getElementById('myDiv');
  var newdiv = document.createElement('label');
  var newdiv0 = document.createElement('input');
 
 
 
  divIdName= divIdName+1;
  document.getElementById('ttc').value=divIdName;
  newdiv0.setAttribute('id',"File"+divIdName);
  newdiv0.setAttribute('name',"File"+divIdName);
  newdiv0.setAttribute('size',"38");
   newdiv0.setAttribute('type',"file");
  
  
 

  ni.appendChild(newdiv);
  ni.appendChild(newdiv0);
  ni.appendChild(newdiv1);
  ni.appendChild(newdiv2);
  ni.appendChild(newdiv3);
  ni.appendChild(newdiv4);
  ni.appendChild(newdiv5);
  ni.appendChild(newdiv6);
}