

//document.oncontextmenu = cancelRightClick
//document.onkeydown = intercept;disableF5


function isValid( p_formID, p_string, p_isAlert, p_arraParam )
{
	/* Return boolean    -----------------------------------------------
	* Standard Attributes: type, id, isManda, caption, min, max, regxAllow, regxNotAllow
	* Allowed types:  text, username, password, zip5, zip4, email, phone, memword
	* p_string = "type=zip5,id=zip5,isManda=yy,caption=Zip, regxAllow=[^\d$?\D+]#" 
	*			+ "type=zip4,id=zip4, isManda=nn,caption=Zip#" 
	*			+ "type=username,id=username,caption=Username,isManda=yy,min=6,max=14#"
	*			+ "type=text, id=firstname,caption=First Name,isManda=yy,max=50#"
	*			+ "type=email, id=email,caption=email, isManda=yy#"
	*			+ "type=phone, id=phone,caption=phone, isManda=yy#"
	* -- If you want fixed length pass the same value to 'min' and 'max' 		
	* -- p_arraParam.mesgIn, mesgOut
	*/			
	// -----------------------------------------------  
	var strInput = new String(), strOneField = new String(), arraParam = new Array();
	var strValue = new String(), arraInput = new Array(), arraHash = new Array(), x, strMesg, flag;
	var regul2 = new RegExp(), regul3 = new RegExp(), mat2, mat3, matAllow, matNotAllow;
	strInput = jTrimChar(p_string, "#", "all")
	arraInput = strInput.split("#")
	arraParam = p_arraParam
	flag = ""
	strMesg = ""
	matAllow = null;
	matNotAllow = null;
	for ( x in arraInput )
	{
		strOneField = arraInput[x]
		arraHash.type = getAttribValue(strOneField, "type")
		arraHash.id = getAttribValue(strOneField, "id")
		arraHash.isManda = getAttribValue(strOneField, "isManda")
		arraHash.min = getAttribValue(strOneField, "min")
		arraHash.max = getAttribValue(strOneField, "max")
		arraHash.caption = getAttribValue(strOneField, "caption")
		arraHash.regxAllow = getAttribValue(strOneField, "regxAllow")
		arraHash.regxNotAllow = getAttribValue(strOneField, "regxNotAllow")
		strValue = jTrim(eval("document.forms['" + p_formID + "']." + arraHash.id + ".value"))
		
		if ( arraHash.isManda == "" )
		{	arraHash.isManda = "nn"	}
		
		if ( arraHash.regxAllow != "" )
		{	matAllow = strValue.match(arraHash.regxAllow)		}
		if ( arraHash.regxNotAllow != "" )
		{	matNotAllow = strValue.match(arraHash.regxNotAllow)	}
		
		if ( arraHash.isManda == "yy" && strValue == "" )
		{
			strMesg += "\n" + arraHash.caption
			flag = "bad"
			continue;
		}
		
		else if ( arraHash.isManda == "yy" || (arraHash.isManda == "nn" && strValue != "" ) )
		{
			if ( arraHash.regxAllow != "" && matAllow == null )
			{
				strMesg += "\nThe " + arraHash.caption + " has invalid characters."
				flag = "bad"
				continue;
			}
			if ( arraHash.regxNotAllow != "" && matNotAllow != null )
			{
				strMesg += "\nThe " + arraHash.caption + " has invalid characters: " + matNotAllow
				flag = "bad"
				continue;
			}
			if ( arraHash.min != "" && arraHash.max != "" && arraHash.min == arraHash.max 
							&& strValue.length != arraHash.min )
			{
				strMesg += "\nThe " + arraHash.caption + " must be " + arraHash.min + " characters length."
				flag = "bad"
				continue;
			}
			else if ( arraHash.min != "" && arraHash.max != "" && arraHash.min != arraHash.max
						&& ( strValue.length < arraHash.min	|| strValue.length > arraHash.max ) )
			{
				strMesg += "\nThe " + arraHash.caption + " must be between "
							+ arraHash.min + " and " + arraHash.max + " characters."
				flag = "bad"
				continue;
			}
			// -----------------------------------------------------------
			if ( arraHash.type == "text" )
			{
				// do nothing so far		
			}			
			else if ( arraHash.type == "username" || arraHash.type == "password" )
			{
				if ( arraHash.regxNotAllow == "" )
				{	
					regul2 = new RegExp("[^a-zA-Z0-9_]{1}")  
					mat2 = strValue.match(regul2);
					if ( mat2 != null )
					{
						strMesg += "\nThe " + arraHash.caption + " is invalid: " + mat2
						flag = "bad"
					}				
				}
			}							
			else if ( arraHash.type == "zip5" )
			{	
				regul2 = /^\d{5}$/;
				mat2 = strValue.match(regul2);				
				if ( mat2 == null || strValue == "00000" )
				{
					strMesg += "\nFirst part of zip must be 5 digits"
					flag = "bad"
				}				
			}			
			else if ( arraHash.type == "zip4" )
			{
				regul2 = /^\d{4}$/;
				mat2 = strValue.match(regul2);				
				if ( mat2 == null || strValue == "0000"   )
				{
					strMesg += "\nThe second part of zip must be 4 digits, or leave it empty"
					flag = "bad"
				}				
			}			
			else if ( arraHash.type == "email" )
			{
				//regul2 = /^[a-zA-Z0-9-_]+\.?[a-zA-Z0-9-_]+@{1}[a-zA-Z0-9-_]+\.?[a-zA-Z0-9-_]+\.?[a-zA-Z0-9-_]+$/
				//regul2 = "^([a-zA-Z0-9_]+.[a-zA-Z0-9_]+)+@{1}([a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+)+.[a-zA-Z]+$"
				//var beforeAt, afterAt, last
				//beforeAt = "([a-zA-Z_-]+\.?[a-zA-Z_-]+)+"
				//afterAt = "([a-zA-Z_-]+\.?[a-zA-Z_-]+)+"
				//last = "[a-zA-Z]+"
				regul2 = /^([a-zA-Z0-9_-]+\.?[a-zA-Z0-9_-]+)+@([a-zA-Z0-9_-]+\.?[a-zA-Z0-9_-]+)+[a-zA-Z]+$/
				mat2 = strValue.match(regul2);				
				if ( mat2 == null )
				{
					strMesg += "\nThe " + arraHash.caption + " is invalid."
					flag = "bad"
				}				
			}
			else if ( arraHash.type == "phone" )
			{
				// find any one char which is not digit, and not parathesis, not hyphen, not dot, 
				regul2 = new RegExp("[^0-9(). -]{1}")
				mat2 = strValue.match(regul2);
				if ( mat2 != null )
				{
					strMesg += "\nThe " + arraHash.caption + " has an invalid character: '" + mat2 + "'."
					flag = "bad"
				}				
				//regul3 Matthias = /^[^0-9]*(([0-9][^0-9]*){10,11}|([0-9][^0-9]*){13})[^0-9]*$/
				regul3 = /^\D*((\d\D*){10,11}|(\d\D*){13})\D*$/
				mat3 = strValue.match(regul3);				
				if ( mat3 == null ) 
				{
					strMesg += "\nThe " + arraHash.caption + " must contain either 10, 11 or 13 digits."
					flag = "bad"
				}				
			}
			else if ( arraHash.type == "anyPhone" )
			{
				// find any one char which is not digit, and not parathesis, not hyphen, not dot, 
				regul2 = new RegExp("[^0-9(). -]{1}")
				mat2 = strValue.match(regul2);
				if ( mat2 != null )
				{
					strMesg += "\nThe " + arraHash.caption + " has an invalid character: '" + mat2 + "'."
					flag = "bad"
				}				
			}			
			else if ( arraHash.type == "memword" )
			{
				// nothing now
			}
		}
	}
	// ------------------------------------------------------	
	if ( typeof(arraParam) == "undefined"){	
		arraParam = new Array();
		arraParam.mesgIn = ""
		arraParam.mesgOut = ""			
	}
	else 
	{
		if ( typeof(arraParam.mesgIn) == "undefined" )	{	
			arraParam.mesgIn = ""
		}
		if ( typeof(arraParam.mesgOut) == "undefined" )	{	
			arraParam.mesgOut = ""
		}
	}
	// ===================================================================	
	//  now new code
	var strFinalMesg = new String();
	strFinalMesg = ""
	if ( arraParam.mesgIn != "" ){
		strFinalMesg += arraParam.mesgIn	
		flag = "bad"
	}
	// ----------------------------------------------------
	if ( strMesg != "" )
	{	
		strFinalMesg += strMesg	
	}
	// ----------------------------------------------------
	if ( flag == "bad" ){	
		if ( p_isAlert == "yy" ){
			alert("Please check the following fields: \n" + strFinalMesg)			
		}
		else {
			arraParam.mesgOut = strFinalMesg
		}
		return false
	}
	else {
		return true
	}
	
}
// ##########################################################################################

