javascript:window.history.forward(1);
//window.onload = attachFormHandlers;
var xmlHttp
var modTitle
var request;
var queryString;   //will hold the POSTed data
var url;
var frm;
var gShow; //variable holding the id where feedback will be sent to.
var sUrl = "FormValidation.php?validationtype=ajax&val=";//url is the page which will be processing all of the information.  it is important to make sure validationtype is ajax
var gErrors = 0; //number of errors is set to none to begin with
var sDiv;
//function pop(D,C,B,E,A)
//{
//var G,F;G=screen.availHeight/2-E/2;
//F=screen.availWidth/2-B/2;

//}
//window.open("http://localhost/ax/index.php","","width=auto,height=auto,top=auto,left=auto,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no,width")


function welcome() {
	$('#layer1').hide();
}

function showBody(moduleTitle)
{ 

var modTitle = moduleTitle
var url="includes/body.php?modName=" + moduleTitle
xmlHttp=GetXmlHttpObject(stateChanged)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)

} 

function showModule(url)
{ 
//var url="includes/body.php?modName=" + moduleTitle
sDiv = "moduleContent"
xmlHttp=GetXmlHttpObject(saveData)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
} 

function showReport(str,url2,i)
{ 
var url= url2 + "?sid=" + Math.random() + "&" + i + "=" + str
//document.getElementById('hidreport').value = str
xmlHttp=GetXmlHttpObject(stateChanged2)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function showReport2(str,url2,i,oth)
{ 
var url= url2 + "?sid=" + Math.random() + "&" + i + "=" + str + "&" + oth
//document.getElementById('hidreport').value = str
xmlHttp=GetXmlHttpObject(stateChanged2)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}  

function stateChanged2() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
	} 
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("body").innerHTML=xmlHttp.responseText
		//document.getElementById("moduleTitle").innerHTML=modTitle
	} 
} 

function sendData(url,myForm){
	//sDiv = "moduleContent"
	frm = myForm
	//val_account_form(frm)
	xmlHttp=GetXmlHttpObject(saveData)
    setQueryString();
    xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(queryString); 
}

function saveData() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("body").innerHTML=xmlHttp.responseText;
	} 
} 
function saveReport() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("report").innerHTML=xmlHttp.responseText;
	} 
} 

function saveReceivedPO() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("receivedpo").innerHTML=xmlHttp.responseText;
	} 
} 
function sendReceivedPO(url,myForm){
	//sDiv = "moduleContent"
	frm = myForm
	//val_account_form(frm)
	xmlHttp=GetXmlHttpObject(saveReceivedPO)
    setQueryString();
    xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(queryString); 
}

function sendX(url,myForm,str)
{
	//sDiv = "moduleContent"
	//if confirm i execute ang ajax...
	if(confirm(str))
	{
	frm = myForm
	xmlHttp=GetXmlHttpObject(saveData)
    setQueryString();
    xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(queryString); 
	}
	
}
function sendJE(url,myForm){
	frm = myForm
	if(val_journalentry_form(frm))
	{//sDiv = "moduleContent"
	frm = myForm
	//val_account_form(frm)
	//return confirm('do you really want to add this journal entry?');
	xmlHttp=GetXmlHttpObject(saveData)
    setQueryString();
    xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(queryString); 
}
}

function saveJE() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("body").innerHTML=xmlHttp.responseText;
	} 
} 
function sendData2(url,myForm){
	//sDiv = "moduleContent"
	
	frm = myForm
	val_account_form(frm) //function account form validator
	xmlHttp=GetXmlHttpObject(saveData2)
    setQueryString();
    xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(queryString); 
}

function saveData2() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("body").innerHTML=xmlHttp.responseText;
	} 
}


function sendPOdetails(url,myForm,str)
{
	//sDiv = "moduleContent"
	//if confirm i execute ang ajax...
	if(confirm(str))
	{
	frm = myForm
	xmlHttp=GetXmlHttpObject(savePOdetails)
    setQueryString();
    xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(queryString); 
	}
	
}

function savePOdetails() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("podetails").innerHTML=xmlHttp.responseText;
	} 
} 
function sendView(url,myForm){
	//sDiv = "moduleContent"
	frm = myForm
	xmlHttp=GetXmlHttpObject(saveView)
    setQueryString();
    xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(queryString); 
}

