//this is Object Oriented java script code

// Constructor 
function Search()
{

}
//Static functions

//clearing the search box on page load
Search.clrSearch = function()
{
	window.document.forms[0].elements['search'].value = ""
}

// 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 (window.document.forms[0].elements['search'].value != "")
	{
	window.document.forms[0].elements['btnG'].focus();
	window.document.forms[0].elements['btnG'].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(); 
}