function jTrimChar(p_bigString, p_char, p_oneOrAll)
{
	// oneOrAll must be:  "one", "all"
	var x
	var bigString = new String()
	bigString = jTrim(p_bigString)
	//alert("argStr was: '" + argStr + "'" )	
	if ( bigString.length > 0 )
	{
		for (x=0; x<bigString.length; i++)
		{
			if ( bigString.charAt(x) == p_char )
			{
				bigString = bigString.substr(1)
				x--
			}
			else
			{	break;		}			
		}
		for ( x = bigString.length-1; x>0; x--)
		{
			if ( bigString.charAt(x) == p_char )
			{
				bigString = bigString.substr(0, x)				
			}
			else
			{	break;	}
		}
	}
	//alert("trim argStr: '" + argStr + "'" )	
	return bigString
}

// ##########################################################################################
function getAttribValue(p_oneField, p_attrib)
{
	var indexOfAttrib, indexOfComma, attribLen, strTheValue = new String();
	p_oneField = jTrimChar(p_oneField, ",", "all") + ","
	indexOfAttrib = p_oneField.indexOf(p_attrib + "=")
	if ( indexOfAttrib == -1 )
	{	
		//alert ( "getAttribValue, indexOfAttrib: " + indexOfAttrib )
		return ""	
	}	
	indexOfComma = p_oneField.indexOf(",", indexOfAttrib)
	attribLen = p_attrib.length
	strTheValue = p_oneField.substr(indexOfAttrib + attribLen + 1, (indexOfComma-indexOfAttrib) - attribLen - 1 )
	/*	alert("getAttribValue, p_oneField: " + p_oneField 
				+ "\n p_attrib: " + p_attrib
				+ "\n indexOfAttrib: " + indexOfAttrib
				+ "\n indexOfComma: " + indexOfComma
				+ "\n attribLen: " + attribLen
				+ "\n strTheValue: " + strTheValue				)	*/
	return strTheValue;
}