function saveView() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("view").innerHTML=xmlHttp.responseText;
	} 
} 


function searchProd(url,myForm){
	//sDiv = "moduleContent"
	frm = myForm
	xmlHttp=GetXmlHttpObject(saveProd)
    setQueryString();
    xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(queryString); 
}

function saveProd() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("search_product").innerHTML=xmlHttp.responseText;
	} 
} 




function sendEdit(url,myForm){
	//sDiv = "moduleContent"
	frm = myForm
	xmlHttp=GetXmlHttpObject(saveEdit)
    setQueryString();
    xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(queryString); 
}

function saveEdit() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("subedit").innerHTML=xmlHttp.responseText;
	} 
} 
function sendMsg(url,myForm){
	//sDiv = "moduleContent"
	frm = myForm
	xmlHttp=GetXmlHttpObject(saveMsg)
    setQueryString();
    xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(queryString); 
}








function saveMsg() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("msgarea").innerHTML=xmlHttp.responseText;
	} 
} 

function setQueryString(){
    queryString="";
    //var frm = document.forms[0];
	//alert(frm);
    var numberElements =  frm.elements.length;
	//alert(numberElements)
    for(var i = 0; i < numberElements; i++) {
        if(i < numberElements-1) {
            queryString += frm.elements[i].name+"="+
                           encodeURIComponent(frm.elements[i].value)+"&";
        } 
		else {
            queryString += frm.elements[i].name+"="+
                           encodeURIComponent(frm.elements[i].value);
		}
    }
}


function moveRec(start,path)
{ 
	var url
	url= path + "&adodb_next_page=" + start 
	xmlHttp=GetXmlHttpObject(saveData)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
function moveRecReport(start,path)
{ 
	var url
	url= path + "&adodb_next_page=" + start 
	xmlHttp=GetXmlHttpObject(saveReport)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function GetXmlHttpObject(handler)
{ 
var objXmlHttp=null

if (navigator.userAgent.indexOf("Opera")>=0)
{
alert("This example doesn't work in Opera") 
return 
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{ 
var strName="Msxml2.XMLHTTP"
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP"
} 
try
{ 
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler 
return objXmlHttp
} 
catch(e)
{ 
alert("Error. Scripting for ActiveX might be disabled") 
return 
} 
} 
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler 
return objXmlHttp
}
} 
function toggle(sDivId) {
var oDiv = document.getElementById(sDivId);
oDiv.style.display = (oDiv.style.display == "none") ? "block" :
"none";
}
var phone = "()- 0123456789";
var numb = "0123456789";
var alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
function valField(t,v){
	var w = "";
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 37 || keyCode == 38 || keyCode == 39 || keyCode == 40) {
	return true;
	}
	for (i=0; i < t.value.length; i++) {
	x = t.value.charAt(i);
	if (v.indexOf(x,0) != -1)
	w += x;
	}
	t.value = w;
} 

/*validateMe is the function called with onblur each time the user leaves the input box
passed into it is the value entered, the rules (which you could create your own), and the id of the area the results will show in*/
function validateMe(objInput) {
	sVal = objInput.value; //get value inside of input field
	
	sRules = objInput.className.split(' '); // get all the rules from the input box classname
	sRequired = sRules[1]; // determines if field is required or not
	sTypeCheck = sRules[2]; //typecheck are additional validation rules (ie. email, phone, date)
    gShow = sRules[3]; //gShow is the td id where feedback is sent to.
  
	//sends the rules and value to the php page to be validated
	xmlHttp=GetXmlHttpObject(showErrMsg)
	xmlHttp.open("GET", sUrl + (sVal) + "&sRequired=" + (sRequired) + "&sTypeCheck=" + sTypeCheck, true);
	xmlHttp.send(null)
}

