//code fro validation upload mutiple cv
function upload_cvs()
{
if(document.getElementById('foldername').value == '')
{
document.form1.foldername.focus();
document.getElementById('foldername').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('foldername').style.borderColor = '';
}	
var fup = document.getElementById('file');
var fileName = fup.value;
var filesize=fup.size;
var ext = fileName.substring(fileName.lastIndexOf('.') + 1);
if(ext == "doc" || ext == "docx" || ext == "pdf" || ext == "rtf" || ext == "txt")
{
return true;
} 
else
{
alert("Upload Only doc,docx,pdf,rtf,txt");
fup.focus();
return false;
}
if(filesize > 1024000)
{
return true;
} 
else
{
alert("Max File Upload size is 1 MB");
fup.focus();
return false;
}
}
//next code

$(document).ready(function(){
$("#zipcode").autocomplete("autocomplete1.php", {
selectFirst: true
});
});
//valdtaion for privalges
function report_form()
{

 	
 var date1=document.getElementById('date1').value;
 if(document.getElementById('date1').value == '')
 {
 document.getElementById('date1').style.borderColor = '#F00';
 return false;
 }
 else
 {
document.getElementById('date1').style.borderColor = '';
 }
 if(!date1.match(/^[0-9]{4}\/(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])/))
 {

	document.getElementById('date1').style.borderColor = '#F00';

	//alert("Last Name Required");

		//document.form1.LastNamec.focus();

		return false;
 }
 else
 {
document.getElementById('date1').style.borderColor = '';
 }	
  var date2=document.getElementById('date2').value;
 if(document.getElementById('date2').value == '')
 {
 document.getElementById('date2').style.borderColor = '#F00';
 return false;
 }
 else if(document.getElementById('date2').value == "Incorrect Reference")
 {
 document.getElementById('date2').style.borderColor = '#F00';
 return false;
 }

  else
  {
 document.getElementById('date2').style.borderColor = '';
  }
   if(!date2.match(/^[0-9]{4}\/(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])/))
 {

	document.getElementById('date2').style.borderColor = '#F00';

	//alert("Last Name Required");

		//document.form1.LastNamec.focus();

		return false;
 }
 else
 {
document.getElementById('date2').style.borderColor = '';
 }

 return true;
}
function pre()
{
if(document.getElementById('name').value == '')
{
document.getElementById('name').style.borderColor = '#F00';
alert("Enter Name");
document.userform.name.focus();
return false;
}
else
{
document.getElementById('name').style.borderColor = '';
}
if(document.getElementById('des').value == '')
{
alert("Enter Description");
document.userform.des.focus();
document.getElementById('des').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('des').style.borderColor = '';
}
return true;
}

