function imgOn (imgId)
{
	document.getElementById(imgId).src = "gui/" + imgId + "_over.gif";
}

function imgOff (imgId)
{
	document.getElementById(imgId).src ="gui/" + imgId + ".gif";
}


function notAvaliable()
{
}


/*****top list*****/
// Cross-browser function to add a function to the onload event.
function AddOnload(myfunc)
{
	if(window.addEventListener)	// FireFox
	{
		window.addEventListener('load', myfunc, false);
	}
	else if(window.attachEvent)	// IE
	{
		window.attachEvent('onload', myfunc);
	}
	else if (window.onload)
	{
		var func = window.onload; 
		window.onload = function()
		{
			func();
			myfunc();
		}
	}
	else
	{
		window.onload = myfunc();
	}
}


// The hover function:
//  If there is a child sub-menu, show it on mouseover, hide it on mouseout!
var sfHover = function()
{
	var menu = document.getElementById("menu");
	if (!menu)
	{
		return;
	}
	var listItems = menu.getElementsByTagName("LI");
	for (var i = 0; i < listItems.length; i++)
	{
		listItems[i].onmouseover = function()
		{
			if (this.getElementsByTagName("UL").length > 0)
			{
				// Show the sub-menu
				this.getElementsByTagName("UL").item(0).style.display = "block";
			}
		}
		listItems[i].onmouseout = function()
		{
			if (this.getElementsByTagName("UL").length > 0)
			{
				// Hide the sub-menu
				this.getElementsByTagName("UL").item(0).style.display = "none";
			}
		}
	}
}

AddOnload(sfHover);	// Activate the menus when the page loads...


/*****Validate keyword********/
function validateKeyword()
{
    var obj = document.searchForm.Search;
    var msg = "Please enter the keyword.";

    if (obj== null)
    {
        alert(msg);
        obj.focus();
        return false;
    }
    
    if (removeAllSpaces(obj.value) == '')
    {
        alert(msg);
        obj.focus();
        return false;
    }
        
     if (removeAllSpaces(obj.value) == 'search...')
    {
        alert(msg);
        obj.focus();
        return false;
    }
    
    return true;
}


function validateKeywordKeypress(e)
{
    var characterCode;// literal character code will be stored in this variable

    if(e && e.which)  //if which property of event object is supported (NN4)
    { 
        e = e;
        characterCode = e.which ;//character code is contained in NN4's which property
    }
    else
    {
        e = event;
        characterCode = e.keyCode; //character code is contained in IE's keyCode property
    }

    if(characterCode == 13)//if generated character code is equal to ascii 13 (if enter key)
    { 
        return validateKeyword();
    }

}

function removeAllSpaces(s)
{	
	if ((s == null) || (typeof(s) != 'string') || !s.length)
	{
		return '';
	}
	return s.replace(/\s+/g, '');
} 