/**
 * SMA
 */ 
var SMA = {
	
    /**
     * Init UI functions
     */         
    init: function () {
 
        SMA.expandableBlocks();
        SMA.searchInputs();
		SMA.hideTabs();

    },

    /**
     * Toogle expandle boxes on home page
     */         
    expandableBlocks: function () {
        $('.expandable-block .tab a').bind('click', function () {
             $(this).parents('.expandable-block').toggleClass('expanded-block');
             $(this).toggleClass('expanded');
             return false;
        });
    },

	hideTabs: function () {
		$('.expandable-block .block-content').each(function() {
			var innerHeight = $(this).height();

			if (innerHeight < 230) {
				$(this).next('div.tab').hide();
				$(this).addClass('no-tab');
			}

		});
	},

    /**
     * Search box input value
     */
	searchInputs: function () {
	    // set the default text
		$('input#keywords').focus(function(){
			var value = this.value;
			var title = this.title;
			if (value == title) {
				$(this).val("");
			};
		});

		// if it's blank then reset back the title attribute
		$('input#keywords').blur(function(){
			if(!$(this).val().length){
				$(this).val(this.title);
			}
		});
	}

} 

$(document).ready(function () {
	
	// Call the functions
	SMA.init();
	
    // ADDING CLASS OF LAST TO FINAL ELEMENT
    $('div#content_sec div.block:last').addClass('last');
    $('div#content_sec div:last').addClass('last');
	
	
});