
// default search text

// event handler
function addEventToObject(obj,evt,func) {
	var oldhandler = obj[evt];
	obj[evt] = (typeof obj[evt] != 'function') ? func : function(){oldhandler();func();};
}

// lyrics box stuff
var Searchbox = {
	init : function()
		{
		var sBox = document.getElementById('search-lyrics');
		if (sBox)
			{
			addEventToObject(sBox,'onclick',Searchbox.click);
			addEventToObject(sBox,'onblur',Searchbox.blur);
			}	
		},
	click : function()
		{
		var sBox = document.getElementById('search-lyrics');
		if (sBox.value == 'Enter lyric, artist name or song title')
			{
			sBox.value = '';
			sBox.style.color = 'black';
			}
	  	},
	blur : function()
		{
		var sBox = document.getElementById('search-lyrics');
		if (sBox.value == '' || sBox.value == ' ') {sBox.value = 'Enter lyric, artist name or song title'; sBox.style.color = '#999999';}
		}
	};

// search box stuff
var Searchbar = {
	init : function()
		{
		var sBar = document.getElementById('searchmtv-text');
		if (sBar)
			{
			addEventToObject(sBar,'onclick',Searchbar.click);
			addEventToObject(sBar,'onblur',Searchbar.blur);
			}	
		},
	click : function()
		{
		var sBar = document.getElementById('searchmtv-text');
		if (sBar.value == 'Search' || sBar.value == 'SEARCH')
			{
			sBar.value = '';
			}
	  	},
	blur : function()
		{
		var sBar = document.getElementById('searchmtv-text');
		if (sBar.value == '' || sBar.value == ' ') {sBar.value = 'SEARCH';}
		}
	};

// add event onload
addEventToObject(window,'onload',Searchbox.init);
addEventToObject(window,'onload',Searchbar.init);