//validation for login
function login()
{
if(document.getElementById('email').value == '')
{
alert("Enter Email Address");
document.loginform.email.focus();
document.getElementById('email').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('email').style.borderColor = '';
}
var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
var email_address =loginform.email.value;
if (!ck_email.test(email_address)) 
{
alert("Enter Valid Email Address");
document.loginform.email.focus();
document.getElementById('email').style.borderColor = '#F00';
return false;
}
if(document.getElementById('password').value == '')
{
alert("Enter Password");
document.loginform.password.focus();
document.getElementById('password').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('password').style.borderColor = '';
}
return true;
}
function add_user()
{
if(document.getElementById('name').value == '')
{
document.getElementById('name').style.borderColor = '#F00';
alert("Enter Your Name");
document.form1.name.focus();
return false;

}
else
{
document.getElementById('name').style.borderColor = '';
}
if(document.getElementById('father_name').value == '')
{
document.getElementById('father_name').style.borderColor = '#F00';
alert("Enter Father Name");
document.form1.father_name.focus();
return false;
}
else
{
document.getElementById('father_name').style.borderColor = '';
}
var nic=document.getElementById('nic').value;
myRegExp = new RegExp(/\d{5}-\d{7}-\d/);
if(!myRegExp.test(nic)) {
document.getElementById('nic').style.borderColor = '#F00';
alert("Enter Valid CNIC Number");
document.form1.nic.focus();
return false; //if true
}
else {
document.getElementById('nic').style.borderColor = '';
//if false
}
if(document.getElementById('nic').value == '')
{
document.getElementById('nic').style.borderColor = '#F00';
alert("Enter CNIC Number");
document.form1.nic.focus();
return false;
}
else
{
document.getElementById('nic').style.borderColor = '';
}
/*if(document.getElementById('email').value == '')
{
document.getElementById('email').style.borderColor = '#F00';
alert("Enter Email Address");
document.form1.email.focus();
return false;
}
else
{
document.getElementById('email').style.borderColor = '';
}*/
var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
var email_address =form1.email.value;
if (!ck_email.test(email_address) && document.getElementById('email').value!='') 
{
alert("Enter Valid Email Address");
document.getElementById('email').style.borderColor = '#F00';
return false;
}

if(document.getElementById('password').value == '')
{
document.getElementById('password').style.borderColor = '#F00';
alert("Enter Password");
document.form1.password.focus();
return false;
}
else
{
document.getElementById('password').style.borderColor = '';
}
return true;
}
//code for webuser from vaildation
function add_webuser()
{
if(document.getElementById('fname').value == '')
{
document.getElementById('fname').style.borderColor = '#F00';
alert("Enter First Name");
document.form1.fname.focus();
return false;

}
else
{
document.getElementById('fname').style.borderColor = '';
}
if(document.getElementById('lname').value == '')
{
document.getElementById('lname').style.borderColor = '#F00';
alert("Enter Last Name");
document.form1.lname.focus();
return false;
}
else
{
document.getElementById('lname').style.borderColor = '';
}

if(document.getElementById('email').value == '')
{
document.getElementById('email').style.borderColor = '#F00';
alert("Enter Email Address");
document.form1.email.focus();
return false;
}
else
{
document.getElementById('email').style.borderColor = '';
}
var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
var email_address =form1.email.value;
if (!ck_email.test(email_address) && document.getElementById('email').value!='') 
{
alert("Enter Valid Email Address");
document.getElementById('email').style.borderColor = '#F00';
return false;
}

if(document.getElementById('password').value == '')
{
document.getElementById('password').style.borderColor = '#F00';
alert("Enter Password");
document.form1.password.focus();
return false;
}
else
{
document.getElementById('password').style.borderColor = '';
}
return true;
}
//code for team for vaildation
function add_team()
{
if(document.getElementById('image').value == '')
{
document.getElementById('image').style.borderColor = '#F00';
alert("Uplaod Team Memeber Image");
document.form1.image.focus();
return false;
}
else
{
document.getElementById('image').style.borderColor = '';
}
if(document.getElementById('team_name_datils').value == '')
{
document.getElementById('team_name_datils').style.borderColor = '#F00';
alert("Enter Title & details");
document.form1.team_name_datils.focus();
return false;

}
else
{
document.getElementById('team_name_datils').style.borderColor = '';
}
if(document.getElementById('team_desg').value == '')
{
document.getElementById('team_desg').style.borderColor = '#F00';
alert("Enter Designation & Other Details");
document.form1.team_desg.focus();
return false;
}
else
{
document.getElementById('team_desg').style.borderColor = '';
}
if(document.getElementById('team_details_full').value == '')
{
document.getElementById('team_details_full').style.borderColor = '#F00';
alert("Enter Full Details");
document.form1.team_details_full.focus();
return false;
}
else
{
document.getElementById('team_details_full').style.borderColor = '';
}
return true;
}
//code for Skills for vaildation
function add_skills()
{
if(document.getElementById('skill_name').value == '')
{
document.getElementById('skill_name').style.borderColor = '#F00';
//alert("Enter Skill Name");
document.form1.skill_name.focus();
return false;

}
else
{
document.getElementById('skill_name').style.borderColor = '';
}
if(document.getElementById('skill_code').value == '')
{
document.getElementById('skill_code').style.borderColor = '#F00';
//alert("Enter Skill Code");
document.form1.skill_code.focus();
return false;
}
else
{
document.getElementById('skill_code').style.borderColor = '';
}
return true;	
}
//code for currency
function add_currency()
{
if(document.getElementById('skill_name').value == '')
{
document.getElementById('skill_name').style.borderColor = '#F00';
alert("Enter Currency Name");
document.form1.skill_name.focus();
return false;

}
else
{
document.getElementById('skill_name').style.borderColor = '';
}
if(document.getElementById('skill_code').value == '')
{
document.getElementById('skill_code').style.borderColor = '#F00';
alert("Enter currency Symbol");
document.form1.skill_code.focus();
return false;
}
else
{
document.getElementById('skill_code').style.borderColor = '';
}
return true;	
}
//code for languages for vaildation
function add_languages()
{
if(document.getElementById('language_name').value == '')
{
document.getElementById('language_name').style.borderColor = '#F00';
alert("Enter Language Name");
document.form1.language_name.focus();
return false;

}
else
{
document.getElementById('language_name').style.borderColor = '';
}
return true;	
}
//code for languages for vaildation
function update_cms()
{
	
if(document.getElementById('title').value == '')
{
document.getElementById('title').style.borderColor = '#F00';
alert("Enter Page Title");
document.form1.title.focus();
return false;
}
else
{
document.getElementById('title').style.borderColor = '';
}
if(document.getElementById('body').value == '')
{
document.getElementById('body').style.borderColor = '#F00';
alert("Enter Page Content");
document.form1.body.focus();
return false;
}
else
{
document.getElementById('body').style.borderColor = '';
}
if(document.getElementById('meta_keywords').value == '')
{
document.getElementById('meta_keywords').style.borderColor = '#F00';
alert("Enter Page Meta Keywords");
document.form1.meta_keywords.focus();
return false;
}
else
{
document.getElementById('meta_keywords').style.borderColor = '';
}
if(document.getElementById('meta_description').value == '')
{
document.getElementById('meta_description').style.borderColor = '#F00';
alert("Enter Page Meta Discription");
document.form1.meta_description.focus();
return false;
}
else
{
document.getElementById('meta_description').style.borderColor = '';
}
return true;	
}
//code for email templtes for vaildation
function email_templtes()
{	
if(document.getElementById('type').value == '')
{
document.getElementById('type').style.borderColor = '#F00';
alert("Enter templte Type");
document.form1.type.focus();
return false;
}
else
{
document.getElementById('type').style.borderColor = '';
}
var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
var email_address =form1.femail.value;
if (!ck_email.test(email_address) && document.getElementById('femail').value!='') 
{
alert("Enter Valid Email Address");
document.getElementById('femail').style.borderColor = '#F00';
return false;
}
var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
var temail_address =form1.temail.value;
if (!ck_email.test(temail_address) && document.getElementById('temail').value!='') 
{
alert("Enter Valid Email Address");
document.getElementById('temail').style.borderColor = '#F00';
return false;
}

if(document.getElementById('subject').value == '')
{
document.getElementById('subject').style.borderColor = '#F00';
alert("Enter Subject");
document.form1.subject.focus();
return false;
}
else
{
document.getElementById('subject').style.borderColor = '';
}
if(document.getElementById('body').value == '')
{
document.getElementById('body').style.borderColor = '#F00';
alert("Enter Body Content");
document.form1.body.focus();
return false;
}
else
{
document.getElementById('body').style.borderColor = '';
}
return true;	
}
//code for testimonials for vaildation
function add_testimonials()
{
	
if(document.getElementById('title').value == '')
{
document.getElementById('title').style.borderColor = '#F00';
alert("Enter Title & details");
document.form1.title.focus();
return false;
}
else
{
document.getElementById('title').style.borderColor = '';
}

return true;	
}
//code for add job
function add_job_cat()
{

if(document.getElementById('jobs_category_title').value == '')
{
alert("Enter Category Title");
document.loginform.jobs_category_title.focus();
document.getElementById('jobs_category_title').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('jobs_category_title').style.borderColor = '';
}
if(document.getElementById('jobs_category_des').value == '')
{
alert("Enter Category Details");
document.loginform.jobs_category_des.focus();
document.getElementById('jobs_category_des').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('jobs_category_des').style.borderColor = '';
}
return true;
}