function validateMe2(objInput,url) {
	var url1 = url
	sVal = objInput.value; //get value inside of input field
	sRules = objInput.className.split(' '); // get all the rules from the input box classname
	sRequired = sRules[1]; // determines if field is required or not
	sTypeCheck = sRules[2]; //typecheck are additional validation rules (ie. email, phone, date)
    gShow = sRules[3]; //gShow is the td id where feedback is sent to.
  
	//sends the rules and value to the php page to be validated
	xmlHttp=GetXmlHttpObject(showErrMsg)
	xmlHttp.open("GET", url1 + 'lib/FormValidation.php?validationtype=ajax&val=' + (sVal) + "&sRequired=" + (sRequired) + "&sTypeCheck=" + sTypeCheck, true);
	xmlHttp.send(null)
}
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
/*
var message="Ooops Right Click is Disabled!\n please contact achilles085@yahoo.com";

///////////////////////////////////
function clickIE4()
{
	if (event.button==2)
	{
alert(message);
return false;
}
}

function clickNS4(e)
{
  if (document.layers||document.getElementById&&!document.all)
  {
    if (e.which==2||e.which==3){
    alert(message);
    return false;
    }
  }
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")

*/
function validateImage(field) 
{
	var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz0123456789._?/:"
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) {
	temp = "" + field.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
	alert("Invalid input! Only Alphanumeric are accepted!");
	//field.value="Only Alphanumeric are accepted!";
	field.focus();
	field.value="";
	field.select();
	return false
    }
}
function validateAlphaNumericSpace(field) 
{
	var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz0123456789._-?!"
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) {
	temp = "" + field.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
	alert("Invalid input! Only Alphanumeric are accepted!");
	field.value="Only Alphanumeric are accepted!";
	field.focus();
	//field.value=" Only Alphanumeric are accepted!";
	field.value="";
	field.select();
	return false
    }
}
function validateAlpha(field) 
{
	var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-. "
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) {
	temp = "" + field.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
	alert("Invalid input!  Only characters are accepted!");
	field.value="";
	field.focus();
	//field.value=" Only characters are accepted!";
	field.select();
	return false
    }
}
function validateNumeric(field) 
{
	var valid = "0123456789.-"
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) 
	{
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
	alert("Invalid input!  Only Numbers are accepted!");
	field.value="0";
	field.focus();
	field.select();
	return false
    }
}
function validateNumber(field) 
{
	var valid = "0123456789"
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) {
	temp = "" + field.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
	alert("Invalid input!  Only Numbers are accepted!");
	field.value="";
	field.focus();
	//field.value='Please enter a number';
	field.select();
	return false
    }
}
function validateAmount(field) 
{
	var valid = "0123456789'+.+'"
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) {
	temp = "" + field.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
	alert("Invalid entry!  Only numbers and period/point are accepted!");
	field.focus();
	field.value='';
	field.select();
	/*document.getElementById(field).value='error!';*/
	return false
    }
}


