/**
 * Checks/unchecks all tables
 *
 * @param   string   the form name
 * @param   boolean  whether to check or to uncheck the element
 *
 * @return  boolean  always true
*/

function setCheckboxes(the_form, do_check)
{
     var elts      = (typeof(document.forms[the_form].elements['selected_db[]']) != 'undefined')
                     ? document.forms[the_form].elements['selected_db[]']
                     : (typeof(document.forms[the_form].elements['selected_tbl[]']) != 'undefined')
                     ? document.forms[the_form].elements['selected_tbl[]']
                     : document.forms[the_form].elements['selected_fld[]'];
     var elts_cnt  = (typeof(elts.length) != 'undefined')
                     ? elts.length
                     : 0;

     if (elts_cnt) {
        for (var i = 0; i < elts_cnt; i++) {
           elts[i].checked = do_check;
        } // end for
     } else {
        elts.checked        = do_check;
     } // end if... else

     return true;
} // end of the 'setCheckboxes()' function


<!--
// copyright 1999-2001 Idocs, Inc. http://www.idocs.com/tags/
// Distribute this script freely, but keep this
// notice with the code.
var resetRolls = new Object();
function resetimage(src)
{
this.src=src;
this.confirm=true;
this.alt="Reset";
this.write=resetimage_write;
}
function resetimage_write()
{
document.write('<A ');
if (this.rollover)
{
if (! this.name)
{
alert('to create a rollover you must give the image a name');
return;
}
resetRolls[this.name] = new Object();
resetRolls[this.name].over = new Image();
resetRolls[this.name].over.src=this.rollover;
resetRolls[this.name].out = new Image();
resetRolls[this.name].out.src=this.src;
document.write(
' onMouseOver="if (document.images)document.images[\'' +
this.name + '\'].src=resetRolls[\'' + this.name + '\'].over.src"' +
' onMouseOut="if (document.images)document.images[\'' +
this.name + '\'].src=resetRolls[\'' + this.name + '\'].out.src"'
);
}
document.write(' HREF="javascript:');
if (this.confirm)
document.write('if(confirm(\'Are you sure you want to set the default values?\'))');
document.write(
'document.forms[' +
(document.forms.length - 1) + '].reset();void(0);">');
document.write('<IMG SRC="' + this.src + '" ALT="' + this.alt + '"');
document.write(' BORDER=0');
if (this.name)document.write(' NAME="' + this.name + '"');
if (this.height)document.write(' HEIGHT=' + this.height);
if (this.width)document.write(' WIDTH=' + this.width);
if (this.otheratts)document.write(' '+ this.otheratts);
document.write('></A>');
}
//-->

<!--

var state = 'inline';

function showhideOLD(layer_ref) {

if (state == 'inline') {
state = 'none';
}
else {
state = 'inline';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.display = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].display = state;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
hza.style.display = state;
}
}
//-->



function PROCTextCreateSelectOptionsNew() {
   var formnameS = arguments[0];
   var listnameS = arguments[1];
   var arraySA = new Array();

   for (i = 0; i < arguments.length; i += 1) {
      arraySA[i] = arguments[i + 2];
   }
   var I = 0;
   var minI = 0;
   var maxI = arraySA.length - 1;
   //
   var s = "";
   //
   for ( I = minI; I <= maxI; I++ ) {
      s = arraySA[ I ];
      eval( 'document.forms.' + formnameS + '.' + listnameS + '.options.options[' +  I  + '] = new Option( s, s );'  );
   }
   //
}



function ShowHide(id) {
    obj = document.getElementsByTagName("div");
    if (obj[id].style.display == 'inline'){
      obj[id].style.display = 'none';
    }
    else {
      obj[id].style.display = 'inline';
    }
}


<!--
function popitup(url, dims)
{
	newwindow=window.open(url,'name', dims);
	if (window.focus) {newwindow.focus()}
	return false;
}

