// label over
jQuery.fn.labelOver = function(overClass) {
	return this.each(function(){
		var label = jQuery(this);
		var f = label.attr('for');
		if (f) {
			var input = jQuery('#' + f);
			this.hide = function() {
			  label.css({ textIndent: -10000 })
			}			
			this.show = function() {
			  if (input.val() == '') label.css({ textIndent: 0 })
			}
			// handlers
			input.focus(this.hide);
			input.blur(this.show);
		    label.addClass(overClass).click(function(){ input.focus() });			
			if (input.val() != '') this.hide(); 
		}
	})
}// end label over



// change path (page zone privee)
var handleTabsPath = function() {
	jQuery('#tabs1 > ul').tabs();
	
	var breadcrumb = jQuery('#path');
	var CONST_breadcrumb = breadcrumb.html();
	
	breadcrumb.html(CONST_breadcrumb + " - " + jQuery(".ui-tabs-selected a").text());
		
	jQuery("#tabs1 .navigation a").bind('click',function(){
		var text = jQuery(this).text();
		breadcrumb.html(CONST_breadcrumb + " - " + text);
	});	
};



var redirectSelect = function() {
	jQuery(".redirect").submit(function(){
		url = jQuery(this).find("select").val();
		window.location = url;
		return false;	
	});
};









jQuery(document).ready(function() {
	// header
	if(jQuery("#formSearch label").size() > 0) {
		jQuery('#formSearch label').labelOver('over');
	}
	
	// page zone prive
	if(jQuery("#tabs1 > ul").size() > 0) {
		handleTabsPath();
	}
	
	// fonction temporaire pour les select qui redirigent vers une page.
	if(jQuery(".redirect").size() > 0) {
		redirectSelect();
	}
});



// end
