/**
 *  Verschiedenen Javascript Funktionen 
 *  @ Intabo GmbH 2009
 *  
 */

/*****************************************************************/
$(function(){
    /** Label Over **/
    if($('#jobroboter').length) {
        $('#jobroboter label').labelOver('over')
    }    
    /** Form Validierung **/
    if($("#kontaktformular").length == 1) {
        $("#kontaktformular").validate();
    }
    if($("#publikation").length) {
        $("#publikation").validate();
    } 
 
});

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.hide();
			}			
			this.show = function() {
			  if (input.val() == '') label.show()
			}
			// handlers
			input.focus(this.hide);
			input.blur(this.show);
		    label.addClass(overClass).click(function(){ input.focus() });			
			if (input.val() != '') this.hide(); 
		}
	})
}