// ##########################################################################################

function emailValid(emailValue)
{
	//This function is validation for any email, 
		//just pass the email object
	var PosAtSign = emailValue.indexOf('@');
	var PosPeriod = emailValue.lastIndexOf('.');
	var PosSpace = emailValue.indexOf(' ');
	var theLength = emailValue.length - 1;   // Array is from 0 to length-1
	// '@' cannot be in first position
	if ( PosAtSign < 1               
			|| PosPeriod <= PosAtSign+1   // Must be atleast one valid char btwn '@' and '.'
			|| PosPeriod == theLength   // Must be atleast one valid char after '.'
			//(Space  != -1)  ||     // No empty spaces permitted
			//(form.elements[8].value != form.elements[9].value))                  
			|| PosSpace  != -1   )
	{
		return false
	}
	else 
	{
		return true
	}
}
// ########################################################################################

function phoneValid(arg)
{
	var x, regul, flag, strAccepted = "1234567890-() "
	flag = "good"
	for ( x=0;	x<arg.length; x++ )
	{
		regul = arg.substr(x, 1).toLowerCase()		
		if ( strAccepted.indexOf(regul) == -1 )
		{
			flag = "bad"
			break;
		}
	}
	if ( flag == "bad" )
	{	return false;	}
	else
	{	return true;	}
}
// ########################################################################################
function jTrim(argStr)
{
	var i
	if ( argStr.length > 0 )
	{
		for (i=0; i<argStr.length; i++)
		{
			if ( argStr.charAt(i) == " " )
			{
				argStr = argStr.substr(1)
				i--
			}
			else
			{	break;		}			
		}
		for ( i=argStr.length-1; i>0; i--)
		{
			if ( argStr.charAt(i) == " " )
			{
				argStr = argStr.substr(0, i)				
			}
			else
			{	break;	}
		}
	}
	//alert("trim argStr: '" + argStr + "'" )	
	return argStr
}
// ########################################################################################
function isPosInt(argNum)
{
	var i, allowed, regul, flag
	flag = ""	
	allowed = "0123456789"
	argNum = jTrim(argNum)
	for(i=0; i<argNum.length; i++)
	{
		regul = argNum.substr(i, 1)
		if ( allowed.search(regul) == -1 )
		{
			flag = "bad"
			break;
		}		
	}
	//----------------
	if ( flag == "bad" )
	{return false}
	else
	{return true}
}
// ########################################################################################
function intercept()
{
	if(window.event)
		key = window.event.keyCode;     //IE
	else
		key = e.which;     //firefox
	
//	if ( window.event.keyCode == 27 )
	if ( key == 27 )
	{	
		// Escape key = 27, backspace = 8
		window.event.returnValue = false			
	}
	// ---------------------------------------------------------------	
	// keyCode 8 = Backspace
//	if (	window.event.keyCode == 8
	if ( key == 8
			&& (
					( document.activeElement.getAttribute("type", 0) != "text"
						&& document.activeElement.tagName.toLowerCase() != "textarea" 
						&& document.activeElement.getAttribute("type", 0) != "password" 	)
				 || (document.activeElement.getAttribute("readonly", 0) == true  )
				 || (document.activeElement.tagName.toLowerCase() == "body"  )
			) ) 
	{	
		window.event.returnValue = false
		//document.activeElement.id
	}	
}
// ########################################################################################
function disableF5()
{
	//alert(event.keyCode);|| window.event.keyCode == 112
	/*
	if ( window.event.keyCode == 116 )
	{
		event.keyCode = 0;
		event.returnValue = false;
		event.cancelBubble = true;
		return false;		
	}
	*/			
}
// ########################################################################################
function cancelRightClick()
{
//	alert("AVIS College")
//	return false;
}
// ########################################################################################
function doUnload()
{	
	//alert("Now closed")
	//parent.close()
}
// ########################################################################################