function add_job_details()
{
if(document.getElementById('company_name').value == '')
{
alert("Enter Company Name");
document.loginform.company_name.focus();
document.getElementById('company_name').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('company_name').style.borderColor = '';
}
if(document.getElementById('image').value == '')
{
alert("Uplaod Company Logo");
document.loginform.image.focus();
document.getElementById('image').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('image').style.borderColor = '';
}
if(document.getElementById('job_title').value == '')
{
alert("Uplaod Job Title");
document.loginform.job_title.focus();
document.getElementById('job_title').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('job_title').style.borderColor = '';
}

if(document.getElementById('job_salary_from').value == '')
{
document.getElementById('job_salary_from').style.borderColor = '#F00';
alert("Enter Salary From");
document.loginform.job_salary_from.focus();
return false;
}
else
{
document.getElementById('job_salary_from').style.borderColor = '';
}
if(document.getElementById('job_salary_to').value == '')
{
document.getElementById('job_salary_to').style.borderColor = '#F00';
alert("Enter Salary From");
document.loginform.job_salary_to.focus();
return false;
}
else
{
document.getElementById('job_salary_to').style.borderColor = '';
}
if(document.getElementById('job_contact_fname').value == '')
{
document.getElementById('job_contact_fname').style.borderColor = '#F00';
alert("Enter First Name");
document.loginform.job_contact_fname.focus();
return false;
}
else
{
document.getElementById('job_contact_fname').style.borderColor = '';
}
if(document.getElementById('job_contact_lname').value == '')
{
document.getElementById('job_contact_lname').style.borderColor = '#F00';
alert("Enter Last Name");
document.loginform.job_contact_lname.focus();
return false;
}
else
{
document.getElementById('job_contact_lname').style.borderColor = '';
}
if(document.getElementById('job_contact_email').value == '')
{
document.getElementById('job_contact_email').style.borderColor = '#F00';
alert("Enter Email Address");
document.loginform.job_contact_email.focus();
return false;
}
else
{
document.getElementById('job_contact_email').style.borderColor = '';
}
var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
var email_address =loginform.job_contact_email.value;
if (!ck_email.test(email_address) && document.getElementById('job_contact_email').value!='') 
{
alert("Enter Valid Email Address");
document.getElementById('job_contact_email').style.borderColor = '#F00';
return false;
}
if(document.getElementById('exp_date').value == '')
{
alert("Enter Date");
document.loginform.exp_date.focus();
document.getElementById('exp_date').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('exp_date').style.borderColor = '';
}
var date_value=document.getElementById('exp_date').value	
if(!date_value.match(/^[0-9]{4}\/(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])/))
{
alert("Enter Valid date");
document.loginform.exp_date.focus();
document.getElementById('exp_date').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('exp_date').style.borderColor = '';
}
if(document.getElementById('secters').value == '')
{
document.getElementById('secters').style.borderColor = '#F00';
alert("Enter Industry Secters");
document.loginform.secters.focus();
return false;
}
else
{
document.getElementById('secters').style.borderColor = '';
}
return true;
}
//add product 
function add_product()
{
if(document.getElementById('prod_number').value == '')
{
document.getElementById('prod_number').style.borderColor = '#F00';
alert("Enter Product Number");
document.form1.prod_number.focus();
return false;
}
else
{
document.getElementById('prod_number').style.borderColor = '';
}
if(document.getElementById('prod_name').value == '')
{
document.getElementById('prod_name').style.borderColor = '#F00';
alert("Enter Product Name");
document.form1.prod_name.focus();
return false;
}
else
{
document.getElementById('prod_name').style.borderColor = '';
}

if(document.getElementById('prod_price').value == '')
{
document.getElementById('prod_price').style.borderColor = '#F00';
alert("Enter Product Price Per(kg/Ltr)");
document.form1.prod_price.focus();
return false;
}
else
{
document.getElementById('prod_price').style.borderColor = '';
}	
if(document.getElementById('prod_qty').value == '')
{
document.getElementById('prod_qty').style.borderColor = '#F00';
alert("Enter Product Weight Per(kg/Ltr)");
document.form1.prod_qty.focus();
return false;
}
else
{
document.getElementById('prod_qty').style.borderColor = '';
}
return true;
}

