function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=2,location=0,statusbar=1,menubar=0,resizable=0,width=650,height=525,left = 100,top = 134');");
}
function popUpSmall(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=2,location=0,statusbar=1,menubar=0,resizable=0,width=200,height=150,left = 100,top = 134');");
}
// load htmlarea
	_editor_url = "";                     // URL to htmlarea files
	var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
	if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
	if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
	if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
	if (win_ie_ver >= 5.5) {
		 document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
		 document.write(' language="Javascript1.2"></scr' + 'ipt>');  
	} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
	

browserName = navigator.appName; 
browserVer = parseInt(navigator.appVersion); 

ns3up = (browserName == "Netscape" && browserVer >= 3); 
ie4up = (browserName.indexOf("Microsoft") >= 0 && browserVer >= 4); 

function doPic(imgName) { 
if (ns3up || ie4up) { 
imgOn = ("" + imgName); 
document.mainpic.src = imgOn; 
} 
}




 // Rollover  v2.0.1
// documentation: http://www.dithered.com/javascript/rollover/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)


function isDefined(property) {
  return (typeof property != 'undefined');
}

var rolloverInitialized = false;
function rolloverInit() {
   if (!rolloverInitialized && isDefined(document.images)) {
      
      // get all images (including all <input type="image">s)
      // use getElementsByTagName() if supported
      var images = new Array();
      if (isDefined(document.getElementsByTagName)) {
         images = document.getElementsByTagName('img');
         var inputs = document.getElementsByTagName('input');
         for (var i = 0; i < inputs.length; i++) {
            if (inputs[i].type == 'image') {
               images[images.length] = inputs[i];
            }
         }
      }
      
      // otherwise, use document.images and document.forms collections
      // remove if not supporting IE4, Opera 4-5
      else {
         images = document.images;
         inputs = new Array();
         for (var formIndex = 0; formIndex < document.forms.length; formIndex++) {
            for (var elementIndex = 0; elementIndex < document.forms.elements.length; elementIndex++) {
               if (isDefined(document.forms.elements[i].src)) {
                  inputs[inputs.length] = document.forms.elements[i];
               }
            }
         }
      }
      
      // get all images with '_off.' in src value
      for (var i = 0; i < images.length; i++) {
         if (images[i].src.indexOf('_off.') != -1) {
            var image = images[i];
            
            // store the off state filename in a property of the image object
            image.offImage = new Image();
            image.offImage.src = image.src;
            
            // store the on state filename in a property of the image object
            // (also preloads the on state image)
            image.onImage = new Image();
            image.onImage.imageElement = image;
            
            // add onmouseover and onmouseout event handlers once the on state image has loaded
            // Safari's onload is screwed up for off-screen images; temporary fix
            if (navigator.userAgent.toLowerCase().indexOf('safari') != - 1) {
               image.onmouseover = function() {
                  this.src = this.onImage.src;
               };
               image.onmouseout = function() {
                  this.src = this.offImage.src;
               };
            }
            else {
               image.onImage.onload = function() {
                  this.imageElement.onmouseover = function() {
                     this.src = this.onImage.src;
                  };
                  this.imageElement.onmouseout = function() {
                     this.src = this.offImage.src;
                  };
               };
            }
            
            // set src of on state image after defining onload event handler
            // so cached images (that load instantly in IE) will trigger onload
            image.onImage.src = image.src.replace(/_off\./, '_on.');
         }
      }
   }
   rolloverInitialized = true;
}

// call rolloverInit when document finishes loading
if (isDefined(window.addEventListener)) {
   window.addEventListener('load', rolloverInit, false);
}
else if (isDefined(window.attachEvent)) {
   window.attachEvent('onload', rolloverInit);
}


// Image Preloader  v1.0.1
// documentation: http://www.dithered.com/javascript/image_preloader/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)


function preloadImages() {
	if (document.images) {
		for (var i = 0; i < preloadImages.arguments.length; i++) {
			(new Image()).src = preloadImages.arguments[i];
		}
	}
}


// function to show & hide content
function hidedivs(id) { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById(id).style.display = 'none'; 
	} 
} 