function MM_preloadImages() 
{ //v3.0
	var d = document; 
	if( d.images )
	{ 
		if(!d.MM_p) 
			d.MM_p = new Array();
		var i, j=d.MM_p.length, a=MM_preloadImages.arguments; 
		for(i=0; i<a.length; i++)
		{
			//alert("Arg src: " + a[i] )
			if (a[i].indexOf("#")!=0)
			{ 
				//alert("j is: " + j)
				d.MM_p[j] = new Image; 
				d.MM_p[j++].src = a[i];
			}
		}
	}
}
// ########################################################################################
function limitTextArea(p_oThis, p_limit)
{   
	//alert("Now fire")  
	var theString = new String() 
	if (p_oThis.value.length > p_limit)  
	{        
		theString = p_oThis.value     
		p_oThis.value = theString.substr(0, p_limit)
		alert("Maximum limit reached:\n - truncated to " + p_limit + " characters.");
	}
}

// ########################################################################################

function leftPad(p_value, p_size, p_pad)
{
	var newValue;
	newValue = new String(p_value)
	while (newValue.length < p_size)
	{
		newValue = p_pad + newValue;
	}
	return newValue
}
// ########################################################################################
function rightPad(p_value, p_size, p_pad)
{
	var newValue;
	newValue = new String(p_value)
	while (newValue.length < p_size)
	{
		newValue = newValue + p_pad;
	}
	return newValue
}