//make sale 
function make_sale()
{
if(document.getElementById('autonumber').value == '')
{
document.getElementById('autonumber').style.borderColor = '#F00';
alert("Enter Sale Number");
document.form1.autonumber.focus();
return false;
}
else
{
document.getElementById('autonumber').style.borderColor = '';
}
if(document.getElementById('prod_qty').value < 0)
{
alert("Stock Is Empty For this Product");
return false;
}

if(document.getElementById('cutomer_id').value == '')
{
document.getElementById('cutomer_id').style.borderColor = '#F00';
alert("Enter Customer Name");
document.form1.cutomer_id.focus();
return false;
}
else
{
document.getElementById('cutomer_id').style.borderColor = '';
}
if(document.getElementById('sale_price').value == '')
{
document.getElementById('sale_price').style.borderColor = '#F00';
alert("Enter Sale Price Per(kg/Ltr)");
document.form1.sale_price.focus();
return false;
}
else
{
document.getElementById('sale_price').style.borderColor = '';
}	
if(document.getElementById('sale_qty').value == '')
{
document.getElementById('sale_qty').style.borderColor = '#F00';
alert("Enter Sale Weight In(kg/Ltr)");
document.form1.sale_qty.focus();
return false;
}
else
{
document.getElementById('sale_qty').style.borderColor = '';
}
if(document.getElementById('sale_total_amount').value == '')
{
document.getElementById('sale_total_amount').style.borderColor = '#F00';
alert("Enter Total Amount");
document.form1.sale_total_amount.focus();
return false;
}
else
{
document.getElementById('sale_total_amount').style.borderColor = '';
}
if(document.getElementById('sale_amount_receivable').value == '')
{
document.getElementById('sale_amount_receivable').style.borderColor = '#F00';
alert("Enter Amount Receivable");
document.form1.sale_amount_receivable.focus();
return false;
}
else
{
document.getElementById('sale_amount_receivable').style.borderColor = '';
}
if(document.getElementById('sale_amount_remaining').value == '')
{
document.getElementById('sale_amount_remaining').style.borderColor = '#F00';
alert("Enter Amount Remaining");
document.form1.sale_amount_remaining.focus();
return false;
}
else
{
document.getElementById('sale_amount_remaining').style.borderColor = '';
}

var value1=document.getElementById('sale_amount_receivable').value;
var value2=document.getElementById('sale_total_amount').value;
//alert(value1);
//alert(value2);
if(parseInt(value1) > parseInt(value2))
{
document.getElementById('sale_amount_receivable').style.borderColor = '#F00';
alert("Amount Receivable > Total Amount");
document.form1.sale_amount_receivable.focus();
return false;
}
else
{
document.getElementById('sale_amount_receivable').style.borderColor = '';
}
if(document.getElementById('account_title').value == '' && document.getElementById('payment_mode').value==2)
{
document.getElementById('account_title').style.borderColor = '#F00';
alert("Enter Account Title");
document.form1.account_title.focus();
return false;
}
else
{
document.getElementById('account_title').style.borderColor = '';
}

if(document.getElementById('account_number').value == '' && document.getElementById('payment_mode').value==2)
{
document.getElementById('account_number').style.borderColor = '#F00';
alert("Enter Account Number");
document.form1.account_number.focus();
return false;
}
else
{
document.getElementById('account_number').style.borderColor = '';
}

if(document.getElementById('bank_name').value == '' && document.getElementById('payment_mode').value==2)
{
document.getElementById('bank_name').style.borderColor = '#F00';
alert("Enter Bank Details");
document.form1.bank_name.focus();
return false;
}
else
{
document.getElementById('bank_name').style.borderColor = '';
}
if(document.getElementById('card_number').value == '' && document.getElementById('payment_mode').value==3)
{
document.getElementById('card_number').style.borderColor = '#F00';
alert("Enter Debit Card Number");
document.form1.card_number.focus();
return false;
}
else
{
document.getElementById('card_number').style.borderColor = '';
}
if(document.getElementById('owner_name').value == '' && document.getElementById('payment_mode').value==3)
{
document.getElementById('owner_name').style.borderColor = '#F00';
alert("Enter Owner Name");
document.form1.owner_name.focus();
return false;
}
else
{
document.getElementById('owner_name').style.borderColor = '';
}
if(document.getElementById('owner_phone').value == '' && document.getElementById('payment_mode').value==3)
{
document.getElementById('owner_phone').style.borderColor = '#F00';
alert("Enter Owner Phone Number");
document.form1.owner_phone.focus();
return false;
}
else
{
document.getElementById('owner_phone').style.borderColor = '';
}
/*if(document.getElementById('owner_email').value == '' && document.getElementById('payment_mode').value==3)
{
document.getElementById('owner_email').style.borderColor = '#F00';
alert("Enter Owner Email Address");
document.form1.owner_email.focus();
return false;
}
else
{
document.getElementById('owner_email').style.borderColor = '';
}*/
var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
var email_address =form1.owner_email.value;
if (!ck_email.test(email_address) && document.getElementById('payment_mode').value==3) 
{
alert("Enter Valid Email Address");
document.getElementById('owner_email').style.borderColor = '#F00';
return false;
}
return true;
}
//make reurne 
function make_return()
{
if(document.getElementById('autonumber').value == '')
{
document.getElementById('autonumber').style.borderColor = '#F00';
alert("Enter Return Number");
document.form1.autonumber.focus();
return false;
}
else
{
document.getElementById('autonumber').style.borderColor = '';
}
if(document.getElementById('sale_price').value == '')
{
document.getElementById('sale_price').style.borderColor = '#F00';
alert("Enter Return Price Per(kg/Ltr)");
document.form1.sale_price.focus();
return false;
}
else
{
document.getElementById('sale_price').style.borderColor = '';
}	
if(document.getElementById('sale_qty').value == '')
{
document.getElementById('sale_qty').style.borderColor = '#F00';
alert("Enter Return Weight Per(kg/Ltr)");
document.form1.sale_qty.focus();
return false;
}
else
{
document.getElementById('sale_qty').style.borderColor = '';
}
if(document.getElementById('sale_total_amount').value == '')
{
document.getElementById('sale_total_amount').style.borderColor = '#F00';
alert("Enter Total Amount(PKR)");
document.form1.sale_total_amount.focus();
return false;
}
else
{
document.getElementById('sale_total_amount').style.borderColor = '';
}
if(document.getElementById('sale_amount_receivable').value == '')
{
document.getElementById('sale_amount_receivable').style.borderColor = '#F00';
alert("Enter Amount Payable");
document.form1.sale_amount_receivable.focus();
return false;
}
else
{
document.getElementById('sale_amount_receivable').style.borderColor = '';
}
if(document.getElementById('sale_amount_remaining').value == '')
{
document.getElementById('sale_amount_remaining').style.borderColor = '#F00';
alert("Enter Amount Remaining");
document.form1.sale_amount_remaining.focus();
return false;
}
else
{
document.getElementById('sale_amount_remaining').style.borderColor = '';
}

//var value1=document.getElementById('sale_amount_receivable').value;
//var value2=document.getElementById('sale_total_amount').value;
////alert(value1);
////alert(value2);
//if(parseInt(value1) > parseInt(value2))
//{
//document.getElementById('sale_amount_receivable').style.borderColor = '#F00';
//alert("Amount Receivable > Total Amount");
//document.form1.sale_amount_receivable.focus();
//return false;
//}
//else
//{
//document.getElementById('sale_amount_receivable').style.borderColor = '';
//}
if(document.getElementById('account_title').value == '' && document.getElementById('payment_mode').value==2)
{
document.getElementById('account_title').style.borderColor = '#F00';
alert("Enter Account Title");
document.form1.account_title.focus();
return false;
}
else
{
document.getElementById('account_title').style.borderColor = '';
}

if(document.getElementById('account_number').value == '' && document.getElementById('payment_mode').value==2)
{
document.getElementById('account_number').style.borderColor = '#F00';
alert("Enter Account Number");
document.form1.account_number.focus();
return false;
}
else
{
document.getElementById('account_number').style.borderColor = '';
}

if(document.getElementById('bank_name').value == '' && document.getElementById('payment_mode').value==2)
{
document.getElementById('bank_name').style.borderColor = '#F00';
alert("Enter Bank Details");
document.form1.bank_name.focus();
return false;
}
else
{
document.getElementById('bank_name').style.borderColor = '';
}
if(document.getElementById('card_number').value == '' && document.getElementById('payment_mode').value==3)
{
document.getElementById('card_number').style.borderColor = '#F00';
alert("Enter Debit Card Number");
document.form1.card_number.focus();
return false;
}
else
{
document.getElementById('card_number').style.borderColor = '';
}
if(document.getElementById('owner_name').value == '' && document.getElementById('payment_mode').value==3)
{
document.getElementById('owner_name').style.borderColor = '#F00';
alert("Enter Owner Name");
document.form1.owner_name.focus();
return false;
}
else
{
document.getElementById('owner_name').style.borderColor = '';
}
if(document.getElementById('owner_phone').value == '' && document.getElementById('payment_mode').value==3)
{

document.getElementById('owner_phone').style.borderColor = '#F00';
alert("Enter Owner Phone Number");
document.form1.owner_phone.focus();
return false;
}
else
{
document.getElementById('owner_phone').style.borderColor = '';
}
/*if(document.getElementById('owner_email').value == '' && document.getElementById('payment_mode').value==3)
{
document.getElementById('owner_email').style.borderColor = '#F00';
alert("Enter Owner Email Address");
document.form1.owner_email.focus();
return false;
}
else
{
document.getElementById('owner_email').style.borderColor = '';
}*/
var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
var email_address =form1.owner_email.value;
if (!ck_email.test(email_address) && document.getElementById('payment_mode').value==3) 
{
alert("Enter Valid Email Address");
document.getElementById('owner_email').style.borderColor = '#F00';
return false;
}
return true;
}
//code for Purchase
function make_purchase()
{


if(document.getElementById('supplier_name').value == '')
{
document.getElementById('supplier_name').style.borderColor = '#F00';
alert("Enter Supplier Name");
document.form1.supplier_name.focus();
return false;
}
else
{
document.getElementById('supplier_name').style.borderColor = '';
}

if(document.getElementById('prod_name').value == '')
{
document.getElementById('prod_name').style.borderColor = '#F00';
alert("Enter Product Name");
document.form1.prod_name.focus();
return false;
}
else
{
document.getElementById('prod_name').style.borderColor = '';
}
if(document.getElementById('autonumber').value == '')
{
document.getElementById('autonumber').style.borderColor = '#F00';
alert("Enter Purchase Number");
document.form1.autonumber.focus();
return false;
}
else
{
document.getElementById('autonumber').style.borderColor = '';
}
//if(document.getElementById('prod_price').value == '')
//{
//document.getElementById('prod_price').style.borderColor = '#F00';
//alert("Enter Product Price Per(kg/Ltr)");
//document.form1.prod_price.focus();
//return false;
//}
//else
//{
//document.getElementById('prod_price').style.borderColor = '';
//}	
//if(document.getElementById('prod_qty').value == '')
//{
//document.getElementById('prod_qty').style.borderColor = '#F00';
//alert("Enter Product Weight Per(kg/Ltr)");
//document.form1.prod_qty.focus();
//return false;
//}
//else
//{
//document.getElementById('prod_qty').style.borderColor = '';
//}
if(document.getElementById('sale_price').value == '')
{
document.getElementById('sale_price').style.borderColor = '#F00';
alert("Enter Purchase Price Per(kg/Ltr)");
document.form1.sale_price.focus();
return false;
}
else
{
document.getElementById('sale_price').style.borderColor = '';
}	
if(document.getElementById('sale_qty').value == '')
{
document.getElementById('sale_qty').style.borderColor = '#F00';
alert("Enter Purchase Weight Per(kg/Ltr)");
document.form1.sale_qty.focus();
return false;
}
else
{
document.getElementById('sale_qty').style.borderColor = '';
}
if(document.getElementById('sale_total_amount').value == '')
{
document.getElementById('sale_total_amount').style.borderColor = '#F00';
alert("Enter Total Amount(PKR)");
document.form1.sale_total_amount.focus();
return false;
}
else
{
document.getElementById('sale_total_amount').style.borderColor = '';
}
if(document.getElementById('sale_amount_receivable').value == '')
{
document.getElementById('sale_amount_receivable').style.borderColor = '#F00';
alert("Enter Amount Payable");
document.form1.sale_amount_receivable.focus();
return false;
}
else
{
document.getElementById('sale_amount_receivable').style.borderColor = '';
}
if(document.getElementById('sale_amount_remaining').value == '')
{
document.getElementById('sale_amount_remaining').style.borderColor = '#F00';
alert("Enter Amount Remaining");
document.form1.sale_amount_remaining.focus();
return false;
}
else
{
document.getElementById('sale_amount_remaining').style.borderColor = '';
}

//var value1=document.getElementById('sale_amount_receivable').value;
//var value2=document.getElementById('sale_total_amount').value;
////alert(value1);
////alert(value2);
//if(parseInt(value1) > parseInt(value2))
//{
//document.getElementById('sale_amount_receivable').style.borderColor = '#F00';
//alert("Amount Receivable > Total Amount");
//document.form1.sale_amount_receivable.focus();
//return false;
//}
//else
//{
//document.getElementById('sale_amount_receivable').style.borderColor = '';
//}
//if(document.getElementById('comment').value == '' && document.getElementById('payment_mode').value==1)
//{
//document.getElementById('comment').style.borderColor = '#F00';
//alert("Enter Comments");
//document.form1.comment.focus();
//return false;
//}
//else
//{
//document.getElementById('comment').style.borderColor = '';
//}
if(document.getElementById('account_title').value == '' && document.getElementById('payment_mode').value==2)
{
document.getElementById('account_title').style.borderColor = '#F00';
alert("Enter Account Title");
document.form1.account_title.focus();
return false;
}
else
{
document.getElementById('account_title').style.borderColor = '';
}

if(document.getElementById('account_number').value == '' && document.getElementById('payment_mode').value==2)
{
document.getElementById('account_number').style.borderColor = '#F00';
alert("Enter Account Number");
document.form1.account_number.focus();
return false;
}
else
{
document.getElementById('account_number').style.borderColor = '';
}

if(document.getElementById('bank_name').value == '' && document.getElementById('payment_mode').value==2)
{
document.getElementById('bank_name').style.borderColor = '#F00';
alert("Enter Bank Details");
document.form1.bank_name.focus();
return false;
}
else
{
document.getElementById('bank_name').style.borderColor = '';
}
if(document.getElementById('card_number').value == '' && document.getElementById('payment_mode').value==3)
{
document.getElementById('card_number').style.borderColor = '#F00';
alert("Enter Debit Card Number");
document.form1.card_number.focus();
return false;
}
else
{
document.getElementById('card_number').style.borderColor = '';
}
if(document.getElementById('owner_name').value == '' && document.getElementById('payment_mode').value==3)
{
document.getElementById('owner_name').style.borderColor = '#F00';
alert("Enter Owner Name");
document.form1.owner_name.focus();
return false;
}
else
{
document.getElementById('owner_name').style.borderColor = '';
}
if(document.getElementById('owner_phone').value == '' && document.getElementById('payment_mode').value==3)
{
document.getElementById('owner_phone').style.borderColor = '#F00';
alert("Enter Owner Phone Number");
document.form1.owner_phone.focus();
return false;
}
else
{
document.getElementById('owner_phone').style.borderColor = '';
}
/*if(document.getElementById('owner_email').value == '' && document.getElementById('payment_mode').value==3)
{
document.getElementById('owner_email').style.borderColor = '#F00';
alert("Enter Owner Email Address");
document.form1.owner_email.focus();
return false;
}
else
{
document.getElementById('owner_email').style.borderColor = '';
}*/
var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
var email_address =form1.owner_email.value;
if (!ck_email.test(email_address) && document.getElementById('payment_mode').value==3) 
{
alert("Enter Valid Email Address");
document.getElementById('owner_email').style.borderColor = '#F00';
return false;
}
return true;
}
//cpde for add customer
function add_customer()
{
if(document.getElementById('fname').value == '')
{
alert("Enter First Name");
document.userform.fname.focus();
document.getElementById('fname').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('fname').style.borderColor = '';
}
/*if(document.getElementById('email').value == '')
{
alert("Enter Email address");
document.userform.email.focus();
document.getElementById('email').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('email').style.borderColor = '';
}*/
var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
var email_address =userform.email.value;
if (!ck_email.test(email_address) && document.getElementById('email').value != '') 
{
alert("Enter Valid Email Address");
document.userform.email.focus();
document.getElementById('email').style.borderColor = '#F00';
return false;
}
return true;
}
//cpde for add time sheet form
function add_timesheet()
{
if(document.getElementById('employee_name').value == '')
{
alert("Enter Employee Name");
document.userform.employee_name.focus();
document.getElementById('employee_name').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('employee_name').style.borderColor = '';
}
if(document.getElementById('date').value == '')
{
alert("Enter Date");
document.userform.date.focus();
document.getElementById('date').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('date').style.borderColor = '';
}
var date_value=document.getElementById('date').value	
if(!date_value.match(/^[0-9]{4}\/(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])/))
{
alert("Enter Valid date");
document.userform.date1.focus();
document.getElementById('date').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('date').style.borderColor = '';
}
return true;
}


