/*
 Author 		: Chairat Panpun
 Date			: 8/11/00
 Description 	: This module generates an alert or confirm window by calling
	a function name along with specify some appropriate arguements.
 Module 		: Controlled-Message Functions
 Supervisor 	: Mark Able 
 Version 		: 1.0  
 Compatability	: IE 4.0+/Netscape 4.0+ 
*/

/* 
 Alert1(intId, strInp) generates a dialog box with a single OK button that 
 displays a message subject to intId together with an input strInp.
*/
function Alert1(intId, strInp) {	
	switch(parseInt(intId)) {
		case 1	: return(alert(strInp + " must not be blank, please re-enter."));
		case 2	: return(alert(strInp + " must be selected."));
		case 3	: return(alert(strInp + " cannot be zero, please try again."));
		case 4	: return(alert(strInp + " already exists, please try again."));
		case 5	: return(alert(strInp + " does not exist, please try again."));
		case 6	: return(alert(strInp + " is already in use, please enter another."));
	  //case 7	: return(alert(strInp + " is invalid, please re-enter."));
		case 7	: return(alert("Invalid " + strInp + ", please re-enter."));
		case 8	: return(alert("Please enter " + strInp + "."));
		case 9	: return(alert("Please select " + strInp + "."));
		case 10	: return(alert(strInp + " can only contain characters A-z and hyphens only, please re-enter."));
		case 11	: return("Please fill in a valid " + strInp + ".\n");
		default	: return(alert("undefined"));
	}		
}

/* 
 Alert2(intId, strInp1, strInp2) generates a dialog box with a single OK button that 
 displays a message subject to intId together with two input strInp.
*/
function Alert2(intId, strInp1, strInp2) {	
	switch(parseInt(intId)) {
		case 1	: return(alert(strInp1 + " is maximum of " + strInp2 + " characters, please re-enter."));
		case 2	: return(alert("You can not delete this " + strInp1 + " until " + strInp2 + " are deleted."));
		case 3	: return(alert(strInp1 + " must be greater than " + strInp2 + ", please correct this."));
		case 4	: return(alert(strInp1 + " must not be less than " + strInp2 + ", please correct this."));
		case 5	: return(alert(strInp1 + " must be equal to " + strInp2 + ", please correct this."));
		case 6	: return(alert(strInp1 + " must be less than " + strInp2 + ", please correct this."));
		case 7	: return(alert(strInp1 + " must not be greater than " + strInp2 + ", please correct this."));
		case 8	: return(alert(strInp1 + " and " + strInp2 + " must be the same, please correct this."));
		
		case 9	: return(alert("Length of " + strInp1 + " must be less than " + strInp2 + "."));
		case 10	: return(alert("Length of " + strInp1 + " must be less than or equal to " + strInp2 + "."));
		case 11	: return(alert("Length of " + strInp1 + " must be greater than " + strInp2 + "."));
		case 12	: return(alert("Length of " + strInp1 + " must be greater than or equal to " + strInp2 + "."));
		default	: return(alert("undefined"));
	}		
}

function Alert3(intId, strInp1, strInp2, strinp3) {	
	switch(parseInt(intId)) {
		case 1	: return(alert("Length of " + strInp1 + " must be between " + strInp2 + " and " + strInp3 + "."));
		
		default	: return(alert("undefined"));
	}		
}

/* 
 Confirm1(intId, strInp) generates a dialog box with two buttons (OK and Cancel) that 
 displays a message subject to intId together with an input strInp.
*/
function Confirm1(intId, strInp) {	
	switch(parseInt(intId)) {
		case 1	: return(confirm("Are you sure you want to delete " + strInp + "?"));
		case 2	: return(confirm("Are you sure you want to accept " + strInp + "?"));
		case 3	: return(confirm("Are you sure you want to reject " + strInp + "?"));
		case 4	: return(confirm("Are you sure you want to email to " + strInp + "?"));
		default	: return(confirm("undefined"));
	}		
}

/*
 Confirm2(intId, strInp1, strInp2) generates a dialog box with two buttons (OK and Cancel) that 
 displays a message subject to intId together with two input strInpings.
*/
function Confirm2(intId, strInp1, strInp2) {	
	switch(parseInt(intId)) {
		case 1	: return(confirm("Are you sure you want to delete " + strInp1 + " " + strInp2 + "?"));
		case 2	: return(confirm("Are you sure you want to accept " + strInp1 + " " + strInp2 + "?"));
		case 3	: return(confirm("Are you sure you want to reject " + strInp1 + " " + strInp2 + "?"));
		case 4	: return(confirm("Are you sure you want to email to " + strInp1 + " " + strInp2 + "?"));
		default	: return(confirm("undefined"));
	}		
}

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 7	: return("Invalid " + strInp + ", 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, and .png.\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 15	: return("Invalid " + strInp + " 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("Please fill in " + strInp + " in correct format.\n");
		case 21	: return("Please fill in a valid " + strInp + ".\n");
		//case 22	: return(strInp + " is invalid date, please re-select.\n");
		case 22	: return("Invalid " + strInp + " date, please re-select.\n");
		case 23	: return(strInp + " must be checked.\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("Please fill in " + strInp1 + " in correct format and must not be longer than " + strInp2 + ".\n");
		//case 10	: return("Please select " + strInp1 + " at least 1 item, but no more than " + strInp2 + " items.\n");
		case 10	: return("Please select " + strInp1 + " no more than " + strInp2 + " items.\n");
		case 11	: return("Please select " + strInp1 + " as " + strInp2 + " has been selected.\n");
		default	: return("undefined");
	}		
}
