		function winOpenAdj(url, widthb, heightb, toolb, menub, scrollb, resizeb, statusb){
			var h = heightb;
			var w = widthb;
			var t = toolb
			var m = menub
			var sc = scrollb
			var r = resizeb
			var st= statusb

			var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
			var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
			var settings = 'height=' + h + ',width=' + w + ',top=' + (TopPosition-50) + ',left=' + LeftPosition + ',toolbar=' + t + ', menubar=' + m + ', scrollbars=' + sc + ', resizable=' + r + ', status=' + st + ''
			var rtnVal = window.open(url, '', settings)

		}


		function winOpen(url){
			var h = 700;
			var w = 800;
					
			var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
			var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
			var settings = 'height=' + h + ',width=' + w + ',top=' + (TopPosition-50) + ',left=' + LeftPosition + ',toolbar=no, menubar=no, scrollbars=yes, resizable=yes, status=no'
					
			var rtnVal = window.open(url, '', settings)

		}


		function ExecuteURL(url){
			document.frmMain.action = url;
			document.frmMain.submit();
		}
		 


		function GoToURL(url){
			document.location = url;

		}
		 


		// JavaScript Document
		//here you place the idxt of every element you want.
		var idxt=new Array('Pa1','Pa2');
		function switchid(id){	
			hideallidxt();
			showdiv(id);
		}
		function hideallidxt(){
			//loop through the array and hide each element by id
			for (var i=0;i<idxt.length;i++){
				hidediv(idxt[i]);
			}		  
		}
		function hidediv(id) {
			//safe function to hide an element with a specified id
			if (document.getElementById) { // DOM3 = IE5, NS6
				document.getElementById(id).style.display = 'none';
			}
			else {
				if (document.layers) { // Netscape 4
					document.id.display = 'none';
				}
				else { // IE 4
					document.all.id.style.display = 'none';
				}
			}
		}
		function showdiv(id) {
			//safe function to show an element with a specified id
				  
			if (document.getElementById) { // DOM3 = IE5, NS6
				document.getElementById(id).style.display = 'block';
			}
			else {
				if (document.layers) { // Netscape 4
					document.id.display = 'block';
				}
				else { // IE 4
					document.all.id.style.display = 'block';
				}
			}
		}





		//here you place the idxt of every element you want.
		var idxt1=new Array('Pb1','Pb2');
		function switchid1(id){	
			hideallidxt1();
			showdiv1(id);
		}

		function hideallidxt1(){
			//loop through the array and hide each element by id
			for (var i=0;i<idxt1.length;i++){
				hidediv1(idxt1[i]);
			}		  
		}

		function hidediv1(id) {
			//safe function to hide an element with a specified id
			if (document.getElementById) { // DOM3 = IE5, NS6
				document.getElementById(id).style.display = 'none';
			}
			else {
				if (document.layers) { // Netscape 4
					document.id.display = 'none';
				}
				else { // IE 4
					document.all.id.style.display = 'none';
				}
			}
		}

		function showdiv1(id) {
			//safe function to show an element with a specified id
				  
			if (document.getElementById) { // DOM3 = IE5, NS6
				document.getElementById(id).style.display = 'block';
			}
			else {
				if (document.layers) { // Netscape 4
					document.id.display = 'block';
				}
				else { // IE 4
					document.all.id.style.display = 'block';
				}
			}
		}







		//here you place the idxt of every element you want.
		var idxt2=new Array('Pc1','Pc2');
		function switchid2(id){	
			hideallidxt2();
			showdiv2(id);
		}

		function hideallidxt2(){
			//loop through the array and hide each element by id
			for (var i=0;i<idxt2.length;i++){
				hidediv1(idxt1[i]);
			}		  
		}

		function hidediv2(id) {
			//safe function to hide an element with a specified id
			if (document.getElementById) { // DOM3 = IE5, NS6
				document.getElementById(id).style.display = 'none';
			}
			else {
				if (document.layers) { // Netscape 4
					document.id.display = 'none';
				}
				else { // IE 4
					document.all.id.style.display = 'none';
				}
			}
		}

		function showdiv2(id) {
			//safe function to show an element with a specified id
				  
			if (document.getElementById) { // DOM3 = IE5, NS6
				document.getElementById(id).style.display = 'block';
			}
			else {
				if (document.layers) { // Netscape 4
					document.id.display = 'block';
				}
				else { // IE 4
					document.all.id.style.display = 'block';
				}
			}
		}



		//here you place the idxt of every element you want.
		var idxt4=new Array('Pd1','Pd2');
		function switchid4(id){	
			hideallidxt4();
			showdiv4(id);
		}

		function hideallidxt4(){
			//loop through the array and hide each element by id
			for (var i=0;i<idxt4.length;i++){
				hidediv4(idxt4[i]);
			}		  
		}

		function hidediv4(id) {
			//safe function to hide an element with a specified id
			if (document.getElementById) { // DOM3 = IE5, NS6
				document.getElementById(id).style.display = 'none';
			}
			else {
				if (document.layers) { // Netscape 4
					document.id.display = 'none';
				}
				else { // IE 4
					document.all.id.style.display = 'none';
				}
			}
		}

		function showdiv4(id) {
			//safe function to show an element with a specified id
				  
			if (document.getElementById) { // DOM3 = IE5, NS6
				document.getElementById(id).style.display = 'block';
			}
			else {
				if (document.layers) { // Netscape 4
					document.id.display = 'block';
				}
				else { // IE 4
					document.all.id.style.display = 'block';
				}
			}
		}


		function numeralsOnly(thisComp,e,isDecimal) {
			var key;
			var keychar;
			if (window.event) {
			key = window.event.keyCode;
			}
			else if (e) {
			key = e.which;
			}
			else {
			return true;
			}

			// check double period/decimal/point
			if (  ((thisComp.value).indexOf('.') > -1) && key == 46){
			alert('ไม่อนุญาติให้ใส่จุดมากกว่า1ครั้ง.');
			return false;
			}

			var str = ' 0123456789';
			//str +=isDecimal ? '.':";
			keychar = String.fromCharCode(key);
			if ((key==null) || (key==0) || (key==8) ||  (key==9) || (key==13) || (key==27) ) {
			return true;
			}
			else if (((str).indexOf(keychar) > -1)) {
			return true;
			}

			alert('ใส่เฉพาะตัวเลขเท่านั้น.');
			thisComp.focus();
			//thisComp.select();
			return false;
		}


		function numeralsOnly2(thisComp,e,isDecimal) {
			var key;
			var keychar;
			if (window.event) {
			key = window.event.keyCode;
			}
			else if (e) {
			key = e.which;
			}
			else {
			return true;
			}

			// check double period/decimal/point
			if (  ((thisComp.value).indexOf('.') > -1) && key == 46){
			alert('ไม่อนุญาติให้ใส่จุดมากกว่า1ครั้ง.');
			return false;
			}

			var str = ' 0123456789/-';
			//str +=isDecimal ? '.':";
			keychar = String.fromCharCode(key);
			if ((key==null) || (key==0) || (key==8) ||  (key==9) || (key==13) || (key==27) ) {
			return true;
			}
			else if (((str).indexOf(keychar) > -1)) {
			return true;
			}

			alert('ใส่เฉพาะตัวเลขเท่านั้น.');
			thisComp.focus();
			//thisComp.select();
			return false;
		}


		function numeralsDotOnly(thisComp,e,isDecimal) {
			var key;
			var keychar;
			if (window.event) {
			key = window.event.keyCode;
			}
			else if (e) {
			key = e.which;
			}
			else {
			return true;
			}

			// check double period/decimal/point
			if (  ((thisComp.value).indexOf('.') > -1) && key == 46){
			alert('ไม่อนุญาติให้ใส่จุดมากกว่า1ครั้ง.');
			return false;
			}

			var str = ' 0123456789.';
			//str +=isDecimal ? '.':";
			keychar = String.fromCharCode(key);
			if ((key==null) || (key==0) || (key==8) ||  (key==9) || (key==13) || (key==27) ) {
			return true;
			}
			else if (((str).indexOf(keychar) > -1)) {
			return true;
			}

			alert('ใส่เฉพาะตัวเลขเท่านั้น.');
			thisComp.focus();
			//thisComp.select();
			return false;
		}




		function EnglishOnly(thisComp,e,isDecimal) {
			var key;
			var keychar;
			if (window.event) {
			key = window.event.keyCode;
			}
			else if (e) {
			key = e.which;
			}
			else {
			return true;
			}

			// check double period/decimal/point
			//if (  ((thisComp.value).indexOf('.') > -1) && key == 46){
			//alert('ไม่อนุญาติให้ใส่จุดมากกว่า1ครั้ง.');
			//return false;
			//}

			var str = ' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,._/*-+=!@#$%^&*()<>:;\'';
			//str +=isDecimal ? '.':";
			keychar = String.fromCharCode(key);
			if ((key==null) || (key==0) || (key==8) ||  (key==9) || (key==13) || (key==27) ) {
			return true;
			}
			else if (((str).indexOf(keychar) > -1)) {
			return true;
			}

			alert('ใส่เฉพาะภาษาอังกฤษเท่านั้น.');
			thisComp.focus();
			//thisComp.select();
			return false;
		}



		function numeralutm(thisComp,e,isDecimal) {
			var key;
			var keychar;
			if (window.event) {
			key = window.event.keyCode;
			}
			else if (e) {
			key = e.which;
			}
			else {
			return true;
			}

			// check double period/decimal/point
			if (  ((thisComp.value).indexOf('.') > -1) && key == 46){
			alert('ไม่อนุญาติให้ใส่จุดมากกว่า1ครั้ง.');
			return false;
			}

			var str = ' 0123456789,';
			//str +=isDecimal ? '.':";
			keychar = String.fromCharCode(key);
			if ((key==null) || (key==0) || (key==8) ||  (key==9) || (key==13) || (key==27) ) {
			return true;
			}
			else if (((str).indexOf(keychar) > -1)) {
			return true;
			}

			alert('ใส่ได้เฉพาะตัวเลข และ เครื่องหมายคอมมา เท่านั้น.');
			thisComp.focus();
			//thisComp.select();
			return false;
		}



	function fncNavPage(objForm, strNavigate){

		if(isValidPage(objForm, strNavigate))
		{
			objForm.cmdPage.value = strNavigate;
			objForm.submit();
		}
	}		

	//** this function will validate the form for required fields
	function isValidPage(form, strNavigate){
		var strMsg;
		var strMore;
		var objFocus;
		
		strMsg = "";
		strMore = "";
		
		if (strNavigate=="SIZE") {
			if (form.NumRecs.value != "") {
				if (isNaN(form.NumRecs.value)) {
					strMsg = strMsg + "You have entered an invalid page size.\n";
				}
				else if (form.NumRecs.value < 1 || form.NumRecs.value > 200 ) {
					strMsg = strMsg + "Size must be between 1 and 200.\n";
			
				}		
			}
		}
		else {
			if(	! isNaN(form.txtGotoPage.value)) {
		
				if (( parseInt(form.txtGotoPage.value,10) < 1) || (parseInt(form.txtGotoPage.value,10) > parseInt(form.txtPageCount.value,10)) ){
					 objFocus = form.txtGotoPage;
					 strMsg = strMsg + "You have entered an invalid page number.\n";
				}	
				
			}
			else 
			{
				 objFocus = form.txtGotoPage;
				 strMsg = strMsg + "You have entered an invalid page number.\n";
			}
		}
		
			if(strMsg == "")
				return true;
			else{
				strMore = "The following errors occurred while trying to process this page.\n";
				strMore = strMore + "Please fix the following errors and submit the page again.\n\n";

				alert(strMore + strMsg);
				//objFocus.focus();
				return false;
			}
		
	}//end isValid




	function fncNavPageex(objFormex, strNavigateex){

		if(isValidPageex(objFormex, strNavigateex))
		{
			objFormex.cmdPageex.value = strNavigateex;
			objFormex.submit();
		}
	}		

	//** this function will validate the form for required fields
	function isValidPageex(formex, strNavigateex){
		var strMsgex;
		var strMoreex;
		var objFocusex;
		
		strMsgex = "";
		strMoreex = "";
		
		if (strNavigateex=="SIZEEX") {
			if (form.NumRecsex.value != "") {
				if (isNaN(formex.NumRecsex.value)) {
					strMsgex = strMsgex + "You have entered an invalid page size.\n";
				}
				else if (formex.NumRecsex.value < 1 || formex.NumRecsex.value > 200 ) {
					strMsgex = strMsgex + "Size must be between 1 and 200.\n";
			
				}		
			}
		}
		else {
			if(	! isNaN(formex.txtGotoPageex.value)) {
		
				if (( parseInt(formex.txtGotoPageex.value,10) < 1) || (parseInt(formex.txtGotoPageex.value,10) > parseInt(formex.txtPageCountex.value,10)) ){
					 objFocusex = formex.txtGotoPageex;
					 strMsgex = strMsgex + "You have entered an invalid page number.\n";
				}	
				
			}
			else 
			{
				 objFocusex = formex.txtGotoPageex;
				 strMsgex = strMsgex + "You have entered an invalid page number.\n";
			}
		}
		
			if(strMsgex == "")
				return true;
			else{
				strMoreex = "The following errors occurred while trying to process this page.\n";
				strMoreex = strMoreex + "Please fix the following errors and submit the page again.\n\n";

				alert(strMoreex + strMsgex);
				//objFocus.focus();
				return false;
			}
		
	}//end isValid




	function fncNavPage_ey(objForm_ey, strNavigate_ey){

		if(isValidPage_ey(objForm_ey, strNavigate_ey))
		{
			objForm_ey.cmdPage_ey.value = strNavigate_ey;
			objForm_ey.submit();
		}
	}		

	//** this function will validate the form for required fields
	function isValidPage_ey(form_ey, strNavigate_ey){
		var strMsg_ey;
		var strMore_ey;
		var objFocus_ey;
		
		strMsg_ey = "";
		strMore_ey = "";
		
		if (strNavigate_ey=="SIZE_EY") {
			if (form.NumRecs_ey.value != "") {
				if (isNaN(form_ey.NumRecs_ey.value)) {
					strMsg_ey = strMsg_ey + "You have entered an invalid page size.\n";
				}
				else if (form_ey.NumRecs_ey.value < 1 || form_ey.NumRecs_ey.value > 200 ) {
					strMsg_ey = strMsg_ey + "Size must be between 1 and 200.\n";
			
				}		
			}
		}
		else {
			if(	! isNaN(form_ey.txtGotoPage_ey.value)) {
		
				if (( parseInt(form_ey.txtGotoPage_ey.value,10) < 1) || (parseInt(form_ey.txtGotoPage_ey.value,10) > parseInt(form_ey.txtPageCount_ey.value,10)) ){
					 objFocus_ey = form_ey.txtGotoPage_ey;
					 strMsg_ey = strMsg_ey + "You have entered an invalid page number.\n";
				}	
				
			}
			else 
			{
				 objFocus_ey = form_ey.txtGotoPage_ey;
				 strMsg_ey = strMsg_ey + "You have entered an invalid page number.\n";
			}
		}
		
			if(strMsg_ey == "")
				return true;
			else{
				strMore_ey = "The following errors occurred while trying to process this page.\n";
				strMore_ey = strMore_ey + "Please fix the following errors and submit the page again.\n\n";

				alert(strMore_ey + strMsg_ey);
				//objFocus.focus();
				return false;
			}
		
	}//end isValid

