function startVideo(params) {
	$("#icon,#duration,#url").remove();
	$("#message_form").append("<input id=\"icon\" name=\"icon\" type=\"hidden\" value=\""+params['pictureString'] + "\" />" + "<input id=\"url\" name=\"url\" type=\"hidden\" value=\"" + params['streamName'] + "\" />" );
	
}

function startVoice(params) {
	$("#icon,#duration,#url").remove();
	$("#message_form").append("<input id=\"url\" name=\"url\" type=\"hidden\" value=\"" + params['streamName'] + "\" />" );
	
}
function stopRecord(params) {
	$("#message_form").append("<input id=\"duration\" name=\"duration\" type=\"hidden\" value=\""+params['duration'] + "\" />");
}

function callAS() {
	return {status: true}
}
 // callAS({“status”: “true”})

$(function() {
	$("#feedback").click(function () {
		$(this).select();
	});
  	$("#message_form").validate({
	submitHandler: function(form) {
	  if ( $("#feedback").attr('value').length == 0 || $("#feedback").attr('value') == 'Leave text comment or feedback' ) {	
	   	if ( $("#url").size() == 0) {
			alert('You need to record message or fill Feedback form before submit.');
			return
		}
		if ($("#duration").size() == 0) {
			alert('You need to stop recording before submit.');
			return
		}
		if ($("#feedback").attr('value') == 'Leave text comment or feedback' ) {
			$("#feedback").attr('value','');
		}
	  }
	  form.submit();
	 }});
    $(".rating").rating();  


});