// ########################################################################################
function jsFormatDate(p_date)
{
	// she will take any valid date and return yyyy-mm-dd hh:mi:ss.ms
	var oDate = new Date()
	var retValue = new String()	
	oDate = p_date	
	retValue = oDate.getFullYear() + "-" + leftPad(oDate.getMonth()+1, 2, "0") + "-" + leftPad(oDate.getDate(), 2, "0")
					+ " " + leftPad(oDate.getHours(), 2, "0") + ":" + leftPad(oDate.getMinutes(), 2, "0") + ":" 
					+ leftPad(oDate.getSeconds(), 2, "0") + "." + rightPad(oDate.getMilliseconds(), 3, "0")
	return retValue;
}

// ########################################################################################

function jsGetComputerDate(p_date, p_format)
{
	// It will take 'dd-mmm-yyyy' date and return 'yyyy-mm-dd'
	var strDate = new String(), theDay, theMonth, theYear, objDate = new Date(), retValue
	strDate = p_date
	// p_format = dd-mmm-yyyy
	theDay = strDate.substr(0, 2)
	theMonth = strDate.substr(3, 3)	
	theMonth = toggleMonth(theMonth)
	theMonth = leftPad(theMonth, 2, "0")	
	theYear = strDate.substr(7, 4)
	retValue = theYear + "-" + theMonth + "-" + theDay
	return retValue
}


// ######################################################################

function toTitleCase(p_param)
{
	var firstChar = new String();
	var theParam = new String();
	var theRest = new String();
	theParam = jTrim(p_param)
	firstChar = theParam.substr(0, 1)
	theRest = theParam.substr(1)
	return firstChar.toUpperCase() + theRest.toLowerCase()
}

// ######################################################################

function toggleMonth(p_month)
{
	var strWholeMonths = new String();
	var arWholeMonths = new Array();
	var retValue, x, position, theLen
	strWholeMonths = "jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec"
	arWholeMonths = strWholeMonths.split(",")
	theLen = p_month.length
	// If number 
	if ( isNaN(p_month) == false )
	{
		retValue = arWholeMonths[p_month-1]
		retValue = toTitleCase(retValue)
	}
	// If characters
	else if ( isNaN(p_month) == true )
	{
		p_month = jTrim(p_month).toLowerCase()
		for ( x = 0; x<arWholeMonths.length; x++)
		{
			if ( p_month == arWholeMonths[x] )
			{
				retValue = (x+1)
			}
		}
	}
	return retValue
}

// ######################################################################




function isDate_original(p_date) 
{ 
	// m[m]/d[d]/yyyy format
	var match = p_date.match(/^(\d\d?)\/(\d\d?)\/(\d{4})$/);
	if (!match) 
	{ 
		return false; 
	}
	var yr = Number(match[3]);
	var mt = Number(match[1]);
	var da = Number(match[2]);
	var d = new Date(yr,mt-1,da);
	return (d.getMonth()+1 == mt && d.getDate() == da);
}

// ###################################################################################
function jIsDate(p_date) 
{ 
	var patt, theMatch, theYear, theMonth, theDay, oDate
	patt = "^(20[01]{1}[0-9]{1})-([0-9]{1,2})-([0-9]{1,2})$";
	theMatch = p_date.match(patt)
	if (!theMatch) 
	{ 
		return false; 
	}
	theYear = Number(theMatch[1]);
	theMonth = Number(theMatch[2]);
	theDay = Number(theMatch[3]);
		
	var oDate = new Date(theYear, (theMonth-1), theDay);
	if ( oDate.getFullYear() == theYear && oDate.getMonth()+1 == theMonth && oDate.getDate() == theDay )
	{
		return true;
	}
	else
	{
		return false;
	}	
}

