// JavaScript Document
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);

function $$(searchClass, node, tag){
   //shorthand getelementsbyclass
   return getElementsByClass(searchClass, node, tag);
}
  
function $(element) {
   //shorthand getelementbyid, works with multiple ids, returns obj, or array of obj
   if (arguments.length > 1) {
   for (var i = 0, elements = [], length = arguments.length; i < length; i++) elements.push($(arguments[i]));
   return elements;
   }
  
   if (typeof element == 'string') element = document.getElementById(element);
   return element;
}

function getElementsByClass(searchClass, node, tag){
   var classElements = new Array();
   if(node == null) node = document;
   if(tag == null) tag = '*';
   var els = node.getElementsByTagName(tag);
   var elsLen = els.length;
   var pattern = new RegExp("(^|\s)"+searchClass+"(\s|$)");
   for (i = 0, j = 0; i < elsLen; i++){
   if(pattern.test(els[i].className)){
   classElements[j] = els[i];
   j++;
   }
   }
  
   return classElements;
}

function createRollover(element) {
    element.out = element.src;
    element.over = new Image();
    element.over.src = element.src.replace(/.jpg/, "_over.jpg");
    element.onmouseover = function() {
      this.src = this.over.src;
    }
    element.onmouseout = function() {
      this.src = this.out;
    }
}
function createDrop(element) {
    co = document.createElement("div");
    pd = element.cloneNode(true);
    ar = document.createElement("div");
    h1 = document.createElement("h1");
    sp = document.createElement("span");
    text = document.createTextNode(element.getAttribute("title")); 
    sp.appendChild(text); 
    h1.appendChild(sp); 
    ar.appendChild(h1); 
    co.appendChild(ar); 
    co.appendChild(pd); 
    element.parentNode.replaceChild(co, element);
    co.className = "blublock";
    co.style.cursor = "pointer";
    co.onclick = function () {
      if(this.childNodes[1].style.display == "") {
        this.childNodes[0].childNodes[0].style.background = "url(images/jsdrop_up.gif) no-repeat right center";
        this.childNodes[1].style.display = "none";
      } else {
        this.childNodes[0].childNodes[0].style.background = "url(images/jsdrop_down.gif) no-repeat right center";
        this.childNodes[1].style.display = "";
      }
    };
    ar.style.padding = "0px";
    ar.style.background = "url(images/i95_horz_fade.gif) repeat-x bottom left";
    h1.style.background = "url(images/jsdrop_up.gif) no-repeat right center";
    pd.className = "pad";
    pd.style.display = "none";
}


	function fixPNGs(){
		//this only fixes IMG tags. Background images are too hard to fix - too many problems with repeat, position, etc.
		if (!needPNGFix) return;
		elms=document.getElementsByTagName('img');
		var x=0;
		for(var x=0, len=elms.length; x<len; x++) {
			if(!elms[x].onload && elms[x].src && elms[x].src.toUpperCase().indexOf('SPACER.PNG')==-1 && elms[x].src.toUpperCase().indexOf('.PNG')!=-1 &&!elms[x].getAttribute('nopngfix')){
				fixPNG(elms[x]);
			}
		}
		return;
	}

	function fixPNG(imgobj){
		if (!needPNGFix && !imgobj.getAttribute('forcepngfix')) return;
		if(imgobj.src.toUpperCase().indexOf('SPACER.PNG')==-1 && imgobj.src.toUpperCase().indexOf('.PNG')!=-1 && !imgobj.getAttribute('nopngfix')){
			src=String(imgobj.src); //non enum
			var simg=new Image;
			simg.src=src;
			//status=(src + ': ' + simg.width + 'x' + simg.height);

			imgobj.src='images/spacer.gif';
			if (imgobj.getAttribute('sizingmethod')) imgobj.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + src + ', sizingMethod=' + imgobj.getAttribute('sizingmethod') + ')';
			else imgobj.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + src + ')';
			
			if (!imgobj.style.pixelWidth) {
				imgobj.style.pixelWidth=simg.width;
				imgobj.style.pixelHeight=simg.height;
			}
		}
	}
	
var isIE=navigator.appVersion.toUpperCase().indexOf("MSIE")!=-1;
var isIE7=isIE ? (parseFloat(navigator.appVersion.split("MSIE")[1])==7): false;
var needPNGFix=(isIE && !isIE7);
window.onload = prepare;

function prepare() {
  var co = $$("rollover", document, "*");
  for(i=0; i<co.length; i++) {
    createRollover(co[i]);
  }
  var co = $$("jsdrop", document, "*");
  for(i=0; i<co.length; i++) {
    createDrop(co[i]);
  }
  fixPNGs();
}


// Copyright information must stay intact
// WinOpen v1.0
// Copyright NavSurf.com 2002, all rights reserved
// For more scripts, visit NavSurf.com at http://navsurf.com

// Set the input argument to true to enable the window feature
function winOpen(URL, windowName, width, height, resizable, location, menubar, scrollbars, status, toolbar){
	var windowFeatures;
	windowFeatures = '';
	if (width != '' && width != null){
		windowFeatures = windowFeatures+'width='+width+',';
	}
	if (height != '' && height != null){
		windowFeatures = windowFeatures+'height='+height+',';
	}
	if (resizable){
		windowFeatures = windowFeatures+'resizable,';
	}
	if (location){
		windowFeatures = windowFeatures+'location,';
	}
	if (menubar){
		windowFeatures = windowFeatures+'menubar,';
	}
	if (scrollbars){
		windowFeatures = windowFeatures+'scrollbars,';
	}
	if (status){
		windowFeatures = windowFeatures+'status,';
	}
	if (toolbar){
		windowFeatures = windowFeatures+'toolbar,';
	}
	window.open(URL, windowName, windowFeatures);
}
