function makeDropDown(node)
{
    node.onmouseover=function()
    {
        //alert("pre-over [" + this.className + "]");
        this.className=this.className.replace(" out", "");
        this.className=this.className.replace("out", "");
        this.className+=" over";
        //alert("over [" + this.className + "]");
    }
    node.onmouseout=function()
    {
        //alert("pre-out [" + this.className + "]");
        this.className=this.className.replace(" over", "");
        this.className=this.className.replace("over", "");
        this.className+=" out";
        //alert("out [" + this.className + "]");
    }
}

function retract(node)
{
    //node.className=node.className.replace(" over", "");
    //node.className+=" out";
    //alert("!");
}

function crawlLIs(myUL)
{
    //alert(myUL.childNodes.length);
    for (var i=0; i<myUL.childNodes.length; i++)
    {
        node = myUL.childNodes[i];
        //alert(i + " / " + node.nodeName);
        if (node.nodeName=="LI")
        {
            //alert('encountered li:'+i);
            makeDropDown(node);
            //alert('getnavchildren:'+i);
            getNavChildren(node);
            retract(node);
        }
        //alert("!");
    }
}

function getNavChildren(myLI)
{
    //alert("#" + myLI.childNodes.length + "#");
    for (var j=0;j<myLI.childNodes.length;j++)
    {
        //alert(j + " / " + node.nodeName);
        node = myLI.childNodes[j];
        if (node.nodeName=="UL")
        {
            crawlLIs(node);
        }
        //alert(myLI.childNodes[i].innerHTML);
    }
}

function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

function activatePlaceholders() {
var detect = navigator.userAgent.toLowerCase();
if (detect.indexOf("safari") > 0) return false;
var inputs = document.getElementsByTagName("input");
for (var i=0;i<inputs.length;i++) {
  if (inputs[i].getAttribute("type") == "text") {
   if (inputs[i].getAttribute("placeholder") && inputs[i].getAttribute("placeholder").length > 0) {
    inputs[i].value = inputs[i].getAttribute("placeholder");
	inputs[i].style.color = "#999999";
    inputs[i].onclick = function() {
     if (this.value == this.getAttribute("placeholder")) {
      	this.value = "";
     }
     return false;
    }
	inputs[i].onkeyup = function()
	{
		if ((this.value != this.getAttribute("placeholder")) && (this.value != ""))
		{
			this.style.color = "#000000";
		}
		else
		{
			this.style.color = "#999999";
		}
	}
    inputs[i].onblur = function() {
     if (this.value.length < 1) {
      this.value = this.getAttribute("placeholder");
     }
    }
   }
  }
}
}

function windowLoad() {
	activatePlaceholders();
	initRollovers();
	//startList();
	
		$('.scroll-pane').jScrollPane({scrollbarWidth:12, dragMaxHeight: 52});


}

window.onload = windowLoad;