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 clearText(thefield){
if (thefield.defaultValue==thefield.value) thefield.value = "";
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function int_only(value) {
value = parseInt(value);
if(value<0) value = value * -1;
return (value) ? value+"" : "";
}

function BookMark_Page() {
if(document.all) {
window.external.AddFavorite(this.location,document.title);
} else {
alert("To bookmark page use (Ctrl+D)");
}
}

var ie4 = document.all ? 1 : 0;
var ns4 = document.layers ? 1 : 0;
var ns6 = window.netscape ? 1 : 0;
function addText(id,text) {

menuobj = (ie4) ? document.all[id] : (ns6 ? document.getElementById(id) : (ns4 ? document.layers[id] : ''));

if(ie4 || ns6) {
menuobj.innerHTML=text;
} else {
menuobj.document.open();
menuobj.document.write(text);
menuobj.document.close();
}

}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

var clickZoomImage;
function clickZoom(url,imgname,windowstatus) {
clickZoomImage=window.open(url,imgname,windowstatus);
if (window.focus) {
clickZoomImage.focus();
}
}
function checkClickZoom() {
if (clickZoomImage) {
clickZoomImage.close();
}
}

var layerDisplayStatus = new Array;
// switch layer visibility
function toggleLayerDisplay(whichLayer, status) {
// store current layer status
layerDisplayStatus[whichLayer] = status;
// status: 'none', 'block'
if (document.getElementById) {
// this is the way the standards work
document.getElementById(whichLayer).style.display = status;
}
else if (document.all) {
// this is the way old msie versions work
document.all[whichLayer].style.display = status;
}
else if (document.layers) {
// this is the way nn4 works
document.layers[whichLayer].display = status;
}
}

/////////////////////////////////////////////////////////////////////////////////////////
// DHTML MENU SWAP FIX
// This script solves the no-psuedo classes for IE problem with the dhtml menu

// Detect IE
var isIE = (navigator.userAgent.toLowerCase().indexOf("msie") > 0) ? true : false;

sfHover = function() {
   if (isIE) {
	  if (document.getElementById("primaryNav")!=undefined) { //
      var sfEls = document.getElementById("primaryNav").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"), "");
         }
      }
	  } //
   }
}

var _Event = {  
    DOMEvents : new Array(),   
    addDOMEvent : function(a,b,c)
    {
        if(window.addEventListener)
            a.addEventListener(b,c,true);
        else
            a.attachEvent('on'+b,c);    
        var h = new _EventHandle(a,b,c)    
        _Event.DOMEvents.push(h);
        return h;
    },
    releaseDOMEvent : function(h)
    {
       var i = _Event.DOMEvents.index(h);
       if(i != -1)
       {
          if(window.removeEventListener)
             h.source.removeEventListener(h.method,h.handler,true);
          else
             h.source.detachEvent("on"+h.method,h.handler);
          _Event.DOMEvents.splice(i,1);
       }
    },
    releaseDOMEvents : function()
    {
       var e = _Event.DOMEvents;
       for(var i=0;i<e.length;i++)
       {
          _Event.releaseDOMEvent(e[i]);
       }
    }
}
function _EventHandle(a,b,c)
{
	this.source = a;
	this.method = b;
	this.handler = c;
}

function loadMenu()
{
	var d = document.getElementById("primaryNav");
	var children = d.childNodes;
	for(var i=0;i<children.length;i++)
	{
		var child = children.item(i);
		function fixScope()
		{
			var c = child;
			var ds = c.getElementsByTagName("div");
			if (ds.length == 1)
			{
				var d = ds[0];
				_Event.addDOMEvent(c,"mouseover",function(){
					d.style.visibility = "visible";
					d.style.zIndex = "99";
				});
				_Event.addDOMEvent(c,"mouseout",function(){
					d.style.visibility = "hidden";
					d.style.zIndex = "-1";
				});
			}
		}
		if(child.nodeName != "#text")
			fixScope();
	}
}
_Event.addDOMEvent(window,"load",loadMenu);

/*-----------------------------------------------------------*/