//cpde for add employee
function add_employee()
{
if(document.getElementById('employee_fname').value == '')
{
alert("Enter First Name");
document.userform.employee_fname.focus();
document.getElementById('employee_fname').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('employee_fname').style.borderColor = '';
}
/*if(document.getElementById('email').value == '')
{
alert("Enter Email address");
document.userform.email.focus();
document.getElementById('email').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('email').style.borderColor = '';
}*/
var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
var email_address =userform.email.value;
if (!ck_email.test(email_address) && document.getElementById('email').value != '') 
{
alert("Enter Valid Email Address");
document.userform.email.focus();
document.getElementById('email').style.borderColor = '#F00';
return false;
}
if(document.getElementById('employee_working_status').value == '')
{
alert("Enter Working Status");
document.userform.employee_working_status.focus();
document.getElementById('employee_working_status').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('employee_working_status').style.borderColor = '';
}
if(document.getElementById('employee_salary').value == '')
{
alert("Enter Salary");
document.userform.employee_salary.focus();
document.getElementById('employee_salary').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('employee_salary').style.borderColor = '';
}
return true;
}
//cpde for add gate pass
function add_gatepass()
{

if(document.getElementById('gate_pass_number').value == '')
{
alert("Enter Gate Pass Number");
document.userform.gate_pass_number.focus();
document.getElementById('gate_pass_number').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('gate_pass_number').style.borderColor = '';
}
if(document.getElementById('date1').value == '')
{
alert("Enter Date");
document.userform.date1.focus();
document.getElementById('date1').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('date1').style.borderColor = '';
}
var date_value=document.getElementById('date1').value	
if(!date_value.match(/^[0-9]{4}\/(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])/))
{
alert("Enter Valid date");
document.userform.date1.focus();
document.getElementById('date1').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('date1').style.borderColor = '';
}
if(document.getElementById('time_in').value == '' && document.getElementById('type').value==1)
{
alert("Enter Time In");
document.userform.time_in.focus();
document.getElementById('time_in').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('time_in').style.borderColor = '';
}
if(document.getElementById('cutomer_id').value == '' && document.getElementById('type').value==1)
{
alert("Enter Customer Name");
document.userform.cutomer_id.focus();
document.getElementById('cutomer_id').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('cutomer_id').style.borderColor = '';
}
if(document.getElementById('time_out').value == '' && document.getElementById('type').value==2)
{
alert("Enter Time Out");
document.userform.time_out.focus();
document.getElementById('time_out').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('time_out').style.borderColor = '';
}
if(document.getElementById('supplier_name').value == '' && document.getElementById('type').value==2)
{
alert("Enter Supplier Name");
document.userform.supplier_name.focus();
document.getElementById('supplier_name').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('supplier_name').style.borderColor = '';
}
if(document.getElementById('prod_name').value == '')
{
alert("Enter Product Name");
document.userform.prod_name.focus();
document.getElementById('prod_name').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('prod_name').style.borderColor = '';
}
if(document.getElementById('qty').value == '')
{
alert("Enter Quantity");
document.userform.qty.focus();
document.getElementById('qty').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('qty').style.borderColor = '';
}
if(document.getElementById('vehicle_number').value == '')
{
alert("Enter Vehicle Number");
document.userform.vehicle_number.focus();
document.getElementById('vehicle_number').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('vehicle_number').style.borderColor = '';
}
if(document.getElementById('total_payment').value == '')
{
alert("Enter Total payment");
document.userform.total_payment.focus();
document.getElementById('total_payment').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('total_payment').style.borderColor = '';
}
return true;
}
//expense from code
function add_exp()
{
if(document.getElementById('autonumber').value == '')
{
alert("Enter Expense Number/ID");
document.userform.autonumber.focus();
document.getElementById('autonumber').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('autonumber').style.borderColor = '';
}
if(document.getElementById('date1').value == '')
{
alert("Enter Date");
document.userform.date1.focus();
document.getElementById('date1').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('date1').style.borderColor = '';
}
var date_value=document.getElementById('date1').value	
if(!date_value.match(/^[0-9]{4}\/(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])/))
{
alert("Enter Valid date");
document.userform.date1.focus();
document.getElementById('date1').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('date1').style.borderColor = '';
}
if(document.getElementById('exp_des').value == '')
{
alert("Enter Description");
document.userform.exp_des.focus();
document.getElementById('exp_des').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('exp_des').style.borderColor = '';
}

