/*Available functions  :-01) function trim 						=> Remove leading and trailing spaces from a string02) function getDBPath 				=> Get location of destination database03) function toDate 					=> Convert date string to date format04) function isValidDate 				=> Date validation05) function XMLtoNotesDate 		=> Convert xml source to Notes date06) function showmenu 				=> Show submenu (used in CUI)07) function hidemenu 				=> Hide submenu (used in CUI)08) function isNewDoc 				=> Check if the document is new09) function isDocBeingEdited 	=> Check if the document is being edited10) function Instr 						=> Returns the position of the character that begins the first occurrence of one string within another string. 11) function left 							=> @Left a string12) function right 						=> @Right a string13) function unique 					=> Get the unique list14) function contains 					=> Determines whether a substring is stored within a string15) function RowVisibility			=> Hides certain rows when called - Hardcoded to 3 columns in one row16) function RowVisibility2 			=> Hides certain rows when called - Hardcoded to hide 2 columns in one row17) function replaceSubstring		=> Replace character18) function openDialogBox		=> Launch a new window dialog19) other functions to calculate date20) function getStatusforView 		=>	21) function convertArrayandUnique => To convert string to array and make the value unique22) function formatNum => 23) function removeStr =>24) function isValidTime =>25) function sortList 				=> sorting26) function check_dateFormat =>27) function check_dateRange = > end_date must be greater than start_date28) function check_timeRange => end_time must be greater than start_time 29) function day => get day30) function getQueryValue        => Return the value in the query string 31) function setCookie			=> Create cookie31) function getCookie			=> Read cookie's data32) function activateMenu		=> This function is used for the dynamic menu on the header33) function DisplayTable		=> this function is used for the dynamic table (v2) - to dispay table34) function CheckValue			=> this function is used for the dynamic table (v2)- to validate value35) function setText				=> this function is used for the dynamic table (v2) - to format text accordingly36) function DeleteRow			=> this function is used for the dynamic table (v2)- to delete row37) function SaveValue			=>	this function is used for the dynamic table (v2)- to save value38) function getchk					=> this function is used for the dynamic table (v2)39) function clock  					=> this function is used for the live clock40) function replaceCReturn41) function showElement       => to show element for IE only42) function hideElement         => to hide element for IE only43) function openDialogBoxWindowOpenURL*///Originally written by Jim Frickerfunction trim(aStr) {	return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "")}function getDBPath( name ){	DBnames = window.document.forms[0].DBNames	DBpaths = window.document.forms[0].DBPathValues	for( n=0; n<DBnames.length; n++ )		if( name == DBnames[n].value ) 		{			var path = DBpaths[n].value			return path		}		alert( 'NO SUCH DATABASE IN THE SYSTEM' )}function showmenu(elmnt){	document.all(elmnt).style.visibility="visible"}function hidemenu(elmnt){	document.all(elmnt).style.visibility="hidden"}function isNewDoc(){	url = window.location.toString();	url = url.toLowerCase();	if ( url.indexOf ( "openform" ) == -1 )		return false;	else		return true;}function isDocBeingEdited(){	if ( isNewDoc() ) return true;		url = window.location.toString();	url = url.toLowerCase();		if ( url.indexOf ( "editdocument" ) == -1)		return false;	else		return true;}function Instr(strSource, strLookup){	return(strSource.indexOf(strLookup))}function left(stringToSearch, substring){	var left = stringToSearch.substr(0, substring)	return left;}function right(stringToSearch, substring){	var strLength = stringToSearch.length	var right = stringToSearch.substr(substring + 1, strLength)	return right;}function unique(a) {	tmp = new Array(0);	for(i = 0; i < a.length; i++)	{		if(!contains(tmp, trim(a[i])))		{			tmp.length+=1;			tmp[tmp.length-1] = trim(a[i]);		}	}	return tmp;}function contains(a, e){	for(j = 0; j < a.length; j++)		if(a[j] == e)			return true;	return false;}function RowVisibility(col1, col2, col3, visible){	handle="document.all";	stylevar=".style";	if ( visible == "true" )	{     	eval ( handle + '["' + col1 +'"]' + stylevar + '.display = ""');		if ( col2 != "" ) {	     	eval ( handle + '["' + col2 +'"]' + stylevar + '.display = ""');	     	eval ( handle + '["' + col3 +'"]' + stylevar + '.display = ""');     	}	}	else	{     	eval ( handle + '["' + col1 +'"]' + stylevar + '.display = "none"');		if ( col2 != "" ) {	     	eval ( handle + '["' + col2 +'"]' + stylevar + '.display = "none"');	     	eval ( handle + '["' + col3 +'"]' + stylevar + '.display = "none"');	     }	}}function RowVisibility2(col1, col2, visible){	handle="document.all";	stylevar=".style";	if ( visible == "true" )	{     	eval ( handle + '["' + col1 +'"]' + stylevar + '.display = ""');		if ( col2 != "" ) 	     	eval ( handle + '["' + col2 +'"]' + stylevar + '.display = ""');	}	else	{     	eval ( handle + '["' + col1 +'"]' + stylevar + '.display = "none"');		if ( col2 != "" ) 	     	eval ( handle + '["' + col2 +'"]' + stylevar + '.display = "none"');	}}function replaceSubstring( strValue, single_char, char_replace ){ 	var strChar = ""	if ( strValue.indexOf( single_char ) != -1 )	{ 		for ( var i = 0; i < strValue.length; i++ )		{ 			if ( strValue.substring( i, i + 1 ) == single_char )				strChar = strChar + char_replace			else				strChar = strChar + strValue.substring( i, i + 1 )		}		return strChar	}	else		return strValue}//function to launch a dialogbox form//parameters include width, height, form, scrollbar.function openDialogBox( width, height, left, top, form, resize, valuePass ){	if ( form.indexOf( "." ) != -1 )		strPath = form; 	else	{		win = window.location		win = win.pathname.toLowerCase()		nsfPos = win.indexOf(".nsf")		path = win.substring(0, nsfPos + 4)		strPath = path + "/" + form	}	//dialogHeight; dialogLeft; dialogTop; dialogWidth; dialogCenter; dialogHide; edge(sunken or raised); help; resizable; scroll; status; unadorned	var strOpener = "dialogHeight: " + height + "px; dialogLeft: " + left + "; dialogTop: " + top + "; dialogWidth: " + width +  "px; resizable: " + resize + "; status: no; help: no";	var sReturnName = window.showModalDialog( strPath, valuePass, strOpener );		//reserve for return values	if (!sReturnName)	{		// If sReturnName equals null, then the dialog was closed by clicking the window close		//  button rather than by clicking on a persons name. You should always check for this		//  and handle it (usually by just returning out of the function)		return;	}	else {		return sReturnName;	}	//document.forms[0].Subject.value = sReturnName;}//function to launch a dialogbox form//parameters include width, height, form, scrollbar.function openDialogBoxURL( width, height, left, top, strPath , resize ){		//dialogHeight; dialogLeft; dialogTop; dialogWidth; dialogCenter; dialogHide; edge(sunken or raised); help; resizable; scroll; status; unadorned	var strOpener = "dialogHeight: " + height + "px; dialogLeft: " + left + "; dialogTop: " + top + "; dialogWidth: " + width +  "px; resizable: " + resize + "; status: no; help: no";	var sReturnName = window.showModalDialog( strPath, '' , strOpener );		//reserve for return values	if (!sReturnName)	{		// If sReturnName equals null, then the dialog was closed by clicking the window close		//  button rather than by clicking on a persons name. You should always check for this		//  and handle it (usually by just returning out of the function)		return;	}	else {		return sReturnName;	}	//document.forms[0].Subject.value = sReturnName;}//function to launch a dialogbox form//parameters include width, height, form, scrollbar.function openDialogBoxWindowOpen( strPath, width, height, toolbar, scroll, resize ){		win = window.location	win = win.pathname.toLowerCase()	nsfPos = win.indexOf(".nsf")	path = win.substring(0, nsfPos +5)	var u = path + strPath	var strOpener = "width=" + width + ",height=" + height + ",toolbar=" + toolbar + ",scrollbars=" + scroll + ",resizeable=" + resize		window.open( u, "" ,strOpener)	}/*============ DATE CALCULATION FUNCTIONS Starts============*/ function toDate( dateString ){	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/	var matchArray = dateString.match(datePat)	if (matchArray == null) return false	//	 " Date is not in a valid format."	var month = eval( matchArray[3] + " - 1" )   // parse date into variables 0<m<11, 1<d<31	var day = matchArray[1]	var year = matchArray[4]		return new Date( year, month, day )}function isValidDate( date ) {	// DD/MM/YYYY   DD-MM-YYYY	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/	var matchArray = date.match(datePat)	if (matchArray == null) {		alert("Sila masukkan format tarikh yang telah ditetapkan")		return false	//	 " Date is not in a valid format.")	}		var month = 1 * matchArray[3] // parse date into variables	var day = 1 * matchArray[1]	var year = 1 * matchArray[4]	if (month < 1 || month > 12) {		alert("Bulan harus antara 1 hingga 12")		return false;	}			if (day < 1 || day > 31) {		alert("Hari harus antara 1 hingga 31") 		return false;	}		if (day==31 && (month==4 || month==6 || month==9 || month==11)) { 		alert("Tiada 31 haribulan dalam bulan tersebut")		return false;	}		if (month == 2) 	{ 		var isleap = (year % 4 == 0);		if (day>29 || (day==29 && !isleap)) {		alert("Tiada 29 haribulan dalam tarikh tersebut")			return false //"February " + year + " doesn't have " + day + " days!"		}	}		return date}<!-- Original:  Sandeep Tamhankar (stamhankar@hotmail.com) --><!-- Web Site:  http://207.20.242.93 --><!-- This script and many more are available free online at --><!-- The JavaScript Source!! http://javascript.internet.com -->function isValidTime(timeStr) {// Checks if time is in HH:MM:SS AM/PM format.// The seconds and AM/PM are optional.	var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;	var matchArray = timeStr.match(timePat);	if (matchArray == null) {		alert("Sila masukkan format waktu yang telah ditetapkan")		return false;	}	hour = matchArray[1];	minute = matchArray[2];	second = matchArray[4];	ampm = matchArray[6];	if (second=="") 		{ second = null; }			if (ampm=="") 		{ ampm = null }	if (hour < 0  || hour > 12) {		alert("Jam harus antara 1 hingga 12.");		return false;	}		if (hour <= 12 && ampm == null) {		alert("Sila masukkan AM atau PM.");		//alert("You must specify AM or PM.");		return false;   	}	if (minute<0 || minute > 59) {		alert ("Minit harus antara 0 hingga 59.");		return false;	}		if (second != null && (second < 0 || second > 59)) {		alert ("Saat harus antara 0 hingga 59.");		return false;	}	return timeStr;}function XMLtoNotesDate( dateString ){	var dateObject = new Date( )	var datePat = /^(\d{4})(\d{2})(\d{2})$/	var matchArray = dateString.match(datePat)	if (matchArray == null) return false	//	 " Date is not in a valid format."	var month = matchArray[2]   // parse date into variables 0<m<11, 1<d<31	var day = matchArray[3]	var year = matchArray[1]	return  day + "/" + month + "/" + year}function XMLtoDate( dateString ){	var dateObject = new Date( )	var datePat = /^(\d{4})(\d{2})(\d{2})$/	var matchArray = dateString.match(datePat)	if (matchArray == null) return false	//	 " Date is not in a valid format."	var month = eval( "-1 + " + matchArray[2] )   // parse date into variables 0<m<11, 1<d<31	var day = matchArray[3]	var year = matchArray[1]	dateObject.setFullYear( year, month, day )	return dateObject}function toXMLDate( date ){	if( date == false )	{		alert( 'wrong date format' )		return -1		}	var datePat = /^(\d{1,2})(\/)(\d{1,2})\2(\d{4})$/	var matchArray = date.match(datePat)	var day = eval(matchArray[1]+'/1')	var month = eval(matchArray[3]+'/1')	var year = eval(matchArray[4]+'/1')	if( parseInt(month)<10 ) month = '0' + month		if( parseInt(day)<10 ) day = '0' + day 	return '' + year + month + day}	function splitXMLDate( startD, endD ){	if( eval(endD + ' - ' + startD)<0 )	{		alert( 'End Date must be later than Start Date' )		return -1		}	var i = 0 	var datePat = /^(\d{4})(\d{2})(\d{2})$/	var monthEnds = new String( '0131, 0229, 0331, 0430, 0531, 0630, 0731, 0831, 0930, 1031, 1130' )	var arrayD = new Array(0)	var tim	var yr	var m	var d	var md	arrayD[i] = startD	while( startD < endD )	{		matchArray = startD.match(datePat)		yr = matchArray[1]		m = matchArray[2]		d = matchArray[3]		md = m + d		tim = monthEnds.indexOf(md) 		if( tim>=0  || (md=='0228' &&  yr%4!=0) ) 		{			tim = eval('1+' + m)			tim = (tim<10)? ('0'+tim) : tim			startD = yr + tim + '01'				}		else if( md=='1231' )		{			tim = eval('1+' + yr)			startD = tim + '0101'				}		else 		{			tim = eval('1+' + d)			tim = (tim<10)? ('0'+tim) : tim			startD = yr + m + tim				}		i++			arrayD[i] = startD	}	return arrayD}/*============ DATE CALCULATION FUNCTIONS Ends============*/ /*---------------- Menu functions Starts---------------------*/function regenerate(){	window.location.reload()}function regenerate2(){	if (document.layers)		setTimeout("window.onresize=regenerate",400)}function pull(){		if (window.drawit)		clearInterval(drawit)	pullit = setInterval("pullengine()",10)}function draw(){	clearInterval(pullit)	drawit = setInterval("drawengine()",10)}function pullengine(){	if (document.all&&themenu.pixelLeft<rightboundary)		themenu.pixelLeft+=5	else if(document.layers&&themenu.left<rightboundary)		themenu.left+=5	else if (window.pullit)		clearInterval(pullit)		hideElementGen( 'SELECT', document.getElementById('slidemenubar2') );}function drawengine(){	if (document.all&&themenu.pixelLeft>leftboundary)		themenu.pixelLeft-=5	else if(document.layers&&themenu.left>leftboundary)		themenu.left-=5	else if (window.drawit)		clearInterval(drawit)		showElementGen( 'SELECT' );}/*---------------- Menu functions Ends---------------------*//*---------------- Calendar view functions Starts-----------------*/function dispYear() {	var strLocation = new String(window.location);	var str1 = new String(window.location.protocol + "//" + window.location.host + "/");	var str2 = new String(strLocation.substring(str1.length, (strLocation.indexOf("nsf")+3)));	var str3 = new String("/Calendar?OpenView&Grid=5");	strLocation = str1 + str2 + str3;	window.location = strLocation;}function buildCal(preTables) {	obj=document.getElementsByTagName("table");		for (var i=0; i<obj.length; i++)	{     	if( i == preTables + 1 )		{ 	     			     		var cal = obj[i]			//			obj[i].className = 'calendar';			var cels = cal.getElementsByTagName('td');			     		for(var c=0; c<cels.length; c++)			{				// format the day names text, e.g. Monday, Tuesday.				var wcels = cels[c].getElementsByTagName('b');     			for(var b=0;b<wcels.length;b++)				{					wcels[b].className = 'bolds';				}								if (wcels.length >0)				{					// format the day names cell, i.e. backgroundColor for Monday.	     			cels[c].className = 'calendarCellsWeek';				}	     					     		var tcels = cels[c].getElementsByTagName('table');				if (tcels.length >0)				{					// format the day cell header (table tag)					tcels[0].className = 'days';					var dcell = tcels[0].getElementsByTagName('td');					if (dcell.length > 0)					{						// format the day cell header (td tag)						dcell[0].className = 'daysCells';					}					var tdays = tcels[0].getElementsByTagName('a');					if (tdays.length != 0)					{						// format the day text, i.e. 1, 2, 3 .... 31    						tdays[0].className = 'daysText';					}					// format the description cell (border)					cels[c].className = 'calendarCellsDay';									// format the description cell (only with data)					tcels[1].className = 'daysInfo';													var dicell = tcels[1].getElementsByTagName('td');											if (dicell.length <= 0 )					{						var TableBody = document.createElement("TBODY");						var row = document.createElement("TR");						var cell = document.createElement("TD");						// format the description cell (without data)						cell.className = 'daysInfoCells';						var textval = "";						var textNode = document.createTextNode(textval);						cell.appendChild(textNode)						row.appendChild(cell)						TableBody.appendChild(row)						tcels[1].appendChild(TableBody)					}				} 			}		}	}}/*---------------- Calendar view functions Ends-----------------*//*============ blinking header============*/ function blinking_header( strid ){	if ( !document.getElementById(strid).style.color )		document.getElementById(strid).style.color = "#ffbf18"	if ( document.getElementById(strid).style.color == "#ffbf18" )		document.getElementById(strid).style.color = "#000000"	else		document.getElementById(strid).style.color = "#ffbf18"	timer = setTimeout( "blinking_header('"+strid+"')",250 )}function stoptimer(){	clearTimeout(timer)}function getStatusForView(Frm){var statusSyn = Frm.STATUS.value;var statusSynPos = Frm.STATUSLOOKUP.value.indexOf(statusSyn);var getResStatus = Frm.STATUSLOOKUP.value.substring(0, statusSynPos - 2) // (- 1)to remove pipevar lastcommaPos = getResStatus.lastIndexOf(",");var getStatusDesc = getResStatus.substring(lastcommaPos + 1,statusSynPos - 2); //( + 1) to get the string after commaFrm.STATUSFORVIEW.value = trim(getStatusDesc);}function convertArrayandUnique(fieldvalue){tmpArr = new Array(0)tmpArr = fieldvalue.split(";" )tmpUnique = unique(tmpArr)return tmpUnique}function formatNum(strNum){	var fixedPos = 2;	var i = Instr(strNum, ".") //	alert("strNum: " + strNum)	if (i > -1)	{		var left = strNum.substr(0, i);//		alert("left: " + left)		var right = strNum.substr(i+1, fixedPos+1);//		alert("right: " + right)		var len = right.length;				if (len > fixedPos) // Length = 3		{			// Get the last 2 characters and put a decimal place in between and round it up.			// Eg: 345 becomes 4.5 becomes 5			var tmp = right.substr(1, 1) + "." + right.substr(2, 1);			tmp = Math.round(tmp);//			alert("tmp: " + tmp)			if (tmp < 10)			{				right = right.substr(0, 1) + tmp;//				alert("right: " + right)			}			else			{				var firstChar = parseInt(right.substr(0, 1)) + 1;//				alert("firstChar: " + firstChar)				if (firstChar < 10)				{					right = firstChar + "0";//					alert("right: " + right)				}				else				{					right = "00";//					alert("right: " + right)						// if left is a negative value, deduct 1 else add 1					var i = InStr(left, "-") ;					if (i > -1)					{						left = left.substr(1, left.length-1); // discard negative sign						left = parseInt(left) + 1;						left = "-" + left; // append back negative sign//						alert("left: " + left)					}					else					{						left = parseInt(left) + 1;//						alert("left: " + left)					}				}				}			}		else if (len < fixedPos) // Length = 1		{			right = right + "0";		}//		alert("to be formatted: " + left + "." + right)		return addStr(left.toString(), ",", 3) + "." + right;	}//	alert("return: " + addStr(strNum, ",", 3) + "." + "00")	return addStr(strNum, ",", 3) + "." + "00";}// Remove all occurrences of strRemove in a strSource.// Return the modified string.function removeStr(strSource, strRemove){	var strFormatted = "";	var intPos;	intPos = Instr(strSource, strRemove);	while ( intPos != -1 )	{		strFormatted = strFormatted + Mid(strSource, 0, intPos) ;		strSource = Mid(strSource, intPos+1) ;		intPos = InStr(strSource, strRemove);	}	return strFormatted + Mid(strSource, 0) ;}// Add strAdd into strSource after every intLength number of characters.// The characters are counted from right to left of strSource.// Return the modified string.function addStr(strSource, strAdd, intLength){//	alert("to be formatted: " + strSource)	var strFormatted = "";	var i = Instr(strSource, "-");	var strNegNo = "False";	if (i > -1)	{		strNegNo = "True";		strSource = strSource.substring(1, strSource.length + 1);	}	while ( strSource.length > intLength )	{		strFormatted = strAdd + Right(strSource, intLength) + strFormatted;		strSource = strSource.substring(0, strSource.length - intLength);	}//	alert("strSource: " + strSource)	//	alert("strFormatted: " + strFormatted)	if (strNegNo == "True")		return "-" + strSource + strFormatted;	else		return strSource + strFormatted;}//Address picker for single value//strFieldName = "SendTo"function fncAddressPickerSingle(strFieldName){var doc = document.forms[0];var valuePass = ""; //Nothing to passvar setupDBPath = replaceSubstring(doc.SetupDB.value,"\\","/");returnValue = openDialogBox( '350', '430', '', '', '/' + setupDBPath+ '/dfAddressPickerSingle?ReadForm', 'no', valuePass );if (returnValue){		//alert( "Ok : " + returnValue);		if (returnValue !=""){		eval( "document.forms[0]." + strFieldName + ".value = '" + returnValue+"'")}		return(true)}else{//		alert( "Calcel : " + returnValue);		return(false)}}function fncAddressPickerSingleCustom(strFieldName){var doc = document.all;var valuePass = ""; //Nothing to passvar setupDBPath = replaceSubstring(doc.SetupDB4While.value,"\\","/");returnValue = openDialogBox( '350', '430', '', '', '/' + setupDBPath+ '/dfAddressPickerSingle?ReadForm', 'no', valuePass );if (returnValue){		//alert( "Ok : " + returnValue);		if (returnValue !=""){		eval( "document.all." + strFieldName + ".value = '" + returnValue+"'")}		return(true)}else{//		alert( "Calcel : " + returnValue);		return(false)}}//Address picker for multi values//strFieldName = "CCTo"function fncAddressPickerMulti(strFieldName){var doc = document.forms[0];var valuePass = eval( "document.forms[0]." + strFieldName + ".value");//var setupDBPath = doc.SetupDB.value;var setupDBPath = replaceSubstring(doc.SetupDB.value,"\\","/");returnValue = openDialogBox( '500', '420', '', '', '/'+setupDBPath+ '/dfAddressPickerMulti?ReadForm', 'no', valuePass );if (returnValue){//		alert( "Ok : " + returnValue);		if (returnValue !="Empty"){		eval( "document.forms[0]." + strFieldName + ".value = '" + returnValue+"'")}		else{		eval( "document.forms[0]." + strFieldName + ".value = '" + "" +"'")}		return(true)}else{//		alert( "Calcel : " + returnValue);		return(false)}};//Staff Name picker for single value//strFieldName = "SendTo"function fncStaffPickerSingle(strFieldName){var doc = document.forms[0];var valuePass = ""; //Nothing to passvar setupDBPath = doc.SetupDB.value;returnValue = openDialogBox( '350', '420', '', '', '/' + setupDBPath+ '/dfStaffPickerSingle?ReadForm', 'no', valuePass );if (returnValue){//		alert( "Ok : " + returnValue);		if (returnValue!=""){		eval( "document.forms[0]." + strFieldName + ".value = '" + returnValue+"'")}		return(true)}else{//		alert( "Calcel : " + returnValue);		return(false)}}//Staff Name Picker for mutivalues//strFieldName = "CCTo"function fncStaffPickerMulti(strFieldName){var doc = document.forms[0];var valuePass = eval( "document.forms[0]." + strFieldName + ".value");var setupDBPath = doc.SetupDB.value;returnValue = openDialogBox( '500', '430', '', '', '/'+setupDBPath+ '/dfStaffPickerMulti?ReadForm', 'no', valuePass );if (returnValue){//		alert( "Ok : " + returnValue);		if (returnValue !="Empty"){		eval( "document.forms[0]." + strFieldName + ".value = '" + returnValue+"'")}		else{		eval( "document.forms[0]." + strFieldName + ".value = '" + "" +"'")}		return(true)}else{//		alert( "Calcel : " + returnValue);		return(false)}}function fncStaffPickerMultiIS(strFieldName){var doc = document.forms[0];var valuePass = eval( "document.forms[0]." + strFieldName + ".value");var setupDBPath = doc.SetupDB.value;returnValue = openDialogBox( '500', '430', '', '', '/'+setupDBPath+ '/dfStaffPickerMultiCom?ReadForm', 'no', valuePass );if (returnValue){//		alert( "Ok : " + returnValue);		if (returnValue !="Empty"){		eval( "document.forms[0]." + strFieldName + ".value = '" + returnValue+"'")}		else{		eval( "document.forms[0]." + strFieldName + ".value = '" + "" +"'")}		return(true)}else{//		alert( "Calcel : " + returnValue);		return(false)}}function fncStaffPickerMultiIBullet(strFieldName){var doc = document.forms[0];var valuePass = eval( "document.forms[0]." + strFieldName + ".value");var setupDBPath = doc.SetupDB.value;returnValue = openDialogBox( '500', '430', '', '', '/'+setupDBPath+ '/dfStaffPickerMultiBullet?ReadForm', 'no', valuePass );if (returnValue){//		alert( "Ok : " + returnValue);		if (returnValue !="Empty"){		eval( "document.forms[0]." + strFieldName + ".value = '" + returnValue+"'")}		else{		eval( "document.forms[0]." + strFieldName + ".value = '" + "" +"'")}		return(true)}else{//		alert( "Calcel : " + returnValue);		return(false)}}function sortList(listFieldName) {list = document.forms[0][listFieldName]var temp_opts = new Array()var temp = new Object	for (var i=0; i<list.options.length; i++) {		temp_opts[i] = list.options[i]	}		for (var x=0; x<temp_opts.length-1; x++) {		for (var y=(x +1); y<temp_opts.length; y++) {			if (temp_opts[x].text > temp_opts[y].text) {				temp = temp_opts[x].text				temp_opts[x].text = temp_opts[y].text				temp_opts[y].text = temp				temp = temp_opts[x].value				temp_opts[x].value = temp_opts[y].value				temp_opts[y].value = temp				}			}	}	for (var i=0; i<list.options.length; i++) {		list.options[i].value = temp_opts[i].value		list.options[i].text = temp_opts[i].text	}}	function check_dateRange(date1, date2, fldlabel1, fldlabel2){	tmpdate = getDate(date1)	tmpdate2 = getDate(date2)	if (tmpdate2 < tmpdate) {		//alert("Semak semula tarikh \nTarikh Akhir tidak boleh sebelum Tarikh Mula")		//alert("Semak semula tarikh \n"+fldlabel1+" tidak boleh sebelum "+fldlabel2)		alert("Re-check date\n" +fldlabel1+" cannot be before "+fldlabel2)		return false;	}		return true}function check_dateFormat(date1) { if (date1 != "")   {	var date_len = date1.length;	if (date_len > 10 || date_len < 10)	{		alert("Masukkan semula tarikh seperti format berikut hh/bb/tttt  \n07/02/2004");		return false;	}			if ((Instr(date1,"/") == -1))		{			alert("Masukkan semula tarikh seperti format berikut hh/bb/tttt \n07/02/2004");			return false;			}		}		return true;	}function check_timeRange(date1, date2, time1, time2, fldlabel1, fldlabel2){	tmpdatetime = getDateTime(date1,time1)	tmpdatetime2 = getDateTime(date2, time2)		if (tmpdatetime2 < tmpdatetime) {			//alert("Semak semula Tarikh dan Masa \n"+fldlabel1 + " tidak boleh sebelum "+ fldlabel2)		alert("Check Date and Time \n"+fldlabel1 + " cannot be earlier than "+ fldlabel2)		return false;	}		return true}function compare_todaydate(date1){	if (isValidDate(date1)) {		//tmpdate = getDate(date1)		today=new Date()		tday = today.getDate()		tmth = today.getMonth()		tyr = today.getFullYear()		//alert("tday " + tday)		//alert("tmth " + tmth)		//alert("tyr " + tyr)		date2 = tday + "/" + (parseFloat(tmth) + 1)  + "/" + tyr		//alert("date 1 -" + date1)		//alert("date2 - " + date2)		todayz = new Date(date2)		tmpdate = new Date(date1)				//alert("tmpdate " + tmpdate)		//alert("today " + todayz)			if (todayz > tmpdate) {				//alert("Semak semula tarikh \nTarikh tidak boleh sebelum hari ini")				alert("Re-check date \n Date cannot be before than today")				return false;			}			else			return true	}	else			return false				}function compare_todaydatetime(date1,time1){		if (isValidTime(time1)) { 		tmpdatetime = getDateTime(date1,time1)		//Set the two dates			today=new Date()			if (today.getTime() > tmpdatetime) {		//	alert("Semak semula Tarikh dan Masa \nTarikh dan Masa tidak boleh sebelum Tarikh dan Masa semasa.")			alert("Re-check Date and Time \nDate and Time cannot be before current Date and Time.")			return false;		}			else			return true		}	else		return false	}function getDateTime(tmpdate,tmptime){	cday = parseInt(tmpdate.substring(0, 2),10);	cmth = parseInt(tmpdate.substring(3, 5),10);	cyr = parseInt(tmpdate.substring(6,10),10);	var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;	var matchArray = tmptime.match(timePat);		hour = matchArray[1];	minute = matchArray[2];	second = matchArray[4];	ampm = matchArray[6];	if ((ampm == "pm") || (ampm == "PM")) {		if (hour != "12") {					hour = parseFloat(hour) + 12 					}					}		var dtdate=new Date() 	dtdate.setMonth(cmth - 1) //Month is 0-11 in JavaScript	dtdate.setFullYear(cyr)	dtdate.setDate(cday)	dtdate.setHours(hour)	dtdate.setMinutes(minute)	dtdate.setSeconds(second)		return dtdate.getTime()	}function getDate(tmpdate){	cday = parseInt(tmpdate.substring(0, 2), 10);	cmth = parseInt(tmpdate.substring(3, 5), 10);	cyr = parseInt(tmpdate.substring(6, 10), 10);		var dtdate=new Date() 	dtdate.setMonth(cmth - 1) //Month is 0-11 in JavaScript	dtdate.setFullYear(cyr)	dtdate.setDate(cday)		return dtdate.getTime()}function getMouseX(e) {	var IE = document.all?true:false;	var tempX = 0;	if (IE) {		tempX = event.clientX + document.body.scrollLeft+5;	}	else {			tempX = e.pageX+5;	}  	if (tempX < 0){tempX = 0;}		return tempX}function dayz(tmpdate) {cday = parseInt(tmpdate.substring(0, 2), 10);cmth = parseInt(tmpdate.substring(3, 5), 10);cyr = parseInt(tmpdate.substring(6, 10), 10);jdate = new Date()jdate.setMonth(cmth - 1) //Month is 0-11 in JavaScriptjdate.setFullYear(cyr)jdate.setDate(cday)var myDays= //["Ahad","Isnin","Selasa","Rabu","Khamis","Jumaat","Sabtu","Ahad"]["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]thisDay = jdate.getDay()return myDays[thisDay]}function getQueryValue(orgStr,fldName,sep){	var startpos;	var endpos;	var subval;	startpos = orgStr.indexOf(fldName)	subval = orgStr.substr(startpos,orgStr.length)		endpos = subval.indexOf(sep)	if ( endpos == -1 ) {	subval = subval.substr(subval.indexOf("=")+1, subval.length - (subval.indexOf("=")+1))	} else {	subval = subval.substr(subval.indexOf("=")+1,endpos - (subval.indexOf("=")+1))	}	return subval}//Example//setCookie("UserName", document.forms[0].Username.value);function setCookie(name, value, expires, path, domain, secure){	document.cookie = name + "=" + escape(value) +							// ((expires) ? "; expires=" + expires : "") +							 ((expires) ? "; expires=" + "Saturday, 03-Apr-2010 08:00:00 GMT" : "") +							 ((path) ? "; path=" + path : "") +							 ((domain) ? "; domain=" + domain : "") +							 ((secure) ? "; secure" : "");}//Example//var userName = getCookie("UserName");function getCookie(name){	var cookie = " " + document.cookie;	var search = " " + name + "=";	var setStr = null;	var offSet = 0;	var end = 0;		if (cookie.length > 0)	{		offSet = cookie.indexOf(search);		if (offSet != -1)		{			offSet += search.length;			end = cookie.indexOf(";", offSet);			if (end == -1)			{				end = cookie.length;			}			setStr = unescape(cookie.substring(offSet, end));		}	}	return setStr;}function DeleteCookie (name) {  	var exp = new Date();  	exp.setTime (exp.getTime() - 1);  	document.cookie = name + "=null" + "; expires=" + exp.toGMTString();}var ie4=document.allvar ns6=document.getElementById&&!document.allvar disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)//This function is used for the dynamic menu on the headeractivateMenu = function(nav) {    /* currentStyle restricts the Javascript to IE only */	if (document.all && document.getElementById(nav).currentStyle) {  		var navroot = document.getElementById(nav);        /* Get all the list items within the menu */        var lis=navroot.getElementsByTagName("LI");  		for (i=0; i<lis.length; i++) {            /* If the LI has another menu level */            if(lis[i].lastChild.tagName=="UL"){                /* assign the function to the LI */             	lis[i].onmouseover=function() {		                   /* display the inner menu */                   this.lastChild.style.display="block";                  // this.lastChild.style.visibility="show";                  }				lis[i].onmouseout=function() {                       //delayhide=setTimeout("function()",disappeardelay)                                           this.lastChild.style.display="none";                //    this.lastChild.style.visibility="hide";                    				}            }		}	}	else if( document.getElementById(nav).style) 	{		var navroot = document.getElementById(nav);        /* Get all the list items within the menu */        var lis=navroot.getElementsByTagName("LI");  		for (i=0; i<lis.length; i++) {            /* If the LI has another menu level */            if(lis[i].lastChild.tagName=="UL"){                /* assign the function to the LI */             	lis[i].onmouseover=function() {		                   /* display the inner menu */                    this.lastChild.style.display="block";                    }				lis[i].onmouseout=function() {                       				this.lastChild.style.display="none";				}            }		}		}		}function delayhidemenu(){	alert("IN")	if (ie4||ns6)		delayhide=setTimeout("function()",disappeardelay)}function clearhidemenu(){if (typeof delayhide!="undefined")clearTimeout(delayhide)}var frm;var sep;			// this variable is used to define separator for multi-value field;//displaytable(tablename,rowfieldname,columnfieldname,columnsizename,inputtextname,inputsizename, initialcolumncounter)// use tablename as unique key. <tablenamecol>+column+<row>+rowfunction DisplayTable(tablename, rowName, colName, cSizeName, IptTextName, IptSizeName, cur_dbpath) {	frm = window.document.forms[0];	sep = "; ";	var sign1 = ";";	//predefined value at  the form	var rowNo = parseInt(eval("frm."+rowName +".value"));	var columnNo = parseInt(eval("frm." + colName + ".value"));	var size =  eval("frm." + cSizeName +".value.split(sep)");   //column size	var inputType = eval("frm." + IptTextName + ".value.split(sep)"); // type of input	var inputSize = eval("frm." + IptSizeName + ".value.split(sep)"); //input size			var dbpath = cur_dbpath		//############Table Header section##############	  	H0 = "<TABLE WIDTH=100% BGCOLOR='black' BORDER=0 CELLSPACING=1 CELLPADDING=1><TR BGCOLOR='5291EF'>";  	H1 = "<TD class='formHeader' WIDTH=5%></TD>";  	H2 = "<TD class='formHeader' WIDTH=5%>No</TD>";	H = ""		m = 0  	for (i=1; i<=columnNo; i++) {	 	H = H+"<TD class='formHeader' WIDTH=" + size[m] + "%>"+eval("frm." + tablename+"column"+i+".title")+"</TD>";	 	m = m +1   	}  	  	if (isDocBeingEdited()!=true  || (isDocBeingEdited()==true && frm.STATUS.value == "04"))  		data = H0 + H2 + H+"</TR>";	else		data = H0 + H1 + H2 + H + "</TR>"		//#############End of Table Header section##########		//#############Table Content section ##############		for (i=0; i<=rowNo; i++) {					newrow = "<TR BGCOLOR=#FFFFFF >"		R1 = newrow + "<TD class='formContentData' VALIGN=middle><INPUT TYPE=checkbox NAME='DeleteRow" + tablename+i+ "' VALUE='1'" +getChk(0)+ " style='border=0'></TD>";  		R2 = "<TD class='formContentData' WIDTH=5%>" +eval(i+1) + "</TD>";		R = ""				m = 0	  	for (y=1; y<=columnNo; y++) {					tmpType = inputType[m]						if (isDocBeingEdited()!=true || (isDocBeingEdited()==true && frm.STATUS.value == "04")){				R = R + "<TD class='formContentData' WIDTH=" + size[m] + "%>"+checkValue(eval("frm."+tablename+"column"+y+".value.split(sep)["+i+"]"))+"</TD>";					}							else {						  			switch (tmpType) {	  			case "Date-Text":	  				//date picker					R = R + "<TD class='formContentData' WIDTH=" + size[m] +">&nbsp<INPUT ID='"+eval("frm." + tablename +"column"+y+".id")+"Row"+i+ "' VALUE='" +checkValue(eval("frm." + tablename +"column"+y+".value.split(sep)["+i+"]"))+ "' SIZE=" + inputSize[m] + ">";						R = R + "<img src=\"" +dbpath + "/vwicn063.gif?OpenImageResource\" width=\"13\" height=\"11\" alt=\"Pilih Tarikh\" onclick=\"dxcal(this, document.getElementById('" + eval("frm." + tablename +"column"+y+".id")+"Row"+i + "'), 'dd/mm/yyyy')\";"					R = R + " onmouseover=\" this.style.cursor='hand' \" onmouseout=\"this.style.cursor='default'\"></TD>" 				break;				case "Address-Text":							// address picker					R = R + "<TD class='formContentData' WIDTH=" + size[m] + ">&nbsp<INPUT ID='"+eval("frm." + tablename +"column"+y+".id")+"Row"+i+"' VALUE='" +checkValue(eval("frm." + tablename +"column"+y+".value.split(sep)["+i+"]"))+ "' READONLY SIZE=" + inputSize[m] + ">";						R = R + "<img src=\"" +dbpath + "/add_picker.jpeg?OpenImageResource\" width=\"19\" height=\"17\" alt=\"Pilih Anggota\" onclick=\"fncAddressPickerSingle('" + eval("frm." + tablename +"column"+y+".id")+"Row"+i + "')\";"					R = R + " onmouseover=\" this.style.cursor='hand' \" onmouseout=\"this.style.cursor='default'\"></TD>" 							break;						case "Text":					//normal text															R = R + "<TD class='formContentData' WIDTH=" + size[m]+"%> &nbsp<INPUT NAME='"+eval("frm." + tablename +"column"+y+".id")+"Row"+i+"' VALUE='" +checkValue(eval("frm." + tablename +"column"+y+".value.split(sep)["+i+"]"))+ "' SIZE=" + inputSize[m] + "></TD>";				  							   	 break;							case "Text-ReadOnly":					//normal text													R = R + "<TD class='formContentData' WIDTH=" + size[m]+"%> &nbsp<INPUT NAME='"+eval("frm." + tablename +"column"+y+".id")+"Row"+i+"' VALUE='" +checkValue(eval("frm." + tablename +"column"+y+".value.split(sep)["+i+"]"))+ "' READONLY SIZE=" + inputSize[m] + "></TD>";				  							   	 break;									case "Textarea":					//textarea					TA = checkValue(eval("frm." + tablename +"column"+y+".value.split(sep)["+i+"]"))												R = R + "<TD class='formContentData' WIDTH="+ size[m] + "%><TEXTAREA NAME='"+eval("frm." + tablename +"column"+y+".id")+"Row"+i+"' " + inputSize[m] + " STYLE=\"font-family:arial ; font-size:9pt\" >" +  TA.replace(/#/g, sign1)+ "</TEXTAREA></TD>";					break;								case "Dropdown":					//normal text	  							   	 R += "<TD class='formContentData'>"				   	 R +="<SELECT NAME='"+eval("frm." + tablename +"column"+y+".id")+"Row"+i+ "'>"				   	 var tvalue = checkValue(eval("frm." + tablename +"column"+y+".value.split(sep)["+i+"]"))					len = eval("frm." + tablename +"listValue"+y+".length")					//empty value					R += "<OPTION VALUE=''>"					if (len > 0) {										for (b=0; b < len; b++) {												tmpvalue = eval("frm." + tablename +"listValue" + y +".options[b].text")							if (tmpvalue == tvalue) {								R += "<OPTION VALUE='" + tmpvalue + "' SELECTED>" +  tmpvalue 								}							else { 								R += "<OPTION VALUE='" +  tmpvalue + "'>" +  tmpvalue								}					}				}					R += "</SELECT></TD>"				break;										case "Button":					//normal text					R = R + "<TD class='formContentData'> &nbsp<INPUT NAME='"+eval("frm." + tablename +"column"+y+".id")+"Row"+i+ "' VALUE='" +checkValue(eval("frm." + tablename +"column"+y+".value.split(sep)["+i+"]"))+ "' SIZE=" + inputSize[m] + "></TD>";				  							   	 break;					case "Radio":					eval("var container = frm.listValue"+y+".value.split(';')")					R = R + "<TD class='formContentData'>"					for ( var j = 0 ; j < container.length; j++){					 		if ( checkValue(eval("frm." + tablename +"column"+y+".value.split(sep)["+i+"]")) ==  container[j] ) 							R = R + "<INPUT Type = 'radio' NAME='"+eval("frm." + tablename +"column"+y+".id")+"Row"+i+ "' VALUE='" +container[j]+ "' checked >"+container[j] + "<br>";				  								 		else							R = R + "<INPUT Type = 'radio' NAME='"+eval("frm." + tablename +"column"+y+".id")+"Row"+i+ "' VALUE='" +container[j]+ "' >"+container[j] + "<br>";				  								}					R = R + "</TD>"					break;														default:						}				}				m = m + 1			}						if (isDocBeingEdited()!=true || (isDocBeingEdited()==true && frm.STATUS.value == "04"))  	  			data = data + R2 + R+"</TR>";  	  		else  	  			data = data + R1 + R2 + R+"</TR>";  			  	}  	//#############End of Table Content section##############    	data = data + "</TABLE>";  //	alert (data)	if (document.layers) {  		document.layers.cust.document.write(data);  		document.layers.cust.document.close();  	}  	else {		if (document.all) {			table = eval(tablename);			table.innerHTML = data;		}  	}}function checkValue(fldvalue) {	if (fldvalue == "~" || fldvalue == "undefined" || fldvalue == null) { return "-"; }	else { return fldvalue; }}function setText(fldname, index, inputType) {	var form = "document.forms[0].";  	var fldvalue = "";		switch (inputType) {			case "Text":		case "Textarea":		case "Address-Text":		case "Date-Text":		case "Text-ReadOnly":			fldvalue = eval( form+fldname+index+ ".value");			break;		    case "Radio":			for (z = 0 ; z < eval(form+fldname+index+".length") ;z ++ ) {				if ( eval(form+fldname+index+"["+z+"].checked") ) {					fldvalue = eval(form+fldname+index+"["+z+"].value")					break;				}			}				break;    			case "Dropdown":			fldvalue = eval( form+fldname+index+ ".options[" +form+fldname+index+ ".selectedIndex].text");			break;		default: alert("noneoftheabove");break		}		if (fldvalue == "" || fldvalue == null) { fldvalue = "-"; }	return fldvalue;}function DeleteRow(tablename, rowName, colName, cSizeName, IptTextName, IptSizeName) {	var sep = "; ";		var frm = document.forms[0];	var form = "document.forms[0].";		var row = parseInt(eval("frm." + rowName + ".value"));	var columnNo = parseInt(eval("frm." + colName +".value"));	var dataType = eval("frm." + IptTextName + ".value.split(sep)")	var column = ""	var separator = "";	var flag = "";	var count = 0;	for (y=1; y<= columnNo ; y++) {		eval("var "+ tablename+"column"+(y)+"= \"\"");	}		for (x=0; x <= row; x++) {		z = 0		flag =	eval(form+"DeleteRow"+ tablename + x+".checked");//		alert("DeleteRow" + x)		if (flag) {			count = count + 1;		}		else {			for (y=1; y <= columnNo ; y++) {				value0 = setTextV2(eval("frm."+tablename+"column"+y+".id")+"Row", x, dataType[z])				value1 = eval("separator + value0")				eval(tablename+"column"+(y)+"= "+tablename+"column"+(y) + "+value1");				z += 1			}		separator = sep;		}	} // end for x		for (y=1; y <= columnNo; y++) {		eval("frm."+tablename+"column"+y+".value="+ tablename+"column"+y)	}		eval("frm." + rowName +".value = parseInt(frm." + rowName + ".value) - count ");		DisplayTableV2(tablename, rowName, colName, cSizeName, IptTextName, IptSizeName);}function SaveValue(tablename,rowName, colName, IptTextName) {	var sep = "; ";	var frm = document.forms[0];	var row = parseInt(eval("frm." + rowName + ".value"));	var columnNo = parseInt(eval("frm." + colName + ".value"));	var dataType = eval("frm." + IptTextName + ".value.split(sep)")	var column = ""		for (x = 0; x <= row; x++) {		z = 0		for (y=1; y <= columnNo; y++) {				if (x == 0) { //row = 0		column = setTextV2(eval("frm." + tablename +"column"+y+".id")+"Row", x, dataType[z]);		}				else {		column = eval("frm." + tablename +"columnValue"+y+".value")		column =  column + sep + setTextV2(eval("frm." + tablename +"column"+y+".id")+"Row", x, dataType[z]);				}		eval("frm." + tablename +"columnValue"+y+".value = column"); //store value in form		eval("frm." + tablename +"column"+y+".value = column");  // table		z += 1	//	alert("###VALUE STORE "+tablename + "columnValue"+ y + " -> " + eval("frm." + tablename +"columnValue"+y+".value"))	}	}}function getChk(k) {	if (k==1) 	{		return 'Checked'	}	else {		return 	}}function clock() {if (!document.layers && !document.all) return;var digital = new Date();var hours = digital.getHours();var minutes = digital.getMinutes();var seconds = digital.getSeconds();var amOrPm = "AM";if (hours > 11) amOrPm = "PM";if (hours > 12) hours = hours - 12;if (hours == 0) hours = 12;if (minutes <= 9) minutes = "0" + minutes;if (seconds <= 9) seconds = "0" + seconds;dispTime = hours + ":" + minutes + ":" + seconds + " " + amOrPm;if (document.layers) {document.layers.tickclock.document.write(dispTime);document.layers.tickclock.document.close();}elseif (document.all)tickclock.innerHTML = dispTime;setTimeout("clock()", 1000);}//================>new calendarfunction show_calendar2(str_target, str_datetime,calformat,calseparator,thispath) {	var arr_months = ["January", "February", "March", "April", "May", "June",		"July", "August", "September", "October", "November", "December"];	var week_days = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];	var n_weekstart = 1; // day week starts from (normally 0 or 1)	var dt_datetime = (str_datetime == null || str_datetime =="" ?  new Date() : str2dt2(str_datetime,calformat,calseparator,thispath));	var getday = dt_datetime.getDate();	var myday = getday.toString();	var dt_prev_month = new Date(dt_datetime);	dt_prev_month.setMonth(dt_datetime.getMonth()-1);	if (dt_datetime.getMonth()%12 != (dt_prev_month.getMonth()+1)%12) {		dt_prev_month.setMonth(dt_datetime.getMonth());		dt_prev_month.setDate(0);	}	var dt_next_month = new Date(dt_datetime);	dt_next_month.setMonth(dt_datetime.getMonth()+1);	if ((dt_datetime.getMonth() + 1)%12 != dt_next_month.getMonth()%12)		dt_next_month.setDate(0);		var dt_firstday = new Date(dt_datetime);	dt_firstday.setDate(1);	dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);	var dt_lastday = new Date(dt_next_month);	dt_lastday.setDate(0);		// html generation (feel free to tune it for your particular application)	// print calendar header	var str_buffer = new String (		"<html>\n"+		"<head>\n"+		"<title>Calendar</title>\n"+		"</head>\n"+		"<style type=\"text/css\">\n"+		".srch_option	{color: #000000; font-size: 11px; text-decoration: none;}\n"+		"</style>\n"+		"<body bgcolor=\"White\">\n"+		"<form name=\"frmCalendar\" method=\"post\">\n"+		"<table class=\"clsOTable\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n"+		"<tr><td bgcolor=\"#4682B4\">\n"+		"<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+		"<tr>\n	<td bgcolor=\"#4682B4\"><a href=\"javascript:window.opener.show_calendar2('"+		str_target+"', '"+ dt2dtstr2(dt_prev_month,calformat,calseparator,thispath)+"','"+		calformat+"','"+calseparator+"','"+thispath+"');\">"+		"<img src=\"/" + thispath + "/prev.gif\" width=\"16\" height=\"16\" border=\"0\""+		" alt=\"previous month\"></a></td>\n");				var y = 1900;		var yearopt;		for(c=0; c < 200; c++){		y = y + 1;		if (dt_datetime.getFullYear() != y) {		yearopt = yearopt + "<option value=\"" + y +"\">" + y + "</option>\n"		} 		else { 		if (dt_datetime.getFullYear() == y) {		yearopt = yearopt + "<option value=\"" + y +"\" selected>" + y + "</option>\n"		}		}		}					var caloption;		if (dt_datetime.getMonth() == 0) {			caloption = "<option value=\"1\" selected>January</option>\n"+			"<option value=\"2\">February</option>\n"+			"<option value=\"3\">March</option>\n"+			"<option value=\"4\">April</option>\n"+			"<option value=\"5\">May</option>\n"+			"<option value=\"6\">June</option>\n"+			"<option value=\"7\">July</option>\n"+			"<option value=\"8\">August</option>\n"+			"<option value=\"9\">September</option>\n"+			"<option value=\"10\">October</option>\n"+			"<option value=\"11\">November</option>\n"+			"<option value=\"12\">December</option>\n"+			"</select>"			} 		if (dt_datetime.getMonth() == 1) {			caloption = "<option value=\"1\">January</option>\n"+			"<option value=\"2\" selected>February</option>\n"+			"<option value=\"3\">March</option>\n"+			"<option value=\"4\">April</option>\n"+			"<option value=\"5\">May</option>\n"+			"<option value=\"6\">June</option>\n"+			"<option value=\"7\">July</option>\n"+			"<option value=\"8\">August</option>\n"+			"<option value=\"9\">September</option>\n"+			"<option value=\"10\">October</option>\n"+			"<option value=\"11\">November</option>\n"+			"<option value=\"12\">December</option>\n"+			"</select>"			} 		if (dt_datetime.getMonth() == 2) {			caloption = "<option value=\"1\">January</option>\n"+			"<option value=\"2\">February</option>\n"+			"<option value=\"3\" selected>March</option>\n"+			"<option value=\"4\">April</option>\n"+			"<option value=\"5\">May</option>\n"+			"<option value=\"6\">June</option>\n"+			"<option value=\"7\">July</option>\n"+			"<option value=\"8\">August</option>\n"+			"<option value=\"9\">September</option>\n"+			"<option value=\"10\">October</option>\n"+			"<option value=\"11\">November</option>\n"+			"<option value=\"12\">December</option>\n"+			"</select>"			} 		if (dt_datetime.getMonth() == 3) {			caloption = "<option value=\"1\">January</option>\n"+			"<option value=\"2\" >February</option>\n"+			"<option value=\"3\">March</option>\n"+			"<option value=\"4\" selected>April</option>\n"+			"<option value=\"5\">May</option>\n"+			"<option value=\"6\">June</option>\n"+			"<option value=\"7\">July</option>\n"+			"<option value=\"8\">August</option>\n"+			"<option value=\"9\">September</option>\n"+			"<option value=\"10\">October</option>\n"+			"<option value=\"11\">November</option>\n"+			"<option value=\"12\">December</option>\n"+			"</select>"			} 		if (dt_datetime.getMonth() == 4) {			caloption = "<option value=\"1\">January</option>\n"+			"<option value=\"2\">February</option>\n"+			"<option value=\"3\">March</option>\n"+			"<option value=\"4\">April</option>\n"+			"<option value=\"5\" selected>May</option>\n"+			"<option value=\"6\">June</option>\n"+			"<option value=\"7\">July</option>\n"+			"<option value=\"8\">August</option>\n"+			"<option value=\"9\">September</option>\n"+			"<option value=\"10\">October</option>\n"+			"<option value=\"11\">November</option>\n"+			"<option value=\"12\">December</option>\n"+			"</select>"			} 		if (dt_datetime.getMonth() == 5) {			caloption = "<option value=\"1\">January</option>\n"+			"<option value=\"2\">February</option>\n"+			"<option value=\"3\">March</option>\n"+			"<option value=\"4\">April</option>\n"+			"<option value=\"5\">May</option>\n"+			"<option value=\"6\" selected>June</option>\n"+			"<option value=\"7\">July</option>\n"+			"<option value=\"8\">August</option>\n"+			"<option value=\"9\">September</option>\n"+			"<option value=\"10\">October</option>\n"+			"<option value=\"11\">November</option>\n"+			"<option value=\"12\">December</option>\n"+			"</select>"			} 		if (dt_datetime.getMonth() == 6) {			caloption = "<option value=\"1\">January</option>\n"+			"<option value=\"2\">February</option>\n"+			"<option value=\"3\">March</option>\n"+			"<option value=\"4\">April</option>\n"+			"<option value=\"5\">May</option>\n"+			"<option value=\"6\">June</option>\n"+			"<option value=\"7\" selected>July</option>\n"+			"<option value=\"8\">August</option>\n"+			"<option value=\"9\">September</option>\n"+			"<option value=\"10\">October</option>\n"+			"<option value=\"11\">November</option>\n"+			"<option value=\"12\">December</option>\n"+			"</select>"			} 		if (dt_datetime.getMonth() == 7) {			caloption = "<option value=\"1\">January</option>\n"+			"<option value=\"2\">February</option>\n"+			"<option value=\"3\">March</option>\n"+			"<option value=\"4\">April</option>\n"+			"<option value=\"5\">May</option>\n"+			"<option value=\"6\">June</option>\n"+			"<option value=\"7\">July</option>\n"+			"<option value=\"8\" selected>August</option>\n"+			"<option value=\"9\">September</option>\n"+			"<option value=\"10\">October</option>\n"+			"<option value=\"11\">November</option>\n"+			"<option value=\"12\">December</option>\n"+			"</select>"			} 		if (dt_datetime.getMonth() == 8) {			caloption = "<option value=\"1\">January</option>\n"+			"<option value=\"2\">February</option>\n"+			"<option value=\"3\">March</option>\n"+			"<option value=\"4\">April</option>\n"+			"<option value=\"5\">May</option>\n"+			"<option value=\"6\">June</option>\n"+			"<option value=\"7\">July</option>\n"+			"<option value=\"8\">August</option>\n"+			"<option value=\"9\" selected>September</option>\n"+			"<option value=\"10\">October</option>\n"+			"<option value=\"11\">November</option>\n"+			"<option value=\"12\">December</option>\n"+			"</select>"			} 		if (dt_datetime.getMonth() == 9) {			caloption = "<option value=\"1\">January</option>\n"+			"<option value=\"2\">February</option>\n"+			"<option value=\"3\">March</option>\n"+			"<option value=\"4\">April</option>\n"+			"<option value=\"5\">May</option>\n"+			"<option value=\"6\">June</option>\n"+			"<option value=\"7\">July</option>\n"+			"<option value=\"8\">August</option>\n"+			"<option value=\"9\">September</option>\n"+			"<option value=\"10\" selected>October</option>\n"+			"<option value=\"11\">November</option>\n"+			"<option value=\"12\">December</option>\n"+			"</select>"			} 		if (dt_datetime.getMonth() == 10) {			caloption = "<option value=\"1\">January</option>\n"+			"<option value=\"2\">February</option>\n"+			"<option value=\"3\">March</option>\n"+			"<option value=\"4\">April</option>\n"+			"<option value=\"5\">May</option>\n"+			"<option value=\"6\">June</option>\n"+			"<option value=\"7\">July</option>\n"+			"<option value=\"8\">August</option>\n"+			"<option value=\"9\">September</option>\n"+			"<option value=\"10\">October</option>\n"+			"<option value=\"11\" selected>November</option>\n"+			"<option value=\"12\">December</option>\n"+			"</select>"			} 		if (dt_datetime.getMonth() == 11) {			caloption = "<option value=\"1\">January</option>\n"+			"<option value=\"2\">February</option>\n"+			"<option value=\"3\">March</option>\n"+			"<option value=\"4\">April</option>\n"+			"<option value=\"5\">May</option>\n"+			"<option value=\"6\">June</option>\n"+			"<option value=\"7\">July</option>\n"+			"<option value=\"8\">August</option>\n"+			"<option value=\"9\">September</option>\n"+			"<option value=\"10\">October</option>\n"+			"<option value=\"11\">November</option>\n"+			"<option value=\"12\" selected>December</option>\n"+			"</select>"			}					str_buffer += "<td colspan=\"5\"><select name=\"tbSelMonth\" class=\"srch_option\" onChange=\"javascript:fUpdates(this.form.tbSelYear.value,this.form.tbSelMonth.value,'" + calformat + "','" + calseparator + "','" + myday + "','" + str_target + "','" + thispath + "');\n"+  "function fUpdates(iYear, iMonth,calformat,calseparator,dt_datetime2,str_target,thispath){\n"+"var ndate;\n"+"var nday = dt_datetime2;\n"+"if ((calseparator == &quot;/&quot;) && (calformat == &quot;d&quot;)) {\n"+"ndate = nday + &quot;/&quot; + iMonth + &quot;/&quot; + iYear\n"+"window.opener.show_calendar2('"+str_target+"',ndate,calformat,calseparator,thispath);\n"+" }\n"+"if ((calseparator == &quot;-&quot;) && (calformat == &quot;d&quot;)) {\n"+"ndate = nday + &quot;/&quot; + iMonth + &quot;/&quot; + iYear\n"+"window.opener.show_calendar2('"+str_target+"',ndate,calformat,calseparator,thispath);\n"+" }\n"+"if ((calseparator == &quot;/&quot;) && (calformat == &quot;m&quot;)) {\n"+"ndate = iMonth + &quot;/&quot; + nday + &quot;/&quot; + iYear\n"+"window.opener.show_calendar2('"+str_target+"',ndate,calformat,calseparator,thispath);\n"+" }\n"+"if ((calseparator == &quot;-&quot;) && (calformat == &quot;m&quot;)) {\n"+"ndate = iMonth + &quot;/&quot; + nday + &quot;/&quot; + iYear\n"+"window.opener.show_calendar2('"+str_target+"',ndate,calformat,calseparator,thispath);\n"+" }\n"+"}\n"+"\">\n"+caloption+"\n"+				"<select name=\"tbSelYear\" class=\"srch_option\" onChange=\"javascript:fUpdatesYear(this.form.tbSelYear.value,this.form.tbSelMonth.value,'" + calformat + "','" + calseparator + "','" + myday + "','" + str_target + "','" + thispath + "');\n"+  "function fUpdatesYear(iYear, iMonth,calformat,calseparator,dt_datetime2,str_target,thispath){\n"+"var ndate;\n"+"var nday = dt_datetime2;\n"+"if ((calseparator == &quot;/&quot;) && (calformat == &quot;d&quot;)) {\n"+"ndate = nday + &quot;/&quot; + iMonth + &quot;/&quot; + iYear\n"+"window.opener.show_calendar2('"+str_target+"',ndate,calformat,calseparator,thispath);\n"+" }\n"+"if ((calseparator == &quot;-&quot;) && (calformat == &quot;d&quot;)) {\n"+"ndate = nday + &quot;/&quot; + iMonth + &quot;/&quot; + iYear\n"+"window.opener.show_calendar2('"+str_target+"',ndate,calformat,calseparator,thispath);\n"+" }\n"+"if ((calseparator == &quot;/&quot;) && (calformat == &quot;m&quot;)) {\n"+"ndate = iMonth + &quot;/&quot; + nday + &quot;/&quot; + iYear\n"+"window.opener.show_calendar2('"+str_target+"',ndate,calformat,calseparator,thispath);\n"+" }\n"+"if ((calseparator == &quot;-&quot;) && (calformat == &quot;m&quot;)) {\n"+"ndate = iMonth + &quot;/&quot; + nday + &quot;/&quot; + iYear\n"+"window.opener.show_calendar2('"+str_target+"',ndate,calformat,calseparator,thispath);\n"+" }\n"+"}\n"+"\">\n"+yearopt+"\n"+			"</select>\n"+						"</td>\n"+					"	<td bgcolor=\"#4682B4\" align=\"right\"><a href=\"javascript:window.opener.show_calendar2('"		+str_target+"', '"+dt2dtstr2(dt_next_month,calformat,calseparator,thispath)+"','"+		calformat+"','"+calseparator+"','"+thispath+"');\">"+		"<img src=\"/" + thispath + "/next.gif\" width=\"16\" height=\"16\" border=\"0\""+		" alt=\"next month\"></a></td>\n</tr>\n"		var dt_current_day = new Date(dt_firstday);	// print weekdays titles	str_buffer += "<tr>\n";	for (var n=0; n<7; n++)		str_buffer += "	<td bgcolor=\"#87CEFA\">"+		"<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">"+		week_days[(n_weekstart+n)%7]+"</font></td>\n";	// print calendar table	str_buffer += "</tr>\n";	while (dt_current_day.getMonth() == dt_datetime.getMonth() ||		dt_current_day.getMonth() == dt_firstday.getMonth()) {		// print row heder		str_buffer += "<tr>\n";		for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {				if (dt_current_day.getDate() == dt_datetime.getDate() &&					dt_current_day.getMonth() == dt_datetime.getMonth())					// print current date					str_buffer += "	<td bgcolor=\"#FFB6C1\" align=\"right\">";				else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)					// weekend days					str_buffer += "	<td bgcolor=\"#DBEAF5\" align=\"right\">";				else					// print working days of current month					str_buffer += "	<td bgcolor=\"white\" align=\"right\">";				if (dt_current_day.getMonth() == dt_datetime.getMonth())					// print days of current month					str_buffer += "<a href=\"javascript:window.opener."+str_target+					".value='"+dt2dtstr2(dt_current_day,calformat,calseparator,thispath)+"'; window.close();\">"+					"<font color=\"black\" face=\"tahoma, verdana\" size=\"2\">";				else 					// print days of other months					str_buffer += "<a href=\"javascript:window.opener."+str_target+					".value='"+dt2dtstr2(dt_current_day,calformat,calseparator,thispath)+"'; window.close();\">"+					"<font color=\"gray\" face=\"tahoma, verdana\" size=\"2\">";				str_buffer += dt_current_day.getDate()+"</font></a></td>\n";				dt_current_day.setDate(dt_current_day.getDate()+1);		}		// print row footer		str_buffer += "</tr>\n";	}	// print calendar footer	str_buffer +=		"</table>\n" +		"</tr>\n</td>\n</table>\n" +		"</form>\n" +		"</body>\n" +		"</html>\n";		var vWinCal = window.open("", "Calendar", 		"width=250,height=250,status=no,resizable=yes,top=250,left=250");	vWinCal.opener = self;	vWinCal.focus();		var calc_doc = vWinCal.document;	calc_doc.write (str_buffer);	calc_doc.close();}// datetime parsing and formatting routimes. modify them if you wish other datetime formatfunction str2dt2 (str_datetime,calformat,calseparator,thispath) {	var mmonth;	var myear;	var mday;	if (calseparator == "/") {	var re_date = /^(\d+)\/(\d+)\/(\d+)$/;				if (!re_date.exec(str_datetime))		return alert("Invalid Datetime format: "+ str_datetime);				if (calformat == "d") {			mmonth = RegExp.$2-1;			myear = RegExp.$3;			mday = RegExp.$1;		} else {			mmonth = RegExp.$1-1;			myear = RegExp.$3;			mday = RegExp.$2;			}				return (new Date (myear, mmonth, mday));	}	else	{		if (calseparator == "-") {	var re_date = /^(\d+)-(\d+)-(\d+)$/;		if (!re_date.exec(str_datetime))		return alert("Invalid Datetime format: "+ str_datetime);				if (calformat == "d") {			mmonth = RegExp.$2-1;			myear = RegExp.$3;			mday = RegExp.$1;		} else {			mmonth = RegExp.$1-1;			myear = RegExp.$3;			mday = RegExp.$2;			}				return (new Date (myear, mmonth, mday));	}	}}function dt2dtstr2 (dt_datetime,calformat,calseparator,thispath) {	var vmonth = (dt_datetime.getMonth() + 1); 	var vday = dt_datetime.getDate();	var nmonth = vmonth.toString();	var nday = vday.toString();	if (nmonth.length < 2){             nmonth = ("0" + nmonth);             	}	if (nday.length < 2) {  	     nday = ("0" + nday);	}		if (calseparator == "-") {		if (calformat == "m") {		return (new String (			nmonth+"-"+nday+"-"+dt_datetime.getFullYear()));			return true;		} else {		return (new String (			vday+"-"+vmonth+"-"+dt_datetime.getFullYear()));			return true;  		}	} else {		if (calformat == "m") {		return (new String (			nmonth+"/"+nday+"/"+dt_datetime.getFullYear()));			return true;		} else {		return (new String (			nday+"/"+nmonth+"/"+dt_datetime.getFullYear()));			return true;  		}			}				}function replaceCReturn( strValue, single_char, char_replace ){ 	var strChar = ""	if ( strValue.indexOf( single_char ) != -1 )	{ 		for ( var i = 0; i < strValue.length; i++ )		{ 			if ( strValue.substring( i, i + 1 ) == single_char )				strChar = strChar + char_replace			else if ( strValue.substring( i, i + 1 ) == "\n" ) //remove unwanted space				""			else				strChar = strChar + strValue.substring( i, i + 1 )		}		return strChar	}	else		return strValue}function replaceCReturn2( strValue, char_replace ){ 	var strChar = ""//	if ( strValue.indexOf( single_char ) != -1 )//	{ 		for ( var i = 0; i < strValue.length; i++ )		{ 						if ( strValue.substring( i, i + 1 ) == "\n" ) //remove unwanted space				strChar = strChar + char_replace			else				strChar = strChar + strValue.substring( i, i + 1 )		}		return strChar//	}//	else//		return strValue}// hides <select> and <applet> objects (for IE only)function hideElementGen( elmID, overDiv ){	var ie=document.all;		if( ie ){			for( i = 0; i < document.all.tags( elmID ).length; i++ ){				obj = document.all.tags( elmID )[i];				if( !obj || !obj.offsetParent ){						continue;				}				  // Find the element's offsetTop and offsetLeft relative to the BODY tag.				  objLeft   = obj.offsetLeft;				  objTop    = obj.offsetTop;				  objParent = obj.offsetParent;				  while( objParent.tagName.toUpperCase() != "BODY" )				  {					objLeft  += objParent.offsetLeft;					objTop   += objParent.offsetTop;					objParent = objParent.offsetParent;				  }				  objHeight = obj.offsetHeight;				  objWidth = obj.offsetWidth;				  if(( overDiv.offsetLeft + overDiv.offsetWidth ) <= objLeft );				  else if(( overDiv.offsetTop + overDiv.offsetHeight ) <= objTop );				  else if( overDiv.offsetTop >= ( objTop + objHeight + obj.height ));				  else if( overDiv.offsetLeft >= ( objLeft + objWidth ));				  else				  {					obj.style.visibility = "hidden";				  }			}		}	}		 	//unhides <select> and <applet> objects (for IE only)	function showElementGen( elmID ){		var ie=document.all;			if( ie ){			for( i = 0; i < document.all.tags( elmID ).length; i++ ){				obj = document.all.tags( elmID )[i];				if( !obj || !obj.offsetParent ){						continue;				}				obj.style.visibility = "";			}		}	}function openDialogBoxWindowOpenURL( strPath, width, height, toolbar, scroll, resize ){			var u = strPath	var strOpener = "width=" + width + ",height=" + height + ",toolbar=" + toolbar + ",scrollbars=" + scroll + ",resizeable=" + resize		window.open( u, "" ,strOpener)	}