// -->
function checkform(form){
        var thres = form.threshold.value;

	if (thres > 1 || thres < 0 ){
	  alert("[Query Specificity Threshold]: Please enter a threshold between 0 and 1 (e.g. 0.8).");
	  form.threshold.focus();
	  return false;
        }
	if (form.maxresults.value < 1) {
	  alert("[Results Per Page]: Please enter a number between 1 and 99.");
	  form.maxresults.focus();
	  return false;
	}
	if (form.query.value == "") {
	  alert("[Search for]: Please enter a Mesh Term for the search to start.");
	  form.query.focus();
	  return false;
	}

        return true;
}

function changeFormSelections(id){

  var ont1 = document.suggestform.suggest_ontology1;
  var ont2 = document.suggestform.suggest_ontology2;
  var selbox = document.searchform.select;

  if (id == 'TERM1') {
    document.searchform.ontology1.value = ont1.value;
  }

  if (id == 'TERM2') {
    document.searchform.ontology2.value = ont2.value;
  }

  if (ont1.value == ont2.value) {
    selbox.options.length = 0;
    selbox.options[selbox.options.length] = new Option('Shortest Path','shortestPath');
    selbox.options[selbox.options.length] = new Option('Wu and Palmer','wuAndPalmer');
    selbox.options[selbox.options.length] = new Option('Leacock-Chodorow','leacokChodorow');
    selbox.options[selbox.options.length] = new Option('Weighted Links','weightedLinks');
    selbox.options[selbox.options.length] = new Option('Li et al.','liEtAl');
    selbox.options[selbox.options.length] = new Option('Lin','lin');
    selbox.options[selbox.options.length] = new Option('Lord et al.','lordEtAl');
    selbox.options[selbox.options.length] = new Option('Jiang et al.','jiangEtAl');
    selbox.options[selbox.options.length] = new Option('Resnik','resnik');
    selbox.options[selbox.options.length] = new Option('Rodriguez','rodriguez');
    selbox.options[selbox.options.length] = new Option('ModRod','rodriguezOur');
    selbox.options[selbox.options.length] = new Option('Tversky','tversky');

    document.getElementById(1).disabled = false;
  }
  else {
    selbox.options.length = 0;
    selbox.options[selbox.options.length] = new Option('Rodriguez','rodriguezCross25');
    selbox.options[selbox.options.length] = new Option('ModRod','rodriguezCrossFinal');

    document.getElementById(1).disabled = true;
    document.getElementById(2).checked = true;
  }

}


function waitPreloadPage() { //DOM
if (document.getElementById){
document.getElementById('prepage').style.visibility='hidden';
}else{
if (document.layers){ //NS4
document.prepage.visibility = 'hidden';
}
else { //IE4
document.all.prepage.style.visibility = 'hidden';
}
}
}


function initialize(address) 
{ if (GBrowserIsCompatible()) { 
	var map = new GMap2(document.getElementById("map_canvas"), {size:new GSize(700,500)}); 
	map.setCenter(new GLatLng(35.520631,24.050875), 13); 
//	map.openInfoWindow(map.getCenter(),document.createTextNode("Lab Location"));
	var point = new GLatLng(35.527267, 24.069993);    
	var marker = new GMarker(point);
	map.addOverlay(marker);
//	marker.openInfoWindowHtml("<span style='font-family:Arial;font-size:10px'><b>Intelligent Systems Laboratory</b><br>Department of Electronic & Computer Engineering<br> Technical University of Crete<br>University Campus - Kounoupidiana<br>73100 Chania, Crete<br>HELLAS</span>");
	marker.bindInfoWindowHtml("<span class='ntextverysmall'>" + address + "</span>");
//	map.setUIToDefault(); 

	// Get the default UI 
	var ui = map.getDefaultUI(); 

        // Make changes as required 
        ui.controls.scalecontrol = false; 
        ui.controls.overviewmapcontrol = true;

	map.setUI(ui); 

  } 
} 
