var CAL = window.CAL || {};

/**
 * @namespace Holds global functionality
 */
CAL.global = CAL.global || {};


window.CAL = window.CAL = {};

(function() { 
var Calphalon = {

  /**
  * Suckerfish method for nav dropdowns
  */
  sfHover: function() {
	$('#subnav li').each( function() 
								  
								  {
	 $(this).hoverIntent(
	    function() {
	    	$(this).addClass('sfhover');
	    },
	    function() {
	    	$(this).removeClass('sfhover');
	    }
	  );
	});
  }, // sfHover

  /**
  * Removes label from text fields    
  */
  removeLabels: function() {
    $('.labelField').each(function() {
        var node = $(this);
        var defaultText = node.val();
        
        node.focus(function() {
  	      if($(this).val()== defaultText) {
	        $(this).val('');
	      }
          $(this).blur(function() {
            var userInput = $(this).val();
            if(userInput=='') {
              $(this).val(defaultText);
            }
          }); // blur
        }); // focus
    });
  }, // removeLabels
  
  /**
  * Opens links in New Window
  */
   newWin : function() {
       $("a.newWin").bind("click",function(e) {
            window.open(this.href);
            e.preventDefault();
        });
   },
   
  /**
  * Initializes all global page interactions
  */
  _init: function() {
  	this.sfHover();
  	this.removeLabels();
  } // _init
  
}; // Calphalon Namespace

$(document).ready(function() {
  Calphalon._init();
  $('.sifr').sifr({
		font: '../js/lib/futuralt.swf',
		version: 3,
		build: 'beta2'
	});
});

window.CAL = Calphalon;

})();

