var xmlhttp;
var execd;
var phpresponse;

function getEvent(event) {
    return (event ? event : window.event);
}

function getEventElement(e) {
    return (e.srcElement ? e.srcElement : (e.target ? e.target : e.currentTarget));
}

//-------------------------------------------------------------------------------
function showHint()
{
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
	  alert ("Your browser does not support XMLHTTP!");
	  return;
	}

	document.getElementById("qstatus").innerHTML="Loading events... <img src='../../ajax/ajax-loader.gif'/>";
	var url="/education/ajax/gethint.php?";
	url=url+"sid="+Math.random();

	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);

	//emltest = GetXmlHttpObject();
	//emltest.open("GET","/education/ajax/emailnotif.php?action=load",true);
	//emltest.send(null);
	//Google Analytics (instead)
	_gaq.push(['_trackEvent', 'Timetable'	, 'Load' ]);
}
//-------------------------------------------------------------------------------
function stateChanged()
{
	if (xmlhttp.readyState==4) {
		//alert ( 'statechanged='+xmlhttp.readyState+'\nresponseText='+ xmlhttp.responseText);

		if ( xmlhttp.responseText != '' )
  		filterResults();	//no event filter tracking
  	else {
  		document.getElementById("qstatus").innerHTML="Server error - please try again later";
  		//TODO: create email notif to admin
  	}
  }
}


//-------------------------------------------------------------------------------
function GetXmlHttpObject()
{
	if (window.XMLHttpRequest) {
  	// code for IE7+, Firefox, Chrome, Opera, Safari
  	return new XMLHttpRequest();
  }

	if (window.ActiveXObject) {
  	// code for IE6, IE5
  	return new ActiveXObject("Microsoft.XMLHTTP");
  }

	return null;
}


var datelimit = new Date(2010,0,1);	//Jan 1, 2010
var daylimit  = new Date();					//today  (DEFAULT)
function togglePastTrainings() {
	if ( daylimit == datelimit ) 	{ daylimit = new Date();	tgstr = 'hide past'; } //today onwards
	else 													{ daylimit = datelimit;		tgstr = 'show past'; } //all possible trainings
	filterResults( tgstr);
}

