/* SVN FILE: $Id: app.js 2937 2011-11-02 20:30:49Z dwu $ */

$(document).ready(function() {
    
	// Handle login conditions
	$("#UserUsername").click(function(){
	
		// Clear out any values
		$(this).val('');
	
	});
    
    $("#tbPasswordOverlay").focus(function(){
    	$(this).hide();
    	$("#UserPass").show();
    	$("#UserPass").focus();
    });
    
    
});

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}


var CKEDITOR_toolbar_Client =  [['Source','-','Save','NewPage','Preview','-','Templates'],['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print','SpellChecker','Scayt'],['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],['Link','Unlink','Anchor'],['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],'/',['Styles','Format','Font','FontSize'],['TextColor','BGColor'],['Maximize','ShowBlocks','-','About']] ;

// Add Hospitals Autocompleter code
function setupAutocomplete(callback){
	$("#PellucidEntityName").autocomplete({
		source: function(req, add) {
			$.getJSON('/hospitals/filter_hospitals_by_name/?callback=?', req, function(data) {
				add(data);
			});
		},	
		width: 450,
		minLength: 3,
		dataType: 'json',
		select: function (event, ui) {
			// Ajax call to add to our report list
			// reload hospitals
			$.get('/reports/add_entity/' + ui.item.value, function(data) {
				callback();
			});
			
		}
	});
}

var myStep = 3;
