//<Script Language=JavaScript>

/********************************************************************************
*						JavaScript : InetMessage.js								*
*				Author : Prapaphan Pan-O, Software developement Department		*
*						  Supervisor : Nat										*
*						   Version : Rev.1										*
*						Created : August 1, 2001								*
*						Rev. Date : August 1, 2001								*
********************************************************************************/
/********************************************************************************
*									Description									*
*	This module generates an alert or confirm window by calling					*
*		a function name along with specify some appropriate arguements.			*
*			Compatability	:	IE 4.0+/Netscape 4.0+							*
*																				*
********************************************************************************/
/********************************************************************************
*									Revision 1									*
*							date: August 1, 2001								*
*																				*
*	- N/A																		*
********************************************************************************/

function isValidate(pattern, str) {
//-----------------------------------------------------------------------------
// Function Name:	isValidate(pattern, str)
//
// Functionality:	Validate the pattern of string
//					and return flase if that input string is not valiad.
//
// Input		:	pattern of message and Prefix of the message
//
// Output		:	String message.
//-----------------------------------------------------------------------------			
	return (pattern.test(str));
}


function alertms1(intId, strInp) {	
//-----------------------------------------------------------------------------
// Function Name:	alertms1(intId, strInp)
//
// Functionality:	Generates a dialog box with a single OK button that
//					displays a message subject to intId together with an input strInp.
//
// Input		:	pattern of message and Prefix of the message
//
// Output		:	true or false (status of validate pattern checking).
//-----------------------------------------------------------------------------
	switch(parseInt(intId)) {
		case 1	: return(strInp + " must not be blank, please re-enter.\n");
		case 2	: return(strInp + " must be selected.\n");
		case 3	: return(strInp + " cannot be zero, please try again.\n");
		case 4	: return(strInp + " already exists, please try again.\n");
		case 5	: return(strInp + " does not exist, please try again.\n");
		case 6	: return(strInp + " is already in use, please enter another.\n");
		case 7	: return(strInp + " is invalid, please re-enter.\n");
		case 8	: return("Please enter " + strInp + ".\n");
		case 9	: return("Please select " + strInp + ".\n");
		case 10	: return(strInp + " can contain characters A-z, space, hyphens and single quote only, please re-enter.\n");
		case 11	: return(strInp + " can contain characters A-z only, please re-enter.\n");
		case 12	: return(strInp + " can contain numeric only, please re-enter.\n");
		case 13 : return(strInp + " allows only file extension .bmp, .jpg, .jpeg, .jpe, .gif, .tif and tiff.\n");		
		case 14	: return(strInp + " must not be blank, please contact administrator.\n");		
		case 15	: return(strInp + " is invalid date, please re-enter.\n");				
		case 16	: return("Please enter a valid " + strInp + ".\n");
		case 17	: return("You must select at least one " + strInp + ".\n");		
		case 18	: return(strInp + " can not be in the past.\n");						
		case 19	: return("You can not delete this " + strInp + ".\n");				
		case 20	: return("You can not have space in " + strInp + ".\n");				
		case 21	: return(strInp + " is invalid email, please re-enter.\n");	
		case 22	: return(strInp + " must be the same, please re-enter.\n");		
		case 23 : return("Picture file is not a " + strInp + ".\n");
		default	: return("undefined");
	}		
}

function alertms2(intId, strInp1, strInp2) {	
//-----------------------------------------------------------------------------
// Function Name:	alertms2(intId, strInp1, strInp2)
//
// Functionality:	Generates a dialog box with a single OK button that 
//					displays a message subject to intId together with two input strInp.
//
// Input		:	pattern of message and Prefix of the message
//
// Output		:	true or false (status of validate pattern checking).
//-----------------------------------------------------------------------------

	switch(parseInt(intId)) {
		case 1	: return(strInp1 + " is maximum of " + strInp2 + " characters, please re-enter.\n");
		case 2	: return("You can not delete this " + strInp1 + " until " + strInp2 + " are deleted.\n");
		case 3	: return(strInp1 + " must be greater than " + strInp2 + ", please correct this.\n");
		case 4	: return(strInp1 + " must not be less than " + strInp2 + ", please correct this.\n");
		case 5	: return(strInp1 + " must be equal to " + strInp2 + ", please correct this.\n");
		case 6	: return(strInp1 + " must be less than " + strInp2 + ", please correct this.\n");
		case 7	: return(strInp1 + " must not be greater than " + strInp2 + ", please correct this.\n");
		case 8	: return(strInp1 + " and " + strInp2 + " must be the same, please correct this.\n");
		
		case 9	: return(strInp1 + " must be less than " + strInp2 + ".");
		case 10	: return(strInp1 + " must be less than or equal to" + strInp2 + ".");
		case 11	: return(strInp1 + " must be greater than " + strInp2 + ".");
		case 12	: return(strInp1 + " must be greater than or equal to " + strInp2 + ".");
		default	: return("undefined");
	}		
}


