


/* writes a resizable cell (NN 4.x needs width of 100%) */
function resizableCell() {
  if (document.layers) {
    document.write('<td width="100%" class=dkblue>&nbsp;</td>');
  }
  else {
    document.write('<td class=dkblue>&nbsp;</td>');
  }
}


/* used for select boxes to go to location specified (opens in new window) */
function jumpMenu(targ,selObj,restore){ 
  if ((selObj.options[selObj.selectedIndex].value) != "default") {
     eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
     if (restore) {
       selObj.selectedIndex=0;
     }
  }
}

/* writes current date */
function date() {
  var months=new Array(13);
  months[1]="01";
  months[2]="02";
  months[3]="03";
  months[4]="04";
  months[5]="05";
  months[6]="06";
  months[7]="07";
  months[8]="08";
  months[9]="09";
  months[10]="10";
  months[11]="11";
  months[12]="12";
  var time=new Date();
  var lmonth=months[time.getMonth() + 1];
  var date=time.getDate();
  var year=time.getYear();
  
  if (navigator.appName == "Netscape")
   year=1900 + year;
   document.write(date + "/"); +
   document.write(lmonth + "/");
   document.write(year);
  }



/* to write the time */
var id = null
function startClock() {
	var time = new Date()
	var hour = time.getHours()
	var minute = time.getMinutes()
	var second = time.getSeconds()
	var temp = "" + ((hour > 12) ? hour - 12 : hour)
	temp += ((minute < 10) ? ":0" : ":") + minute
	temp += ((second < 10) ? ":0" : ":") + second
	temp += (hour >= 12) ? " PM" : " AM"
        document.clock.display.value = temp
	id = setTimeout("startClock()",1000)
}
function stopClock() {
 clearTimeout(id);
}



/* --------------------------------------------------------------------*/
/* Search Function */


/* Allows the processing of a search mode based on selection */

function intranetSearch(type,buttonname,mode) {
    

  /* Check for a blank option */
  if (mode == "") {
     return false;
  } 
  
   /* Simple search - ensure keyword is not blank and does not contain illegal characters. */        
  if (type != "advanced") {      

     if (document.search.keyword.value.length < 1) {
        alert("Please enter a keyword.");
        document.search.keyword.focus(); 
        return false; 
     }
 
     if (document.search.keyword.value.search(/[/\\:'"?*<>|,]/) != -1) {
      alert('Please do not use any of these characters in the keyword:\r\n\t /\\:\'"?*<>|,');
      document.search.keyword.focus();
      return false;
     }
    
    newlocation = "http://" + document.location.host + "/Intranet/insea/search.php?searchstring=" + document.search.keyword.value + "&mode=" + mode + "&dosearch=yes";
   
  } else {
    newlocation = "http://" + document.location.host + "/Intranet/insea/criteria.php?mode=" + mode;
  }
  
  
  parent.frames[2].location = newlocation;
  return false;
    

}


/* -----------------------------------------------------------------*/


function open_window(url){
         mywin=window.open (url,"win",'toolbar=1,location=0,directories=0,status=0,scrollbars,menubar,resizable,width=600,height=610');
}

function open_window_lge(url){
         mywin=window.open (url,"win",'toolbar=1,location=0,directories=0,status=0,scrollbars,menubar,resizable,width=800,height=550');
}

function open_window_small(url) {
   mywin=window.open (url,"win",'toolbar=0,location=0,directories=0,status=0,scrollbars,resizable,width=600,height=500');
}

function open_window_medium(url) {
   mywin=window.open (url,"win",'toolbar=0,location=0,directories=0,status=1,scrollbars,menubar,resizable,width=700,height=500');
}

function open_window_xsmall(url) {
   mywin=window.open (url,"win",'toolbar=0,location=0,directories=0,status=0,scrollbars,resizable,width=400,height=280');
}
