//START OF CODE
var infoBankState = true;
var onlineShopState = false;
var productsState = false;

function $_(elem, visible)
{
	result = false;
	v = $(elem);
	if (v != null)
	{
		if (visible)
			v.show();
		else
			v.hide();
		result = true;
	}
	return result;
}

function displayInfoBank()
{
	if (infoBankState == false)
	{
		//all other menus shoulde be close
		$_('onlineShop', false);
		$_('product', false);
		onlineShopState = false;
        productsState = false;
        
		if ($_('InfoBank', true))
			$('InfoBank').setStyle({className: 'blueText'});
	}
	else
		$_('InfoBank', false);
    
    infoBankState = !infoBankState;
}

function displayOnlineShop()
{
	if (onlineShopState == false)
    {
		//all other menus shoulde be close		
        $_('product', false);
        $_('InfoBank', false);
        infoBankState = false;
        productsState = false;

		if ($_('onlineShop', true))
			$('onlineShop').setStyle({className: 'blueText'});
	}
	else
		$_('onlineShop', false);

    onlineShopState = !onlineShopState;
}

function displayProducts()
{
	if(productsState == false)
    {
		//all other menus shoulde be close
        $_('onlineShop', false);
        $_('InfoBank', false);
        infoBankState = false;
        onlineShopState = false;
		
		if ($_('product', true))
			$('product').setStyle({className: 'blueText'});
	}
	else
		$_('product', false);

    productsState = !productsState;
}

function checkAll(theForm, cName, allNo_stat)
{
    var n=theForm.elements.length;        
      
    for (var x=0;x<n;x++){
        if (theForm.elements[x].className.indexOf(cName) !=-1){
            if (allNo_stat.checked) {
                theForm.elements[x].checked = true;
            } else {
                theForm.elements[x].checked = false;
            }
        }
    }
}

function SelectAll()
{
	ar = document.getElementById('filed');
	for(x in ar)
		document.write(x + "\n");
	alert(ar);
}

function DeselectAll()
{
	ar = document.filed;
	for(x in ar){
		x.checked = false;
	}
}

function redirect(page, _id)
{
    window.open( page + _id);
}

function launchCenteredWin(url, name, width, height, otherfeatures)
{
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
  }
  newwin = window.open(url, name, str + ',' + otherfeatures);
  if(parseInt(navigator.appVersion) >= 4)
  {
     setTimeout('newwin.focus();',250);
  }
}

function setVisible(elementId, visible){
	if (visible == true)
		$(elementId).style.display='';
	else
		$(elementId).style.display='none';
}

function getVisible(elementId){
	return ($(elementId).style.display == '');
}

function gotoSearch()
{
  window.location = 'Manuscript.php?filed[all]=1&text=' + $('txt').value;
  return true;
}

function enterAsGotoSearch(event)
{       
    if (event.keyCode == 13) // process only the Enter key
    {
        event.returnValue = false; // cancel the default submit
        event.cancel = true;            
        gotoSearch(); // submit the form by programmatically clicking the specified button
        return true;
    }
}
//END OF CODE
