// ----------------------------------------------------------------------
// Default search box text (thank you, Dan Cederholm (www.simplebits.com)
// ----------------------------------------------------------------------



// event handler
function addEventToObject(obj,evt,func) {
	var oldhandler = obj[evt];
	obj[evt] = (typeof obj[evt] != 'function') ? func : function(){oldhandler();func();};
}


// search box stuff
var Searchbox = {
	init : function()
		{
		var sBox = document.getElementById('search-field');
		if (sBox)
			{
			addEventToObject(sBox,'onclick',Searchbox.click);
			addEventToObject(sBox,'onblur',Searchbox.blur);
			}	
		},
	click : function()
		{
		var sBox = document.getElementById('search-field');
		if (sBox.value == 'Search The Website And Blog')
			{
			sBox.value = '';
			}
	  	},
	blur : function()
		{
		var sBox = document.getElementById('search-field');
		if (sBox.value == '' || sBox.value == ' ') {sBox.value = 'Search The Website And Blog';}
		}
	};

// newsletter box stuff
var Newsletterbox = {
	init : function()
		{
		var nBox = document.getElementById('subscribe-field');
		if (nBox)
			{
			addEventToObject(nBox,'onclick',Newsletterbox.click);
			addEventToObject(nBox,'onblur',Newsletterbox.blur);
			}	
		},
	click : function()
		{
		var nBox = document.getElementById('subscribe-field');
		if (nBox.value == 'Enter Your Email To Subscribe')
			{
			nBox.value = '';
			}
	  	},
	blur : function()
		{
		var nBox = document.getElementById('subscribe-field');
		if (nBox.value == '' || nBox.value == ' ') {nBox.value = 'Enter Your Email To Subscribe';}
		}
	};



// add event onload
addEventToObject(window,'onload',Searchbox.init);
addEventToObject(window,'onload',Newsletterbox.init);
