function initsearchfield(){
	
	$('#searchform form')
  	.each(function(){
  	
		label = $('td.searchlabel label',$(this)).hide().text();
		
		var txt = label.replace(/^\s\s*/,'').replace(/\s\s*$/,'');
		var theform = $(this);
		var theinput = $('td input.search',$(this));
		var val = $(theinput).val();
		
		if(val == ''){
			$(theinput).val(txt);
		}
		
		$(theinput)
		.mouseover(function(){
			val = $(theinput).val();
			if(val == txt){
				$(theinput)
				.animate({ 
					"opacity":0.0
				},'fast','',function(){
					$(theinput).val('').animate({
						"opacity":1.0
					},1);
				});
			}
		})
		.mouseout(function(){
			val = $(theinput).val();
			if(val == ''){
				$(theinput).stop().val(txt);
			}
		})
		.focus(function(){
			$(theinput).unbind("mouseout");
		})
		.blur(function(){
			val = $(theinput).val();
			if(val == ''){
				$(theinput).val(txt);
			}
			
			$(theinput).mouseout(function(){
				val = $(theinput).val();
				if(val == ''){
					$(theinput).val(txt);
				}
			});
		});
		
	});
	
}

// searchfield show / hide
var searchlabel = '';
function initsearchfield_NEWNEEDSWORK(){
	
	$('td input.search',
		
		$('#searchform')
		.mouseover(function(){
			
			// hide label
			var theinput = $('td input.search',$(this));
			var val = $(theinput).val();
			
			$(theinput).stop();
			 
			if(val == ''){
				
				$(theinput)
				.animate({ 
					"opacity":'1.0'
				},'fast','',function(){
					$(this).focus();
				});
			}
			
		})
		.mouseout(function(){
			
			// showlabel
			var theinput = $('td input.search',$(this));
			field_showlabel(theinput);
			
		})
		.blur(function(){
			
			// showlabel
			var theinput = $('td input.search',$(this));
			field_showlabel(theinput);
			
		})
		
	).each(function(){
		
		var labeltxt =  $('label',
			$(this)
			.parent('td')
			.prev('td')
			.hide()
		)
		.text();
		
		searchlabel = labeltxt.replace(/^\s\s*/,'').replace(/\s\s*$/,'');
		
		//alert(searchlabel);
		
		// showlabel
		field_showlabel(this);
		
	});
}

// searchfield showlabel
function field_showlabel(theinput){
	
	var val = $(theinput).val();
	
	$(theinput)
	.stop();
	 
	if(val == ''){
		
		$(theinput)
		.animate({ 
			"opacity":'1.0'
		},'fast','',function(){
			$(this)
			.blur()
			.val(label)
			;
		});
	}
}