//-------------------------------------------------------------------------------
function filterResults( filterName ) {

	var head;
	var notifvars = "";
	var buf = "";
	var myprograms = new Array();
	var mylevels = new Array();
	var mystreams = new Array();
	var mymodules = new Array();
	var mydates = new Array;
	var myplaces = new Array;
	var mycountries = new Array;
	var myformats = new Array;
	var mysdates = new Array;
	var myedates = new Array;
	var mystatuses = new Array;
	var inc = 0;
	var ecount = 0;

	//Columns of data elements passed back from php
	var col_type 						=	0;
	var col_program					=	1;
	var col_level						=	2;
	var col_stream					=	3;
	var col_module					=	4;
	var col_place						=	5;
	var col_country					=	6;
	var col_format					=	7;
	var col_sdate						=	8;
	var col_edate						=	9;
	var col_sdate2					=	10;
	var col_edate2					=	11;
	var col_sdate3					=	12;
	var col_edate3					=	13;
	var col_status					=	14;
	var col_name						=	15;
	var col_id							=	16;

	//var col_status					=	12;
	//var col_id							=	13;


	//alert('filterResults' );
	//alert( xmlhttp.responseText );

	var fltr_program	= '';
	var fltr_level 	  = '';
	var fltr_stream 	= '';
	var fltr_module 	= '';
	var fltr_date 		= '';
	var fltr_place 	  = '';
	var fltr_country  = '';
	var fltr_format 	= '';
	var fltr_sdate 	  = '';
	var fltr_edate 	  = '';


	//------------------------------------------------------
	//Build body
	rows = xmlhttp.responseText.split('~');
  for(var r = 0; r < rows.length-1; r++) {	//sub 1 for trailing ';'

			//alert('r='+r+'  row='+rows[r]);
			cells 	= rows[r].split('|');

			tmp  = cells[col_sdate].replace(/-/g,"/");
			var myDateS  	= new Date(tmp);


			if ( (cells[col_status] == 'Planned' || cells[col_status] == 'Confirmed') && (myDateS >= daylimit) ) {
				ecount++;

				//tmp  = cells[col_sdate].replace(/-/g,"/");
				//var myDateS  	= new Date(tmp);
				GA_datestr  	= dateFormat(myDateS, "yymm");
				sDateKeyS 		= dateFormat(myDateS, "yyyymmdd");
				sDateKey  		= dateFormat(myDateS, "ddd dd-mmm");
				monthkey  		= dateFormat(myDateS, "Y-mm");
				monthStr 		 	= dateFormat(myDateS, "yyyy mmm");
				sDateStr  		= sDateKey;

				tmp = cells[col_edate].replace(/-/g,"/");
				var myDateS = new Date(tmp);
				eDateKeyS = dateFormat(myDateS, "yyyymmdd");
				eDateKey = dateFormat(myDateS, "ddd dd-mmm");
				eDateStr = eDateKey;

				if ( cells[col_sdate2] != "" ) {
					tmp2 = cells[col_sdate2].replace(/-/g,"/");
					var myDateS2 = new Date(tmp2);
					sDateStr +=  "<br />" + dateFormat(myDateS2, "ddd dd-mmm");
				}
				if ( cells[col_edate2] != "" ) {
					tmp2 = cells[col_edate2].replace(/-/g,"/");
					var myDateS2 = new Date(tmp2);
					eDateStr +=  "<br />" + dateFormat(myDateS2, "ddd dd-mmm");
				}

				if ( cells[col_sdate3] != "" ) {
//					alert('col_sdate3'+cells[col_sdate3]);
					tmp3 = cells[col_sdate3].replace(/-/g,"/");
					var myDateS3 = new Date(tmp3);
					sDateStr +=  "<br />" + dateFormat(myDateS3, "ddd dd-mmm");
				}
				if ( cells[col_edate3] != "" ) {
//					alert('col_edate3'+cells[col_edate3]);
					tmp3 = cells[col_edate3].replace(/-/g,"/");
					var myDateS3 = new Date(tmp3);
					eDateStr +=  "<br />" + dateFormat(myDateS3, "ddd dd-mmm");
				}

				//Create dropdown item list
				if (  myprograms[cells[col_program]] ){	/* already been added */	 			}
				else if ( cells[col_program] != '' ) 	{	myprograms[cells[col_program]]= cells[col_program]; 	}

				if (  mylevels[cells[col_level]] ) 		{	/* already been added */	 			}
				else if ( cells[col_level] != '' ) 		{	mylevels[cells[col_level]]= cells[col_level]; 	}

				if (  mystreams[cells[col_stream]] ) 	{	/* already been added */	 			}
				else if ( cells[col_stream] != '' ) 	{	mystreams[cells[col_stream]]= cells[col_stream]; 	}
					//alert( 'dropdowns ok' );

				if (  mymodules[cells[col_module]] ) 	{	/* already been added */	 			}
				else if ( cells[col_module] != '' ) 	{	mymodules[cells[col_module]]= cells[col_module]; 	}

				if ( mydates[monthStr] ) 							{	/* already been added */	 			}
				else if ( monthStr != '') 	  				{	mydates[monthkey]= monthStr; 		} //store key: 2010-05 with value '2010 May'

				if ( myplaces[cells[col_place]] ) 		{	/* already been added */	 			}
				else if ( cells[col_place] != '' ) 		{	myplaces[cells[col_place]]= cells[col_place]; 	}

				if ( mycountries[cells[col_country]] ){	/* already been added */	 			}
				else if ( cells[col_country] != '' ) 	{	mycountries[cells[col_country]]= cells[col_country];}

				if ( myformats[cells[col_format]] )		{	/* already been added */	 			}
				else if ( cells[col_format] != '' ) 	{	myformats[cells[col_format]]= cells[col_format];	}

				if ( mysdates[sDateKeyS] )						{	/* already been added */	 			}
				else if ( sDateKey != '' ) 						{	mysdates[sDateKeyS]= sDateKey;		}		//don't add multi-line date to dropdown

				if ( myedates[eDateKey] )					 		{	/* already been added */	 			}
				else if ( eDateKey != '' ) 						{	myedates[eDateKey]= eDateKey;		}

				//if ( mystatuses[cells[8]] )	{	/* already been added */	 			}
				//else if ( cells[8] != '' ) 	{	mystatuses[cells[8]]= cells[8];	}

				//Catch first time loading (elements not defined)
				fltr_program 	= (document.getElementById("program_list") 	== null)? '' : document.getElementById("program_list").value;
				//fltr_level 		= (document.getElementById("level_list") 		== null)? '' : document.getElementById("level_list").value;
				fltr_level = '';
				fltr_stream 	= (document.getElementById("stream_list") 	== null)? '' : document.getElementById("stream_list").value;

				fltr_module 	= (document.getElementById("module_list") 	== null)? '' : document.getElementById("module_list").value;
				fltr_date 		= (document.getElementById("dates_list") 		== null)? '' : document.getElementById("dates_list").value;
				fltr_place 		= (document.getElementById("place_list") 		== null)? '' : document.getElementById("place_list").value;
				fltr_country	= (document.getElementById("country_list") 	== null)? '' : document.getElementById("country_list").value;
				fltr_format 	= (document.getElementById("format_list") 	== null)? '' : document.getElementById("format_list").value;
				fltr_sdate  	= (document.getElementById("sdate_list") 		== null)? '' : document.getElementById("sdate_list").value;
				fltr_edate  	= (document.getElementById("edate_list") 		== null)? '' : document.getElementById("edate_list").value;
				//fltr_status = (document.getElementById("status_list") 	== null)? '' : document.getElementById("status_list").value;

				//alert('r='+r+' cells[col_module]=' + cells[col_module] + '   filt='+fltr_module);
				//alert('r='+r+'monthStr='+monthStr);
				if ( ((fltr_program	== '')	|| (cells[col_program] 	== fltr_program))	&&
						 ((fltr_level 	== '')  || (cells[col_level]		== fltr_level)) 	&&
						 ((fltr_stream 	== '')  || (cells[col_stream]		== fltr_stream)) 	&&
						 ((fltr_module 	== '')  || (cells[col_module] 	== fltr_module)) 	&&
				   	 ((fltr_date 		== '')  || (monthkey  					== fltr_date)) 		&&
				   	 ((fltr_place 	== '')  || (cells[col_place]		== fltr_place)) 	&&
				   	 ((fltr_country == '')  || (cells[col_country]	== fltr_country)) &&
				   	 ((fltr_format 	== '')	|| (cells[col_format]		== fltr_format)) 	&&
				   	 ((fltr_sdate 	== '')  || (sDateKey		        == fltr_sdate)) 	&&
				   	 ((fltr_edate 	== '')  || (eDateKey						== fltr_edate))
				   	 //((fltr_status == '') || (cells[8] == fltr_status))
				   	 ) {

					//Include row
					if ( inc % 2 ) 	{ mytd = '<td class="alt">'; 	}
					else						{ mytd = '<td>';							}

	/*
					var myDateE = new Date(cells[col_edate]);
					myDateS.format("ddd mmm-dd");
					myDateE.format("ddd mmm-dd")
		*/
					//	                http://www.chiball.com/education/mod/resource/view.php?id=187 //R&D version
					GA_evtstr = GA_datestr + " - " + cells[col_module] + " - " + cells[col_place];
					//evtlink = '<a href="http://www.chiball.com/education/mod/resource/view.php?id=194&eid=' + cells[col_id] + '" title="View details for this event" >' + cells[col_module] + '</a>';
					evtlink = '<a href="http://www.chiball.com/education/mod/resource/view.php?id=194&eid=' + cells[col_id] + '" title="View details for this event" onclick="_gaq.push([\'_trackEvent\', \'Timetable\'	, \'Event View\', \''+ cells[col_name] +'\' ]);" >' + cells[col_module] + '</a>';

					//buf += "<tr>"+mytd+ cells[col_program]  + "</td>"+mytd+ cells[col_level]  + "</td>"+mytd+ cells[col_stream] + "</td>";
					buf += "<tr>"+mytd+ cells[col_program]  +                                     "</td>"+mytd+ cells[col_stream] + "</td>";
					buf += 				mytd+ evtlink  						+ "</td>"+mytd+ monthStr  				+ "</td>"+mytd+ cells[col_place] 	+ "</td>"+mytd+ cells[col_country]+ "</td>";
					buf +=        mytd+ cells[col_format] 	+ "</td>"+mytd+ sDateStr 					+ "</td>"+mytd+ eDateStr 					+  "</td></tr>";
					inc = inc + 1;
				}
		}
	}

	if ( buf == '' ) {
		results = "No results found";
	}
	else {
		results = inc+" events found";
	}

	//alert('buf'+buf);


	//------------------------------------------------------
	//Build header row filters
	ksort(mymodules);
	ksort(mydates);
	ksort(myplaces);
	ksort(mycountries);
	ksort(myformats);
 	ksort(mysdates);
 	ksort(myedates);
 	//ksort(mystatuses);


	if ( daylimit == datelimit )	{ datetogglestr = 'hide past events';	}
	else													{ datetogglestr = 'show past events';	}

	//head +=' (<a href="javascript:togglePastTrainings();">'+datetogglestr+'</a>)';

	head 	= '';
	head  =	'<div style="width:1194px; text-align:right" ><a href="javascript:togglePastTrainings();">'+datetogglestr+'</a></div>';
	head +=	'<table name="events_table" id="events_table">'+
					'<tr>'+
					'<th width="10px"><b>Programme</b></th>'+
					//'<th width="65px"><b>Level</b></th>'+
					'<th width="104px"<b>Stream</b></th>'+
					'<th width="179px"><b>Module</b></th>'+
					'<th width="82px"><b>Month</b></th>'+
					'<th width="100px"><b>City</b></th>'+
					'<th width="100px"><b>Country</b></th>'+
					'<th width="70px"><b>Length</b></th>'+
					'<th width="100px"><b>Starts</b></th>'+
					'<th width="100px"><b>Ends</b></th>'
					//+'<th width="90px"><b>Status</b></th></tr>'
					;

	//=== PROGRAM ===//
	if ( fltr_program != "" ) {
		  td_class = 'drop_sel';
		  notifvars += '&program='+fltr_program;
	}
	else	{
		td_class = 'drop';
	}
	head +='<tr><td class="'+td_class+'" ><select id="program_list" name="program_list" onchange="filterResults(\'program\');">';
	//head +='<tr><td class="drop" ><select id="program_list" name="program_list" onchange="filterResults();">';
	head +='<option value="">- All -</option>';
	for ( var evt in myprograms ) {
		//alert( 'evt=['+evt+']');
		if ( evt == fltr_program )	{ head += '<option value="'+evt+'" selected>'+evt+'</option>'; 	}
		else											{	head += '<option value="'+evt+'">'+evt+'</option>';						}
	}
	head +='</select></td>';


	//=== LEVEL ===//
	/*
	if ( fltr_level != "" ) {
		  td_class = 'drop_sel';
		  notifvars += '&level='+fltr_level;
	}
	else	{
		td_class = 'drop';
	}
	head +='<td class="'+td_class+'" ><select id="level_list" name="level_list" onchange="filterResults(\'level\');">';
	head +='<option value="">- All -</option>';
	for ( var evt in mylevels ) {
		//alert( 'evt=['+evt+']');
		if ( evt == fltr_level )	{ head += '<option value="'+evt+'" selected>'+evt+'</option>'; 	}
		else											{	head += '<option value="'+evt+'">'+evt+'</option>';						}
	}
	head +='</select></td>';
	*/

	//=== STREAM ===//
	if ( fltr_stream != "" ) {
		  td_class = 'drop_sel';
		  notifvars += '&stream='+fltr_stream;
	}
	else	{
		td_class = 'drop';
	}
	head +='<td class="'+td_class+'" ><select id="stream_list" name="stream_list" onchange="filterResults(\'stream_\');">';
	head +='<option value="">- All -</option>';
	for ( var evt in mystreams ) {
		//alert( 'evt=['+evt+']');
		if ( evt == fltr_stream )	{ head += '<option value="'+evt+'" selected>'+evt+'</option>'; 	}
		else											{	head += '<option value="'+evt+'">'+evt+'</option>';						}
	}
	head +='</select></td>';


	//=== EVENT ===//
	if ( fltr_module != "" ) {
		  td_class = 'drop_sel';
		  notifvars += '&module='+fltr_module;
	}
	else	{
		td_class = 'drop';
	}
	head +='<td class="'+td_class+'" ><select id="module_list" name="module_list" onchange="filterResults(\'module\');">';
	head +='<option value="">- All -</option>';
	for ( var evt in mymodules ) {
		//alert( 'evt=['+evt+']');
		if ( evt == fltr_module )	{ head += '<option value="'+evt+'" selected>'+evt+'</option>'; 	}
		else											{	head += '<option value="'+evt+'">'+evt+'</option>';						}
	}
	head +='</select></td>';

	//=== DATE ===//
	if ( fltr_date != "" ) {
		  td_class = 'drop_sel';
		  notifvars += '&month='+fltr_date;
	}
	else	{
		td_class = 'drop';
	}
	head +='<td class="'+td_class+'" ><select id="dates_list" name="dates_list" onchange="filterResults(\'dates\');">';
	head +='<option value="">- All -</option>';
	for ( var evt in mydates ) {
		if ( evt == fltr_date )		{ head += '<option value="'+evt+'" selected>'+mydates[evt]+'</option>'; 	}
		else											{	head += '<option value="'+evt+'">'+mydates[evt]+'</option>';						}
	}
	head +='</select></td>';

	//=== CITY ===//
	if ( fltr_place != "" ) {
		  td_class = 'drop_sel';
		  notifvars += '&place='+fltr_place;
	}
	else	{
		td_class = 'drop';
	}
	head +='<td class="'+td_class+'" ><select id="place_list" name="place_list" onchange="filterResults(\'place\');">';
	head +='<option value="">- All -</option>';
	for ( var evt in myplaces ) {
		if ( evt == fltr_place )	{ head += '<option value="'+evt+'" selected>'+evt+'</option>'; 	}
		else											{	head += '<option value="'+evt+'">'+evt+'</option>';						}
	}
	head +='</select></td>';

	//=== COUNTRY ===//
	if ( fltr_country != "" ) {
		  td_class = 'drop_sel';
		  notifvars += '&country='+fltr_country;
	}
	else	{
		td_class = 'drop';
	}
	head +='<td class="'+td_class+'" ><select id="country_list" name="country_list" onchange="filterResults(\'country\');">';
	head +='<option value="">- All -</option>';
	for ( var evt in mycountries ) {
		if ( evt == fltr_country ){ head += '<option value="'+evt+'" selected>'+evt+'</option>'; 	}
		else											{	head += '<option value="'+evt+'">'+evt+'</option>';						}
	}
	head +='</select></td>';

	//=== FORMAT ===//
	if ( fltr_format != "" ) {
		  td_class = 'drop_sel';
		  notifvars += '&format='+fltr_format;
	}
	else	{
		td_class = 'drop';
	}
	head +='<td class="'+td_class+'" ><select id="format_list" name="format_list" onchange="filterResults(\'format\');">';
	head +='<option value="">- All -</option>';
	for ( var evt in myformats ) {
		if ( evt == fltr_format )	{ head += '<option value="'+evt+'" selected>'+evt+'</option>'; 	}
		else											{	head += '<option value="'+evt+'">'+evt+'</option>';						}
	}
	head +='</select></td>';

	//=== START DATE ===//
	if ( fltr_sdate != "" ) {
		  td_class = 'drop_sel';
		  notifvars += '&sdate='+fltr_sdate;
	}
	else	{
		td_class = 'drop';
	}
	head +='<td class="'+td_class+'" ><select id="sdate_list" name="sdate_list" onchange="filterResults(\'sdate\');">';
	head +='<option value="">- All -</option>';
	for ( var evt in mysdates ) {
		if ( mysdates[evt] == fltr_sdate )	{ head += '<option value="'+mysdates[evt]+'" selected>'+mysdates[evt]+'</option>'; 	}
		else																{	head += '<option value="'+mysdates[evt]+'">'+mysdates[evt]+'</option>';						}
	}
	head +='</select></td>';

	//=== END DATE ===//
	if ( fltr_edate != "" ) {
		  td_class = 'drop_sel';
		  notifvars += '&edate='+fltr_edate;
	}
	else	{
		td_class = 'drop';
	}
	head +='<td class="'+td_class+'" ><select id="edate_list" name="edate_list" onchange="filterResults(\'edate\');">';
	head +='<option value="">- All -</option>';
	for ( var evt in myedates ) {
		if ( myedates[evt] == fltr_edate )	{ head += '<option value="'+myedates[evt]+'" selected>'+myedates[evt]+'</option>'; 	}
		else																{	head += '<option value="'+myedates[evt]+'">'+myedates[evt]+'</option>';						}
	}
	head +='</select></td>';

	//=== STATUS ===//
/*	head +='<td class="drop" ><select id="status_list" name="status_list" onchange="filterResults();">';
	head +='<option value="">- All -</option>';
	for ( var evt in mystatuses ) {
		if ( evt == fltr_status )	{ head += '<option value="'+evt+'" selected>'+evt+'</option>'; 	}
		else											{	head += '<option value="'+evt+'">'+evt+'</option>';						}
	}
	head +='</select></td>';
*/

	head +='<tr><td class="resultsrow" colspan="10"><b>'+results+'</b>';
	if( inc < ecount )	{
		head +=' (<a href="javascript:resetFilters();">clear filters</a>)';
	}

	head +='</td></tr>';
	foot ='</table>';
	var mytable = document.getElementById("evtTable");
	mytable.innerHTML = head + buf + foot;
	//alert( head + buf + foot );

/*	if ( notify == true ) {
		emltest = GetXmlHttpObject();
		emltest.open("GET","/education/ajax/emailnotif.php?action=filter" + notifvars,true);
		emltest.send(null);
	}*/

	//Track event by Google Analytics
	//trackEvent(category, action, opt_label, opt_value)
	if ( filterName ) {
		var filterEl  = document.getElementById( filterName + "_list" )
		if ( filterEl != undefined || filterEl != null )
			_gaq.push(['_trackEvent', 'Timetable'	, 'Filter', filterName	, filterEl.value ]);
		else
			_gaq.push(['_trackEvent', 'Timetable'	, 'Filter', filterName ]);
	}
}