function showdivs(id) { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById(id).style.display = 'block';
	} 
}
// end function to show & hide content
 
 
 // this function is needed to work around 
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttribute("class") != null) {
         result = obj.getAttribute("class").value;
     }
     return result;
  }   

 function stripe(id) {

    // the flag we'll use to keep track of 
    // whether the current row is odd or even
    var even = false;
  
    // if arguments are provided to specify the colours
    // of the even & odd rows, then use the them;
    // otherwise use the following defaults:
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
  
    // obtain a reference to the desired table
    // if no such table exists, abort
    var table = document.getElementById(id);
    if (! table) { return; }
    
    // by definition, tables can have more than one tbody
    // element, so we'll have to get the list of child
    // &lt;tbody&gt;s 
    var tbodies = table.getElementsByTagName("tbody");

    // and iterate through them...
    for (var h = 0; h < tbodies.length; h++) {
    
     // find all the &lt;tr&gt; elements... 
      var trs = tbodies[h].getElementsByTagName("tr");
      
      // ... and iterate through them
      for (var i = 0; i < trs.length; i++) {

        // avoid rows that have a class attribute
        // or backgroundColor style
        if (! hasClass(trs[i]) &&
            ! trs[i].style.backgroundColor) {
 		  
          // get all the cells in this row...
          var tds = trs[i].getElementsByTagName("td");
        
          // and iterate through them...
          for (var j = 0; j < tds.length; j++) {
        
            var mytd = tds[j];

            // avoid cells that have a class attribute
            // or backgroundColor style
            if (! hasClass(mytd) &&
                ! mytd.style.backgroundColor) {
        
              mytd.style.backgroundColor =
                even ? evenColor : oddColor;
            
            }
          }
        }
        // flip from odd to even, or vice-versa
        even =  ! even;
      }
    }
  }
  

/* function for jump menus */
function openURL()
{ 

// grab index number of the selected option
selInd = document.theForm.jumpMenu.selectedIndex; 

// get value of the selected option
goURL = document.theForm.jumpMenu.options[selInd].value;

// redirect browser to the grabbed value (hopefully a URL)
top.location.href = goURL; 

}


function isBlank(str) 
{

	var c, undef;
	if (str==undef)  return true; 
	if (str==null || str=="")  return true; 
	for (var i=0; i<str.length; i++) {
		c = str.charAt(i);
		if ((c != " ") && (c != "\\n") && (c != "\\t")) {
			return false;
		}
	}
	if (str==null || str=='') return true; 
	return false;
}

function checkIntegerKeyDown(elem) {
	window[elem.name+"_value"] = elem.value;
}

function checkIntegerKeyUp(elem) {
	if (!elem.value.match(/^\d*$/)) {
		elem.value = window[elem.name+"_value"];
	}
}




function getSelect(select) {
	var undef, options = select.options;
	for (var i=0; i<options.length; i++) {
		if (options[i].selected == true) {
			return options[i].value;
		}
	}
	return undef;
}

function setSelect(select, value) {
	var opts = select.options;
	for (var i=0; i<opts.length; i++) {
		if (opts[i].value == value) {
			opts[i].selected = true;
			return i;
		}
	}
	return -1;
}

function clearSelect(select) {
	select.options.length = 0;
}

function setRootSelect(rootSelect, rootArray, babySelects) {
	var i, pos=0, form=rootSelect.form;

	var opts = rootSelect.options;
	opts.length = 0;

	for (i=0; i<rootArray.length; i+=3) {
		opts[opts.length]
			= new Option(rootArray[i+1], rootArray[i], false, false);
	}
	if (form["_"+rootSelect.name]) {
		pos = setSelect(rootSelect, form["_"+rootSelect.name].value);
		if (pos < 0) { pos=0; }
	} else {
		opts[0].selected = true;
	}

	if (babySelects != null) {
		var parentArray = rootArray;
		var select;

		for (i=0; (i<babySelects.length && parentArray != null); i++) {
			setChildSelect(babySelects[i], parentArray, pos, null);

			parentArray = parentArray[(pos*3)+2];

			if (form["_"+babySelects[i].name]) {
				pos = setSelect(babySelects[i],
					form["_"+babySelects[i].name].value);
				if (pos < 0) { pos = 0; }
			} else {
				pos = 0;
			}
		}
	}
}

function setChildSelect(childSelect, parentArray, pos, babySelects) {
	var i, form=childSelect.form;

	var childArray = parentArray[(pos*3)+2];

	if (childArray == null) {
		clearSelect(childSelect);
		childSelect.style.visibility = "hidden";

	} else {
		var opts = childSelect.options;
		opts.length = 0;

		for (i=0; i<childArray.length; i+=3) {
			opts[opts.length]
				= new Option(childArray[i+1], childArray[i], false, false);
		}
		if (form["_"+childSelect.name]) {
			setSelect(childSelect, form["_"+childSelect.name].value);
		} else {
			opts[0].selected = true;
		}

		childSelect.style.visibility="visible";
	}

	if (babySelects != null) {
		parentArray = childArray;
		for (i=0; i<babySelects.length; i++) {
			if (parentArray == null) {
				clearSelect(babySelects[i]);
				babySelects[i].style.visibility="hidden";
			} else {
				setChildSelect(babySelects[i], parentArray, 0, null);
				parentArray = parentArray[2];
			}
		}
	}

	return;
}