﻿/// <reference path="jQuery.intellisense.js" />

/*
Watermarks

This does the watermarking for input boxes, use the watermark class on
labels, watermarkJS is added so you can position the label over the input
*/
$(function(){

	$('label.watermark').addClass("watermarkJS");
	$('label.watermark').each(function(index,label){
	    eleInput = $('#'+$(label).attr("for"))[0];
	    
	    // ie positioning hack
	    try{
	    eleInput.parentElement.style.position = 'relative';}
	    catch(ex){
	    eleInput.parentNode.style.position = 'relative';}
	    
	    if(eleInput.value != "")
	    {
	        $(label).hide();
	    }
	    
	    $(eleInput).blur(function(){
	        eleInput = $('#'+$(label).attr("for"))[0];
	        if(eleInput.value == "")
	        {
	            $(label).show();
	        }
	    });
	    $(eleInput).focus(function(){
	        eleInput = $('#'+$(label).attr("for"))[0];
	        $(label).hide();
	    });
	    
	});
	
});
/*
End Watermarks
*/