// ##################################################################################

function setClass(p_fmName)
{	
	var oForm = eval("document." + p_fmName)
	var x, arrAnchor = document.getElementsByTagName("A")
	var oneColumnOnly, posComma, strOnclick = new String()
	var listOfColumns = new String()
	//alert("form is: " + oForm )
	// remove ' desc' from the list of columns
	listOfColumns = oForm.sorting.value
	
	//alert("listOfColumns is: " + listOfColumns )
	listOfColumns = listOfColumns.replace(" desc,", ",")
	//
	posComma = listOfColumns.indexOf(",")
	if ( posComma > -1 )
	{
		listOfColumns = listOfColumns.replace(" desc,", ",")
	}
	else
	{
		listOfColumns = listOfColumns.replace(" desc", "")
	}
	// ------------------------------------------------------
	
	if ( posComma > -1 )	{
		oneColumnOnly = listOfColumns.substr(0, posComma ) 
	}
	else	{
		oneColumnOnly = listOfColumns	
	}
	
	//alert("listOfColumns: " + listOfColumns  )
		
	for (x=0; x < arrAnchor.length; x++)
	{
		//alert("onclick: " + arrAnchor[x].getAttribute("onclick")  )
		//alert("onclick start"  )
		if ( arrAnchor[x].onclick )
		{
			strOnclick = arrAnchor[x].onclick.toString();
			//alert("strOnclick: " + strOnclick
			//			+ "\n IndexOf: " + strOnclick.indexOf("doSorting(this)")  )
			if (arrAnchor[x].id == oneColumnOnly && strOnclick.indexOf("doSorting(") > -1 )
			{
				arrAnchor[x].className = "colNameSort"
			}
			else if (arrAnchor[x].id != oneColumnOnly && strOnclick.indexOf("doSorting(") > -1 )

			{
				arrAnchor[x].className = "colName"
			}
		}
	}
}
// ===================================================================================
function setClass_old(p_fmName)
{	
	var oForm = eval("document." + p_fmName)
	var x, arrAnchor = document.getElementsByTagName("A")
	var oneColumnOnly, posComma, strOnclick = new String()
	//alert("form is: " + oForm )
	// remove ' desc' from the list of columns
	//
	posComma = oForm.sorting.value.indexOf(",")
	if ( posComma > -1 )	{
		oneColumnOnly = oForm.sorting.value.substr(0, posComma ) 
	}
	else	{
		oneColumnOnly = oForm.sorting.value		
	}	
	for (x=0; x < arrAnchor.length; x++)
	{
		//alert("onclick: " + arrAnchor[x].getAttribute("onclick")  )
		//alert("onclick start"  )
		if ( arrAnchor[x].onclick )
		{
			strOnclick = arrAnchor[x].onclick.toString();
			
			//alert("strOnclick: " + strOnclick
			//			+ "\n IndexOf: " + strOnclick.indexOf("doSorting(this)")  )
			
			if (arrAnchor[x].id == oneColumnOnly && strOnclick.indexOf("doSorting(this)") > -1 )
			{
				arrAnchor[x].className = "colNameSort"
			}
			else if (arrAnchor[x].id != oneColumnOnly && strOnclick.indexOf("doSorting(this)") > -1 )

			{
				arrAnchor[x].className = "colName"
			}
		}
	}
}
// ##################################################################################

function doLogin()
{
	if ( jTrim(document.fm_Login.UserName.value) == "" || jTrim(document.fm_Login.UserPassword.value) == "")
	{	
		document.fm_Login.UserName.focus()
		alert("Enter user name and password please")
		//alert("action: " + document.fm_Login.action)
		//document.write("action: " + document.fm_Login.action)
		return false;		
	}
	else
	{		
		//document.fm_Login.action = "../asp/manageUser/09chkLogin.asp"
		//alert("action: " + document.fm_Login.action)
		return true;
	}	
}
// ##################################################################################

