// JavaScript Document


// opens new window
// -----------------------------------------------------------------
var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, type, strWidth, strHeight){
	closeWin()
	if (type == "fullScreen"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 160;
	}
	var tools="";
	if (type == "standard" || type == "fullScreen") tools = "resizable=no,toolbar=no,location=no,directories=no,status=no,scroll=yes,scrollbars=yes,menubar=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
	if (type == "console") tools = "resizable=no,toolbar=no,location=no,directories=no,status=no,scroll=no,scrollbars=no,menubar=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}


// clears and replaces text in form input fields and textareas
// -----------------------------------------------------------------
function clearText(thefield) {
  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
} 
function replaceText(thefield) {
  if (thefield.value=="") { thefield.value = thefield.defaultValue }
}


// Flash embedding for validation
// -----------------------------------------------------------------
function printFlash(source, width, height, id, bg_color) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
	document.write('width="'+width+'" height="'+height+'" id="'+id+'" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="'+source+'" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="'+bg_color+'" />');
	document.write('<embed src="'+source+'" menu="false" quality="high" bgcolor="'+bg_color+'" width="'+width+'" height="'+height+'" name="'+id+'" align="middle" ');
	document.write('allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}


// Son-Of-Sucker-Fish IE Hack
// -----------------------------------------------------------------
sfHover = function() {
  var sfEls = document.getElementById("nav").getElementsByTagName("LI");
  for (var i=0; i < sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
      this.className+=" sfhover";
    }
    sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
  }
 }
 if (window.attachEvent) window.attachEvent("onload", sfHover);


// Creates & writes out formatted date
// -----------------------------------------------------------------
function date(){
	var mydate = new Date();
	var year = mydate.getYear();
	if (year < 1000) year += 1900;
	var day = mydate.getDay();
	var month = mydate.getMonth();
	var daym = mydate.getDate();
	if (daym < 10) daym = "0" + daym;
	var dayarray = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	var montharray = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	document.write("<p>"+dayarray[day]+" "+montharray[month]+" "+daym+", "+year+"</p>");
}


// Add bookmark script
// -----------------------------------------------------------------
function addBookmark(title,url) {   
     if (window.sidebar) {   
          window.sidebar.addPanel(title, url,"");   
     } else if( document.all ) {   
          window.external.AddFavorite( url, title);   
     } else if( window.opera && window.print ) {   
          return true;   
     }   
}


 	