var main = {
    init: function() {
        if($('form').length > 0)
            this.formHelper();

        if ($('.cms-gallery').size() > 0)
            this.enableFancybox($('.cms-gallery'));
 
		this.cssFixes();
		this.focusChange()
    },
    cssFixes: function(){
		$('a.target-blank').attr('target','_blank');
	},
    enableFancybox: function(container){
        $('a', container).fancybox({
            'padding': 0,
            'titleShow': false,
            'transitionIn'	: 'elastic',
            'transitionOut'	: 'elastic'
        });
    },
    formHelper: function() {
        $('input, textarea').each(function() {
            var default_value = this.value;
            $(this).focus(function() {
                this.value = (this.value == default_value)? ''  : this.value;
            });
            $(this).blur(function() {
                this.value= (this.value== '') ? default_value   : this.value;
            });
        });
		},
	focusChange: function() {
		$('input[type="text"], input[type=email], textarea').addClass("focusOff");  
		$('input[type="text"], input[type=email], textarea').focus(function() {  
			$(this).removeClass("focusOff").addClass("focusOn");  
			
			});  
		$('input[type="text"], input[type=email], textarea').blur(function() {  
        $(this).removeClass("focusOn").addClass("focusOff");  
			 
			}); 
		}
}
$(document).ready(function() {
    main.init();

		$('a.mailto').each(function(){
			var _old = $(this).attr('href');
			var _new = _old.replace(/-36/gi,'');
			$(this).attr('href',_new);

			var _old = $(this).text();
			var _new = _old.replace(/-36/gi,'');
			$(this).text(_new);

		});

});

