/**
 * @author brian
 */

// Create Vitrue Namespace, if it doesn't exist
if (Vitrue == null || typeof(Vitrue) != "object") { var Vitrue = new Object();}

// All the functions in the Vitrue namespace will go in this block
Vitrue = {
  openLogin: function () {
    jQuery("#login_dialog").dialog("open");
  }
} // end of the Vitrue.Login namespace

// Need this to run as soon as the document is ready
  jQuery(document).ready(function(){
    
    if (jQuery("#login_errors").length > 0) {
      jQuery("#login_dialog").dialog({
        autoOpen: true,
        modal: true,
        width: '254px'
      });
    }
    else {
			if(jQuery('#flash').length > 0) {
        jQuery("#flash").dialog({
          autoOpen: true,
          modal: true,
          width: '254px'
        });
			}
      jQuery("#login_dialog").dialog({
        autoOpen: false,
        modal: true,
        width: '254px'
      });
			
    }
    
    jQuery("#login_link").click(function(){
      Vitrue.openLogin();
    });
  });

