// accessible open window
var newWindow = null;
function closeWin(){
 if (newWindow != null){
  if(!newWindow.closed)
   newWindow.close();
 }
}
function popUp(url, type, strHeight, strWidth){
  closeWin();
 var tools="";
 if (type == "fixed") tools = "resizable,toolbar=no,location=no,scrollbars=yes,menubar=no,height="+strHeight+",width="+strWidth+",top=20,left=20";
 if (type == "elastic") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,height="+strHeight+",width="+strWidth+",top=20,left=20";
 if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=no,height="+strHeight+",width="+strWidth+",left=20,top=20";
 newWindow = window.open(url, 'newWin', tools);
 newWindow.focus();
}


function formHandler(form){
var URL = '/browse.htm?subject=' + document.browseform.subject.value;;
window.location.href = URL;
}

// jquery function
$(document).ready(function() {
 // toggles the loginform div on clicking the noted link
	$('#loginform').toggle(0);
});   


// jquery function
$(document).ready(function() {
 // toggles the loginform div on clicking the noted link
  $('a#slick-toggle').click(function() {
	$('#loginform').toggle(400);
	return false;
  });
});   


// Functions for search autocomplete. Links with /search_rpc.htm
function lookup(inputString) {
    if(inputString.length == 0) {
        // Hide the suggestion box.
        $('#suggestions').hide();
    } else {
        $.post("http://first.emeraldinsight.com/ajaxcb/search_related.php", {queryString: ""+inputString+""}, function(data){
            if(data.length >0) {
                $('#suggestions').show();
                $('#autoSuggestionsList').html(data);
            }
        });
    }
} // lookup

function fill(thisValue) {
    $('#searchterm').val(thisValue);
   $('#suggestions').hide();
}