function resetFilters() {
	document.getElementById("program_list").value='';
	document.getElementById("level_list").value='';
	document.getElementById("stream_list").value='';
	document.getElementById("module_list").value='';
	document.getElementById("dates_list").value='';
	document.getElementById("place_list").value='';
	document.getElementById("country_list").value='';
	document.getElementById("format_list").value='';
	document.getElementById("sdate_list").value='';
	document.getElementById("edate_list").value='';
	//document.getElementById("status_list").value='';
	filterResults('reset');
}

function ksort (array, sort_flags) {
    // Sort an array by key
    //
    // version: 909.322
    // discuss at: http://phpjs.org/functions/ksort    // +   original by: GeekFG (http://geekfg.blogspot.com)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // %          note: The examples are correct, this is a new way
    // -    depends on: i18n_loc_get_default    // *     example 1: data = {2: 'van', 3: 'Zonneveld', 1: 'Kevin'};
    // *     example 1: ksort(data);
    // *     results 1: data == {1: 'Kevin', 2: 'van', 3: 'Zonneveld'}
    // *     returns 1: true
    var tmp_arr={}, keys=[], sorter, i, key, that=this;
    switch (sort_flags) {
        case 'SORT_STRING': // compare items as strings
            sorter = function (a, b) {
                return that.strnatcmp(a, b);            };
            break;
        case 'SORT_LOCALE_STRING': // compare items as strings, based on the current locale (set with  i18n_loc_set_default() as of PHP6)
            var loc = this.i18n_loc_get_default();
            sorter = this.php_js.i18nLocales[loc].sorting;            break;
        case 'SORT_NUMERIC': // compare items numerically
            sorter = function (a, b) {
                return (a - b);
            };            break;
        case 'SORT_REGULAR': // compare items normally (don't change types)
        default:
            sorter = function (a, b) {
                if (a > b) {                    return 1;
                }
                if (a < b) {
                    return -1;
                }                return 0;
            };
            break;
    }
     // Make a list of key names
    for (key in array) {
        keys.push(key);
    }
     keys.sort(sorter);

    // Rebuild array with sorted key names
    for (i = 0; i < keys.length; i++) {
        key = keys[i];        tmp_arr[key] = array[key];
        delete array[key];
    }
    for (i in tmp_arr) {
        array[i] = tmp_arr[i];    }

    return true;
}