function doSorting(p_fmName, p_this)
{
	//this function for files: 26viewUsers.asp and 28viewOrders.asp
	var oForm = eval("document." + p_fmName)
	var currColumn = oForm.currColumn.value
	var asc_desc = oForm.asc_desc.value
	//alert("currColumn: " + currColumn
	//			+ "\n asc_desc: " + asc_desc 
	//			+ "\n p_this.id: " + p_this.id 
	//			) 
	if ( currColumn == p_this.id )
	{
		//alert("Here 1")
		if ( asc_desc == "asc" )
		{
			//alert("Here 2")
			oForm.asc_desc.value = "desc"
		}
		else
		{
			//alert("Here 3")
			oForm.asc_desc.value = "asc"
		}
	}
	else
	{
		oForm.asc_desc.value = "asc"
	}
	//alert("Here 4")
	oForm.currColumn.value = p_this.id
	oForm.submit()
}
// ##################################################################################
function validLogin_old(argName) 
{
	/*
	var i = 0, flag
	var regul, theValue, mesgName
	theValue = jTrim(argName)
	var strAccepted = "abcdefghijklmnopqrstuvwxyz_0123456789"
	flag = "good"
	if ( theValue.length < 6 )				
	{
		//alert("Please enter a " + argName )		
		//argName.focus();
		//argName.value = "";
		flag = "bad"
	}
	else
	{		
		for(i=0; i < theValue.length; i++)
		{			
			//alert( "Start Loop, i=" + i + ", theValue is: " + theValue )
			regul = theValue.substr(i, 1).toLowerCase()
			//alert( "regul is: " + regul )
			if ( regul == "."
				|| regul == "^"
				|| regul == "*"
				|| regul == "+"
				|| regul == "\\" 
				|| strAccepted.search(regul) == -1  )
			{
				//alert( "'" + regul + "' is Invalid character,\n "
				//			+ "please use only alphanumerics");				
				//argName.value = "";
				//argName.focus();
				flag = "bad"
				break;				
			}			
		}
	}
	if ( flag == "bad" )
	{	return false;	}
	else
	{	return true;	}
	*/
}


function jIsDate_old(argDate)
{
	/*
	var theDay, theMonth, theYear, flag, x
	var nDay, nMonth, nYear, strAllMonths = new String()
	strAllMonths = "jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec"
	flag = "good"
	//format must be yyyy-mm-dd
	//theDay = argDate.substr(0, 2)
	//theMonth = argDate.substr(3, 2)
	//theYear = argDate.substr(6, 4)
	// ---------------------------------------------
	//format must be dd-mmm-yyyy
	theDay = argDate.substr(0, 2)
	theMonth = argDate.substr(3, 3).toLowerCase()	
	theYear = argDate.substr(7, 4)
	//alert("theDay is: " + theDay + "\ntheMonth is: " + theMonth + "\ntheYear is: " + theYear )
	if ( isNaN(theDay) || isNaN(theYear) || strAllMonths.indexOf(theMonth) < 0 )
	{
		//alert("First error")
		return false;
	}
	else if ( argDate.charAt(2) != "-" || argDate.charAt(6) != "-" )
	{
		//alert("Second error")
		return false;
	}
	else
	{	
		nDay = parseInt(theDay, 10)
		nMonth = toggleMonth(theMonth)
		nYear = parseInt(theYear, 10)		
		//alert("nDay is: " + nDay + "\n nMonth is: " + nMonth + "\n nYear is: " + nYear 
		//			+ "\n theMonth: " + theMonth )
	}
	// -------------------------------------	
	
	if ( nDay < 1 || nDay > 31
			|| nMonth < 1 || nMonth > 12
			|| nYear < 1975 || nYear > 2050
			|| ( nDay > 28 && nMonth == 2 && nYear % 4 != 0)
			|| ( nDay > 29 && nMonth == 2 )
			|| ( nDay > 30 && 
				( nMonth == 4 || nMonth == 6 || nMonth == 9 || nMonth == 11 ) ) )
			
	{
		return false;
	}		
	else
	{	return true;	}
	*/
}

// ###################################################################




















		