function alertmsTh1(intId, strInp) {	
//-----------------------------------------------------------------------------
// Function Name:	alertms1(intId, strInp)
//
// Functionality:	Generates a dialog box with a single OK button that
//					displays a message subject to intId together with an input strInp.
//
// Input		:	pattern of message and Prefix of the message
//
// Output		:	true or false (status of validate pattern checking).
//-----------------------------------------------------------------------------
	switch(parseInt(intId)) {
		case 1	: return(strInp + "ไม่สามารถเป็นค่าว่างได้ กรุณาใส่ค่าใหม่\n");
		case 2	: return(strInp + "จะต้องถูกเลือก\n");
		case 3	: return(strInp + "ไม่สามารถเป็นศูนย์ได้ กรุณาใส่ค่าใหม่\n");
		case 4	: return(strInp + "มีค่าอยู่แล้ว กรุณาใส่ค่าใหม่\n");
		case 5	: return(strInp + "ไม่มีค่าอยู่แล้ว กรุณาใส่ค่าใหม่");
		case 6	: return(strInp + "กำลังถูกใช้งานอยู่ กรุณาใส่ค่าอื่น\n");
		case 7	: return(strInp + "ไม่ถูกต้อง กรุณาใส่ค่าใหม่\n");
		case 8	: return("กรุณาใส่ค่าให้กับ" + strInp + "\n");
		case 9	: return("กรุณาเลือก" + strInp + "\n");
		case 10	: return(strInp + "สามารถมีตัวอักขระเป็น A-z, ช่องว่าง, _ และ ' เท่านั้น  กรุณาใส่ค่าใหม่\n");
		case 11	: return(strInp + "สามารถมีตัวอักขระเป็น A-z เท่านั้น  กรุณาใส่ค่าใหม่\n");
		case 12	: return(strInp + "สามารถเป็นค่าตัวเลขได้เท่านั้น กรุณาใส่ค่าใหม่\n");
		case 13 : return(strInp + "อนุญาตให้ชื่อไฟล์มีนามสกุลเป็น .bmp, jpg, jpeg, jpe, gif, tif และ tiff ได้เท่านั้น\n");		
		case 14	: return(strInp + "จะต้องไม่เป็นค่าว่าง กรุณาบอกแอดมินด้วย\n");		
		case 15	: return(strInp + "เป็นค่าวันที่ที่ไม่ถูกต้อง กรุณาใส่ค่าใหม่\n");				
		case 16	: return("กรุณาใส่ค่าที่ถูกต้องให้กับ" + strInp + "\n");
		case 17	: return("กรุณาเลือกอย่างน้อยหนึ่งตัวเลือกใน" + strInp + "\n");					
		case 19	: return("ไม่สามารถลบ" + strInp + "ออกไปได้\n");				
		case 20	: return("ไม่สามารถมีช่องว่างใน" + strInp + "ได้\n");				
		case 21	: return(strInp + "เป็นอีเมล์ที่ไม่ถูกต้องตามรูปแบบ กรุณาใส่ค่าใหม่\n");	
		case 22	: return(strInp + "จะต้องเหมือนกัน กรุณาใส่ค่าใหม่.\n");						
		case 23 : return("ไฟล์รูปภาพนี้ ไม่ใช่ไฟล์"+ strInp + "\n");
		default	: return("หมายเลขของข้อความนี้ไม่มีอยู่");
	}		
}

function alertmsTh2(intId, strInp1, strInp2) {	
//-----------------------------------------------------------------------------
// Function Name:	alertms2(intId, strInp1, strInp2)
//
// Functionality:	Generates a dialog box with a single OK button that 
//					displays a message subject to intId together with two input strInp.
//
// Input		:	pattern of message and Prefix of the message
//
// Output		:	true or false (status of validate pattern checking).
//-----------------------------------------------------------------------------

	switch(parseInt(intId)) {
		case 1	: return(strInp1 + " จะมีตัวอักขระสูงสุดได้เพียง " + strInp2 + " ตัวอักขระ กรุณาใส่ค่าใหม่\n");
		case 2	: return("คุณไม่สามารถลบ" + strInp1 + "ได้ จนกว่า" + strInp2 + "จะถูกลบก่อน\n");
		case 3	: return(strInp1 + "จะต้องมากกว่า " + strInp2 + " กรุณาแก้ไขให้ถูกต้องด้วย\n");
		case 4	: return(strInp1 + "จะต้องไม่น้อยกว่า " + strInp2 + " กรุณาแก้ไขให้ถูกต้องด้วย\n");
		case 5	: return(strInp1 + "จะต้องเท่ากับ " + strInp2 + " กรุณาแก้ไขให้ถูกต้องด้วย\n");
		case 6	: return(strInp1 + "จะต้องน้อยกว่า " + strInp2 + " กรุณาแก้ไขให้ถูกต้องด้วย\n");
		case 7	: return(strInp1 + "จะต้องไม่มากกว่า " + strInp2 + " กรุณาแก้ไขให้ถูกต้องด้วย\n");
		case 8	: return(strInp1 + " และ " + strInp2 + " จะต้องเท่ากัน กรุณาแก้ไขให้ถูกต้องด้วย\n");
		
		case 9	: return(strInp1 + "จะต้องน้อยกว่า " + strInp2);
		case 10	: return(strInp1 + "จะต้องน้อยกว่า หรือเท่ากับ " + strInp2);
		case 11	: return(strInp1 + "จะต้องมากกว่า " + strInp2);
		case 12	: return(strInp1 + "จะต้องมากกว่า หรือเท่ากับ " + strInp2);
		default	: return("หมายเลขของข้อความนี้ไม่มีอยู่");
	}		
}

//</Script>