if(document.getElementById('exp_type').value == '')
{
alert("Enter Type");
document.userform.exp_type.focus();
document.getElementById('exp_type').style.borderColor = '#F00';
return false;
}
else
{
document.getElementById('exp_type').style.borderColor = '';
}
return true;
}
//validation date reading form
function date_form()
{
var date_value=document.getElementById('date').value	
if(!date_value.match(/^[0-9]{4}\/(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])/))
{

document.getElementById('date').style.borderColor = '#F00';

//alert("Last Name Required");

//document.form1.LastNamec.focus();

return false;
}
else
{
document.getElementById('date').style.borderColor = '';
}
var ref_number=document.getElementById('date').value;

if(document.getElementById('date').value == '')

{

document.getElementById('date').style.borderColor = '#F00';

//alert("First Name Required");

//document.form1.FirstNamec.focus();

return false;

}
else
{
document.getElementById('date').style.borderColor = '';
}

var amount=document.getElementById('amount').value;

if(document.getElementById('amount').value == '')

{

document.getElementById('amount').style.borderColor = '#F00';

//alert("First Name Required");

//document.form1.FirstNamec.focus();

return false;

}
else
{
document.getElementById('amount').style.borderColor = '';
}
return true;
}
function group_form()
{
alert('asas');
if(document.getElementById('name').value == '')
{
document.getElementById('name').style.borderColor = '#F00';
alert("Enter Name");
document.userform.name.focus();
return false;
}
else
{
document.getElementById('name').style.borderColor = '';
}
if(document.getElementById('desc').value == '')
{
document.getElementById('desc').style.borderColor = '#F00';
alert("Enter Description");
document.userform.desc.focus();
return false;
}
else
{
document.getElementById('desc').style.borderColor = '';
}
if(document.getElementById('type').value == '')
{
document.getElementById('type').style.borderColor = '#F00';
alert("Enter Type");
document.userform.type.focus();
return false;
}
else
{
document.getElementById('type').style.borderColor = '';
}
return true;
}
//calcoulte total
function cal_total()
{
//alert('hello');
document.getElementById('sale_total_amount').value=document.getElementById('sale_price').value*document.getElementById('sale_qty').value;
document.getElementById('cm_weight').value=document.getElementById('sale_qty').value;
}
//calcoulte rec
function amount_rec()
{
document.getElementById('sale_amount_remaining').value=document.getElementById('sale_total_amount').value-document.getElementById('sale_amount_receivable').value;
}
function paymentvalue()
{
if(document.getElementById('payment_mode').value==2)
{
document.getElementById('card1').style.display='none';
document.getElementById('cash').style.display='none';
document.getElementById('card2').style.display='none';
document.getElementById('card3').style.display='none';
document.getElementById('card4').style.display='none';
document.getElementById('cheque1').style.display='block';
document.getElementById('cheque2').style.display='block';
document.getElementById('cheque3').style.display='block';
}
if(document.getElementById('payment_mode').value==3)
{
document.getElementById('card1').style.display='block';
document.getElementById('card2').style.display='block';
document.getElementById('card3').style.display='block';
document.getElementById('card4').style.display='block';
document.getElementById('cheque1').style.display='none';
document.getElementById('cheque2').style.display='none';
document.getElementById('cheque3').style.display='none';
document.getElementById('cash').style.display='none';
}
if(document.getElementById('payment_mode').value==4)
{
document.getElementById('card1').style.display='none';
document.getElementById('card2').style.display='none';
document.getElementById('card3').style.display='none';
document.getElementById('card4').style.display='none';
document.getElementById('cheque1').style.display='none';
document.getElementById('cheque2').style.display='none';
document.getElementById('cheque3').style.display='none';
document.getElementById('cash').style.display='none';
}
if(document.getElementById('payment_mode').value==1)
{
document.getElementById('card1').style.display='none';
document.getElementById('card2').style.display='none';
document.getElementById('card3').style.display='none';
document.getElementById('card4').style.display='none';
document.getElementById('cheque1').style.display='none';
document.getElementById('cheque2').style.display='none';
document.getElementById('cheque3').style.display='none';
document.getElementById('cash').style.display='block';
}
}
function gaepassvalue()
{
if(document.getElementById('type').value==1)
{
document.getElementById('timeout1').style.display='none';
document.getElementById('timeout2').style.display='none';
document.getElementById('timein1').style.display='block';
document.getElementById('timein2').style.display='block';
document.getElementById('timeoutlabel').style.display='none';
document.getElementById('timeinlabel').style.display='block';
}

if(document.getElementById('type').value==2)
{
document.getElementById('timeout1').style.display='block';
document.getElementById('timeout2').style.display='block';
document.getElementById('timein1').style.display='none';
document.getElementById('timein2').style.display='none';
document.getElementById('timeinlabel').style.display='none';
document.getElementById('timeoutlabel').style.display='block';
}
}
function cal_total_cm()
{
document.getElementById('cm_total_amount').value=document.getElementById('cm_weight').value*document.getElementById('cm_rate').value;
}
function amount_rec_cm()
{
document.getElementById('cm_amount_remaining').value=document.getElementById('cm_total_amount').value-document.getElementById('cm_amount_paid').value;
}
//funcation to chnage value
function sssss1() 
		{
		var normal1 = document.getElementById('normal1').value;
		
		if(normal1=="Friday")
		{
			
		    document.getElementById('start_hor').value='08';
			document.getElementById('start_mintes').value='30';
			document.getElementById('start_seconds').value='00';
			document.getElementById('end_hor').value='18';
			document.getElementById('end_mintes').value='00';
			document.getElementById('end_seconds').value='00';
			
		}
		
			if(normal1=="Full Day")
		{
			
		    document.getElementById('start_hor').value='08';
			document.getElementById('start_mintes').value='30';
			document.getElementById('start_seconds').value='00';
			document.getElementById('end_hor').value='18';
			document.getElementById('end_mintes').value='00';
			document.getElementById('end_seconds').value='00';
			
		}
		
	    if(normal1=="Saturday")
		{
			
		    document.getElementById('start_hor').value='08';
			document.getElementById('start_mintes').value='30';
			document.getElementById('start_seconds').value='00';
			document.getElementById('end_hor').value='14';
			document.getElementById('end_mintes').value='00';
			document.getElementById('end_seconds').value='00';
			
		}
		 if(normal1=="Gazetted Holiday/Sunday")
		{
			
		    document.getElementById('start_hor').value='00';
			document.getElementById('start_mintes').value='00';
			document.getElementById('start_seconds').value='00';
			document.getElementById('end_hor').value='00';
			document.getElementById('end_mintes').value='00';
			document.getElementById('end_seconds').value='00';
			
		}
		
		
		
		}

        function sssss() 
		{
			//alert('cvcvcv');
            
    var currentDate = new Date()
	var day = currentDate.getDate()
	var month = currentDate.getMonth() + 1
	var year = currentDate.getFullYear()
            var date = document.getElementById('date').value;
			var today_date=day+"-"+month+"-"+year;
			date = date.split('-');
			today_date = today_date.split('-');
            var fdate = new Date(date[2],date[1],date[0]);
            var tdate = new Date(today_date[2],today_date[1],today_date[0]);

			if(fdate>tdate)
			{
			 alert("Please enter valid date to continue");
			  
			  return false;	
			}
		
		return true;
		}
    //next code
