/**************************************************************
*
* Growl - for the net and jQuery (http://labs.d-xp.com/growl/)
* 
* @author  : Artur Heinze
* @version : 1.01 
**************************************************************/

(function($){
  
  //GROWL OBJECT
  //--------------------------------------------------------------------
  
  $.Growl = {

    _statsCount: 0,
    
    show: function(options){
    
      var settings = $.extend({
        "id": ("gs"+$.Growl._statsCount++),
        "icon": false,
        "title": false,
        "message": "",
        "cls": "",
        "speed": 500,
        "timeout": 3000
      },options);
      
      if($("#"+settings.id).length!=0){
        $("#"+settings.id).remove();
      }
      
      //append status
      this._getContainer().prepend(
        '<div id="'+settings.id+'" class="growlstatus '+settings.cls+'" style="display:none;"><div class="growlstatusclose"></div>'+settings.message+'</div>'
      );
      
      var status = $("#"+settings.id);
      
      //bind close button
      status.find(".growlstatusclose").bind('click',function(){
        $.Growl.close($(this).parent().attr("id"),true,settings.speed);
      });
      
      //show title
      if(settings.title!==false){
        $("#"+settings.id).prepend('<div class="growltitle">'+settings.title+'</div>');
      }
      
      //show icon
      if(settings.icon!==false){
        
        status.addClass("growlwithicon");
        status.addClass("growlicon_"+settings.icon);
      }
      
      status
      //do not hide on hover
      .hover(
        function(){
          $(this).addClass("growlhover");
        },
        function(){
          $(this).removeClass("growlhover");
          if(settings.timeout!==false){
            window.setTimeout("$.Growl.close('"+settings.id+"')", settings.timeout);
          }
        }
      )      
      //show status+handle timeout
      .fadeIn(settings.speed,function(){
        if(settings.timeout!==false){
          window.setTimeout("$.Growl.close('"+settings.id+"')", settings.timeout);
        }
      });
      
      return settings.id;
    },
    
    close: function(id,force,speed){
    
      if(arguments.length==0){
        $(".growlstatus",this._getContainer()).hide().remove();
      }else{
          if(!$("#"+id).hasClass("growlhover") || force){
              $("#"+id).animate({opacity:"0.0"}, speed);
              $("#"+id).slideUp(function(){
                  $(this).remove();
            })
          }
      }
    
    },
    
    _getContainer: function(){
      
      if($("#growlcontainer").length==0) {
        $("body").append('<div id="growlcontainer"></div>');
      }
      
      return $("#growlcontainer");
      
    }
  
  };
  
  
  //HELPER FUNCTIONS
  //--------------------------------------------------------------------
  //
  // none for now

})(jQuery);

//Set the two dates
today=new Date()
var familyConference=new Date(today.getFullYear(), 6, 14) //Month is 0-11 in JavaScript
//Set 1 day in milliseconds
var one_day=1000*60*60*24

$(document).ready(function() {
	
	/*$.Growl.show({
	  'title'  : "Ask your MGOCSM about HLC 2010",
	  'message': $("#hlc").html(),
	  'icon'   : "pepsi",
	  'timeout': false
	});*/
	
	/*$.Growl.show({
	  'title'  : "Family and Youth Conference is " + Math.ceil((familyConference.getTime()-today.getTime())/(one_day)) + " days away!  Have you registered? ",
	  'message': $("#fyc").html(),
	  'icon'   : "star",
	  'timeout': false
	});*/
	
	$('#gallery').galleryView({
		panel_width: 448,
		panel_height: 223,
		transition_speed: 1500,
		transition_interval: 5000,
		nav_theme: 'light',
		border: '',
		pause_on_hover: true,
		show_filmstrip: false
	});
});


