$(document).ready(function(){
	
	if (!(jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7 && parseInt(jQuery.browser.version, 10) > 4)) {
		$('.b-nav a').blend();	
	}

	// home page - clickable
	$('.clickable').click(function(){
		window.location.href = $(this).attr('rel');
	});
	
	// widgets
	var maxHeight = 0;
	$('.b-sidebar-home .wrapper').each(function(){
		if ($(this).height() > maxHeight) {
			maxHeight = $(this).height(); 
		}
	});
	if (maxHeight < ($('.b-sidebar-home .wrapper').css('min-height') + 28)) {
		maxHeight = $('.b-sidebar-home .wrapper').css('min-height') + 28;
	}
	$('.b-sidebar-home .wrapper').height(maxHeight);
	
	$('.input-placeholder').placeholder({className: 'placeholder'});

    $(".b-tabs").tabs();

    $(".tooltip").tooltip({
            tipClass: 'tooltip-body',
            effect: 'slide',
            position: 'top left',
            offset: [0,260]
    });


    $('.lightbox').colorbox({
        iframe: true,
        width: 860,
        height: 600
    });

	
});



/* ------------------------------------------------------------------------------------- */
/**
 * jQuery.placeholder - Placeholder plugin for input fields
 * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
 * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
 * Date: 2008/10/14
 *
 * @author Blair Mitchelmore
 * @version 1.0.1
 *
 **/
new function($) {
    $.fn.placeholder = function(settings) {
        settings = settings || {};
        var key = settings.dataKey || "placeholderValue";
        var attr = settings.attr || "placeholder";
        var className = settings.className || "placeholder";
        var values = settings.values || [];
        var block = settings.blockSubmit || false;
        var blank = settings.blankSubmit || false;
        var submit = settings.onSubmit || false;
        var value = settings.value || "";
        var position = settings.cursor_position || 0;

        
        return this.filter(":input").each(function(index) { 
            $.data(this, key, values[index] || $(this).attr(attr)); 
        }).each(function() {
            if ($.trim($(this).val()) === "")
                $(this).addClass(className).val($.data(this, key));
        }).focus(function() {
            if ($.trim($(this).val()) === $.data(this, key)) 
                $(this).removeClass(className).val(value)
                if ($.fn.setCursorPosition) {
                  $(this).setCursorPosition(position);
                }
        }).blur(function() {
            if ($.trim($(this).val()) === value)
                $(this).addClass(className).val($.data(this, key));
        }).each(function(index, elem) {
            if (block)
                new function(e) {
                    $(e.form).submit(function() {
                        return $.trim($(e).val()) != $.data(e, key)
                    });
                }(elem);
            else if (blank)
                new function(e) {
                    $(e.form).submit(function() {
                        if ($.trim($(e).val()) == $.data(e, key)) 
                            $(e).removeClass(className).val("");
                        return true;
                    });
                }(elem);
            else if (submit)
                new function(e) { $(e.form).submit(submit); }(elem);
        });
    };
}(jQuery);