
	var tripRating_enable = true;
	
	function tripView_hlRating(imgID)
	{
		if( tripRating_enable){ $('tripRatingImage').src = tripView_ratingImages[imgID].src; }
	}
	
	function tripRating_send(tripID,rate)
	{	
		if( tripRating_enable)
		{
			var url = "/trkbTripServices/Rating";
			var pars  = "tripID="+tripID+"&rate="+rate;
			var myAjax = new Ajax.Request( url, {   method: 'post', 
													parameters: pars, 
													onComplete: tripRating_response });
		}
	}
	
	function tripRating_response(request)
	{
			var _res =  request.responseText;
			var _code =  _res.charAt(0);
			tripRated(_code, _res.substr(2));
	}

	var tripComments_tripID;
	
	function tripComments_load(tripID)
	{
		var _showFrom = ( arguments.length < 2 ) ? 0 : arguments[1];
		
		//$('commentsList').style.display = "none";
		$('commentsLoad').style.display = "block";
		var url = "/trkbTripServices/CommentsList";
		var pars  = "tripID="+tripID+"&listType="+tripComments_listType+"&showFrom="+_showFrom;
		
		var myAjax = new Ajax.Request( url, {   method: 'post', 
												parameters: pars, 
												onComplete: tripComments_loaded });
	}
	
	function tripComments_loaded(request)
	{
			var _res =  request.responseText;
			//if( _res.charAt(0) == "0" )
			_res = _res.substr(2);
			$('commentsList').innerHTML = _res;
			$('commentsList').style.display = "block";
			$('commentsLoad').style.display = "none";
	}
	
	function tripComments_openClosePost()
	{
		$('commentsPost').style.display = $('commentsPost').style.display == "block" ? "none" : "block";
	}
	
	function tripComments_updateCharsLeft(_tarea)
	{
		if( _tarea.value.length>500 ){ _tarea.value = _tarea.value.substr(0,500); }
		$('commentPostCharLeft').innerHTML = 500 - _tarea.value.length;
	}
	
	function tripComments_sendPost(tripID)
	{
		var _text = $('commentPostText').value;
		if( _text.length == 0 ){ alert(tripView_texts.commentEmpty); return; }
		
		$('commentsPost').style.display = "none";
		$('commentsSave').style.display = "block";
		tripComments_tripID = tripID;
		var url = "/trkbTripServices/CommentsPost";
		var pars  = "tripID="+tripID+"&text="+ kTools.prepairPostString(_text);
		var myAjax = new Ajax.Request( url, {   method: 'post', 
												parameters: pars, 
												onComplete: tripComments_sendPostSaved });
	}

	function tripComments_sendPostSaved(request)
	{
			var _res = request.responseText;
			$('commentPostText').value = "";
			$('commentPostCharLeft').innerHTML = "500";
			$('commentsSave').style.display = "none";
			//$('commentsList').style.display = "block";
			$('commentsLoad').style.display = "none";
			//if( _res.charAt(0) == "0" )
			{
				tripComments_load(tripComments_tripID);
			}
	}
	
	function tripComment_delete(tripID,commID)
	{
		if( !confirm(tripView_texts.commentDeleConfirm) ){ return; }
		//$('commentsPost').style.display = "none";
		$('commentsSave').style.display = "block";
		tripComments_tripID = tripID;
		var url = "/trkbTripServices/CommentsDelete";
		var pars  = "commID="+commID;
		var myAjax = new Ajax.Request( url, {   method: 'post', 
												parameters: pars, 
												onComplete: tripComment_deleted });
	}

	function tripComment_deleted(request)
	{
			var _res = request.responseText;
			$('commentsSave').style.display = "none";
			//$('commentsList').style.display = "block";
			$('commentsLoad').style.display = "none";			
			//if( _res.charAt(0) == "0" )
			{
				tripComments_load(tripComments_tripID);
			}
	}

	