function val_journalentry_form(form) {
	//if(confirm('is this all correct?'))
	//{
		if (form.date.value == "")
		{
			alert("Please enter date.")
			form.date.focus()
			//field.date.select()
			return false
		}
		if (form.dr.value == "")
		{
			alert("Please enter debit account.")
			form.dr.focus()
			form.dr.select()
			return false
		}
		if (form.dr.value == form.cr.value)
		{
			alert("pls select another account.")
			form.dr.focus()
			form.dr.select()
			return false
		}
		if (form.cr.value.length == 0)
		{
			alert("Please enter credit account.")
			form.cr.focus()
			form.cr.select()
			return false
		}
		if (form.amt.value.length == 0 && validateNumeric(amt)) 
		{
			alert("Please enter amount.")
			form.amt.focus()
			form.amt.select()
			return false
		}
		if (form.explanation.value.length == 0)
		{
			alert("Please enter explanation.")
			form.explanation.focus()
			form.explanation.select()
			form.explanation.value='no explanation';
			return false
		}
		else
		{	return true;
		}
	//}
	
	
} 
function val_account_form(form) {
    if (form.code.value.length == 0)
    {
        alert("Please enter account code.")
        form.code.focus()
		form.code.select()
        return false
    }

    if (form.title.value.length == 0)
    {
        alert("Please enter account title.")
        form.title.focus()
		form.title.select()
        return false
    }

    if (form.nbal.value.length == 0)
    {
        alert("Please enter the natural balance of the account.")
        form.nbal.focus()
		 form.nbal.select()
        return false
    }
	if (form.nature.value.length == 0)
    {
        alert("Please enter account nature.")
        form.nature.focus()
		 form.nature.select()
        return false
    }
	if (form.category.value.length == 0)
    {
        alert("Please enter account category.")
        form.category.focus()
		 form.nature.select()
        return false
    }
} 
function val_po_form(form) {
    if (form.to.value.length == 0)
    {
        alert("Please fill-in this field.")
        form.to.focus()
        return false
    }

    if (form.bill_to.value.length == 0)
    {
        alert("Please fill-in this field.")
        form.bill_to.focus()
        return false
    }

    if (form.contact.value.length == 0)
    {
        alert("Please fill-in this field.")
        form.contact.focus()
        return false
    }
	if (form.po_num.value.length == 0)
    {
        alert("Please enter the purchase order number.")
        form.po_num.focus()
        return false
    }
	if (form.po_date.value.length == 0)
    {
        alert("Please enter the purchase order date.")
        form.po_date.focus()
        return false
    }
	if (form.shipvia.value.length == 0)
    {
        alert("Please fill-in this field.")
        form.shipvia.focus()
        return false
    }if (form.date_ordered.value.length == 0)
    {
        alert("Please enter the date the product(s) is(are) being ordered.")
        form.date_ordered.focus()
        return false
    }
	if (form.amt_dpstd.value.length == 0)
    {
        alert("Please enter the amount being deposited.")
        form.amount_dpstd.focus()
        return false
    }
	if (form.freight_charge.value.length == 0)
    {
        alert("Please enter the amount of freight charge.")
        form.freight_charge.focus()
        return false
    }
	if (form.total_due.value.length == 0)
    {
        alert("Please enter the total of the amount due.")
        form.total_due.focus()
        return false
    }
	if (form.order_by.value.length == 0)
    {
        alert("Please enter the name who ordered the products.")
        form.order_by.focus()
        return false
    }
	if (form.remarks.value.length == 0)
    {
        alert("Please enter the remarks of PO.")
        form.remarks.focus()
        return false
    }
	if (form.special_instructions.value.length == 0)
    {
        alert("Please enter any special instructions for PO.")
        form.special_instructions.focus()
        return false
    }
}
function val_job_order_form(form) {
    if (form.or_no.value.length == 0)
    {
        alert("Please enter the job order no.")
        form.or_no.focus()
        return false
    }

    if (form.date.value.length == 0)
    {
        alert("Please enter the date.")
        form.date.focus()
        return false
    }

    if (form.customername.value.length == 0)
    {
        alert("Please enter the name of customer.")
        form.customername.focus()
        return false
    }
	if (form.customeradd.value.length == 0)
    {
        alert("Please enter the customer address.")
        form.customeradd.focus()
        return false
    }
	if (form.customertel.value.length == 0)
    {
        alert("Please enter the customer's telephone number.")
        form.customertel.focus()
        return false
    }
	if (form.sum_total.value.length == 0)
    {
        alert("Please enter the total amount.")
        form.customertel.focus()
        return false
    }
	if (form.prepared_by.value.length == 0)
    {
        alert("Please fill-in this field.")
        form.customertel.focus()
        return false
    }
	if (form.order_by.value.length == 0)
    {
        alert("Please fill-in this field.")
        form.order_by.focus()
        return false
    }
} 
function val_customer_form(form) {
    if (form.lname.value.length == 0)
    {
        alert("Please enter customer name.")
        form.lname.focus()
        return false
    }

    if (form.fname.value.length == 0)
    {
        alert("Please enter customer first name.")
        form.fname.focus()
        return false
    }

    if (form.mname.value.length == 0)
    {
        alert("Please enter the natural balance of the account.")
        form.mname.focus()
        return false
    }
	if (form.addr.value.length == 0)
    {
        alert("Please enter customer address.")
        form.addr.focus()
        return false
    }
	if (form.phone.value.length == 0)
    {
        alert("Please enter customer's phone number.")
        form.phone.focus()
        return false
    }
	if (form.email.value.length == 0)
    {
        alert("Please enter customer's email address.")
        form.email.focus()
        return false
    }
} 
function val_sales_invoice_form(form) {
    if (form.frm.value.length == 0)
    {
        alert("Please fill-in this field.")
        form.frm.focus()
        return false
    }
	if (form.or_no.value.length == 0)
    {
        alert("Please enter the job order no.")
        form.or_no.focus()
        return false
    }

    if (form.date.value.length == 0)
    {
        alert("Please enter the date.")
        form.date.focus()
        return false
    }

    if (form.customername.value.length == 0)
    {
        alert("Please enter the name of customer.")
        form.customername.focus()
        return false
    }
	if (form.customeradd.value.length == 0)
    {
        alert("Please enter the customer address.")
        form.customeradd.focus()
        return false
    }
	if (form.customertel.value.length == 0)
    {
        alert("Please enter the customer's telephone number.")
        form.customertel.focus()
        return false
    }
	if (form.sum_total.value.length == 0)
    {
        alert("Please enter the total amount.")
        form.customertel.focus()
        return false
    }
	if (form.prepared_by.value.length == 0)
    {
        alert("Please fill-in this field.")
        form.customertel.focus()
        return false
    }
	if (form.order_by.value.length == 0)
    {
        alert("Please fill-in this field.")
        form.order_by.focus()
        return false
    }
} 
function val_product_form(form) {
    if (form.frm.value.length == 0)
    {
        alert("Please fill-in this field.")
        form.frm.focus()
        return false
    }
	if (form.prod_code.value.length == 0)
    {
        alert("Please enter the product code.")
        form.prod_code.focus()
        return false
    }

    if (form.prod_model.value.length == 0)
    {
        alert("Please enter the product model.")
        form.prod_model.focus()
        return false
    }

    if (form.prod_desc.value.length == 0)
    {
        alert("Please enter the product description.")
        form.prod_desc.focus()
        return false
    }
	if (form.DATE.value.length == 0)
    {
        alert("Please enter the date.")
        form.DATE.focus()
        return false
    }
	if (form.onhand.value.length == 0)
    {
        alert("Please enter the product on hand.")
        form.onhand.focus()
        return false
    }
	if (form.prod_min_qty.value.length == 0)
    {
        alert("Please enter the product minimum quantity.")
        form.prod_min_qty.focus()
        return false
    }
	if (form.prod_price.value.length == 0)
    {
        alert("Please enter the product price.")
        form.prod_price.focus()
        return false
    }
	if (form.imagefile.value.length == 0)
    {
        alert("Please fill-in this field.")
        form.imagefile.focus()
        return false
    }
}
function val_or_form(form) {
    if (form.or_no.value.length == 0)
    {
        alert("Please enter the official receipt no.")
        form.or_no.focus()
        return false
    }

    if (form.date.value.length == 0)
    {
        alert("Please enter the date.")
        form.date.focus()
        return false
    }

	if (form.customeradd.value.length == 0)
    {
        alert("Please enter the customer address.")
        form.customeradd.focus()
        return false
    }
	
	if (form.customertel.value.length == 0)
    {
        alert("Please enter the customer's telephone number.")
        form.customertel.focus()
        return false
    }
	
	if (form.qty.value.length == 0)
    {
        alert("Please enter the quantity.")
        form.qty.focus()
        return false
    }
	
	if (form.prodcode.value.length == 0)
    {
        alert("Please enter the product code.")
        form.qty.prodcode()
        return false
    }

	if (form.sub_total.value.length == 0)
    {
        alert("Please enter the sub-total amount not added by tax.")
        form.sub_total.focus()
        return false
    }
	
	if (form.sum_total.value.length == 0)
    {
        alert("Please enter the sum total(tax included).")
        form.sum_total.focus()
        return false
    }
	
	if (form.prepared_by.value.length == "")
    {
        alert("Please fill-in this field.")
        form.customertel.focus()
        return false
    }
	if (form.order_by.value.length == "")
    {
        alert("Please fill-in this field.")
        form.order_by.focus()
        return false
    }
} 
//function to validate email address
var
emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
function checkmail(e){
var returnval=emailfilter.test(e.value)
if (returnval==false){
alert("Please enter a valid email address.")
e.select()
}
return returnval
}

function ableButton() {
	//check kato ning pa activate
	check = document.getElementById("licenseOK");
	//ang element na i pa activate
	button = document.getElementById("submit");
	
	if(check.checked==true) 
	{
		button.disabled = false;	
	} 
	else {
		button.disabled = true;	
	}
	
}
/*
var x=window.screen.width;
var y=window.screen.height;
if(x!='1024' && y!='768')
{
	alert("oops this page is best view in 1024 x 768  screen resolution");	

}

// output user screen size
//document.write(window.screen.width + ' x ' + window.screen.height); 

*/