//this is Object Oriented java script code

// Constructor 
function Search()
{

}
//Static functions

//clearing the search box on page load
Search.clrSearch = function()
{
	//If   search text box null check for elements['SearchArg'].value != "" else  default word in search bar
	window.document.forms[0].elements['SearchArg'].value = "Search Title"
}

// this function used to handle the return key to validate and submitt the form
Search.handleKeypress = function(event)
{
	var key;
	if(navigator.appName=="Netscape")
	{
		key = event.which;
	}
	else
		key = window.event.keyCode;
	//alert(key);
	if (key == 13) 
		Search.SendForm();
}

// this function used to submit the form
Search.SendForm = function()
{
	//If   search text box null check for elements['SearchArg'].value != "" else  default word in search bar
	if (window.document.forms[0].elements['SearchArg'].value != "Search Title")
	{
	window.document.forms[0].elements['btnGo'].focus();
	window.document.forms[0].elements['btnGo'].click();
	return true;
	}
	else
	{
	return false;
	}
}

// this code is for traping the return key press event for netscape
if(navigator.appName=="Netscape")
{
	document.captureEvents(Event.KEYPRESS);
	document.onkeypress = Search.handleKeypress(); 
}