$(document).ready(function() {
$('#datatable-responsive').DataTable( {
responsive: true
} );	
} );
	function selectAll(source) {
		checkboxes = document.getElementsByName('chk[]');
		for(var i in checkboxes)
			checkboxes[i].checked = source.checked;
	}

//next code
$(function(){
  $("#supplier_name").autocomplete({
    source: "<?php echo base_url();?>index.php/manage/get_supplier_name" // path to the get_birds method
  });
});
$(function(){
  $("#employee_name").autocomplete({
    source: "<?php echo base_url();?>index.php/manage/get_employee_name" // path to the get_birds method
  });
});

$(function(){
  $("#prod_name").autocomplete({
    source: "<?php echo base_url();?>index.php/manage/get_prod_name" // path to the get prod_name method
  });
});


$(function(){
  $("#prod_number").autocomplete({
    source: "<?php echo base_url();?>index.php/manage/get_product_number" // path to the get_birds method
  });
});

$(function(){
  $("#prod_name").autocomplete({
    source: "<?php echo base_url();?>index.php/manage/get_product_name" // path to the get_birds method
  });
});
$(function(){
  $("#cutomer_id").autocomplete({
    source: "<?php echo base_url();?>index.php/manage/get_customer_name" // path to the get_birds method
  });
});

/*Hamza code - advertisements*/
//code for advertisemtns form vaildation
function add_advert()
{
	
	if(document.getElementById('name').value == '')
	{
		alert("Enter Advertisement Name");
		document.getElementById('name').focus();
		document.getElementById('name').style.borderColor = '#F00';
		return false;
	}
	else
	{
		document.getElementById('name').style.borderColor = '';
	}
	if(document.getElementById('image').value == '')
	{
		document.getElementById('image').style.borderColor = '#F00';
		alert("Uplaod Advertisement Image");
		document.getElementById('image').focus();
		return false;
	}
	else
	{
		document.getElementById('image').style.borderColor = '';
	}
	var url = document.getElementById('url').value;
	if(!(url.indexOf("http") == 0))
	{
		alert("Enter URL with http://");
		document.getElementById('url').focus();
		document.getElementById('url').style.borderColor = '#F00';
		return false;
	}
	if(document.getElementById('url').value == '')
	{
		alert("Enter URL");
		document.getElementById('url').focus();
		document.getElementById('url').style.borderColor = '#F00';
		return false;
	}
	else
	{
		document.getElementById('url').style.borderColor = '';
	}
	return true;
}
	
//code for logo form vaildation
//code for logo form vaildation
function add_logo()
{
	
	if(document.getElementById('name').value == '')
	{
		alert("Enter Logo Name");
		document.getElementById('name').focus();
		document.getElementById('name').style.borderColor = '#F00';
		return false;
	}
	else
	{
		document.getElementById('name').style.borderColor = '';
	}
	if(document.getElementById('image').value == '')
	{
		document.getElementById('image').style.borderColor = '#F00';
		alert("Uplaod Logo Image");
		document.getElementById('image').focus();
		return false;
	}
	else
	{
		document.getElementById('image').style.borderColor = '';
	}
	return true;
	
}

	function addblogcat()
	{
		//alert('asasa');
		if(document.getElementById('blog_category_title').value == '')
		{
			alert("Enter Category Title");
			document.loginform.blog_category_title.focus();
			document.getElementById('blog_category_title').style.borderColor = '#F00';
			return false;
		}
		else
		{
			document.getElementById('blog_category_title').style.borderColor = '';
		}
		if(document.getElementById('blog_category_details').value == '')
		{
			alert("Enter Category Details");
			document.loginform.blog_category_details.focus();
			document.getElementById('blog_category_details').style.borderColor = '#F00';
			return false;
		}
		else
		{
			document.getElementById('blog_category_details').style.borderColor = '';
		}
		return true;
	}

	
	//validations for new blogpost
	function add_blogpost()
	{
	if(document.getElementById('blog_title').value == '')
	{
		alert("Enter Blog Title Name");
		document.getElementById('blog_title').focus();
		document.getElementById('blog_title').style.borderColor = '#F00';
		return false;
	}
	else
	{
		document.getElementById('blog_title').style.borderColor = '';
	}
	if(document.getElementById('blog_content').value == '')
	{
		document.getElementById('blog_content').style.borderColor = '#F00';
		alert("Add Blog Content");
		document.getElementById('blog_content').focus();
		return false;
	}
	else
	{
		document.getElementById('blog_content').style.borderColor = '';
	}
	return true;
}

