// addthis Hover Delay and CDATA moved over from the JavaScript file 02-18-2010 - SPU UC Web Team JL
var addthis_hover_delay = 150;

 //<![CDATA[
  var rootVirtual = '/';
  var isIE = false;
  var isIE6 = false;
 //]]>

// start IE CSS3 shims
var FixIE = {
	addClasses: function(selectorClassPair) {
		for (var selector in selectorClassPair) {
			var elements = $$(selector), cssClass = selectorClassPair[selector];
			elements.invoke('addClassName', cssClass);
		}
	},
	addHoverClasses: function(selectorClassPair) {
		for (var selector in selectorClassPair) {
			var elements = $$(selector), cssClass = selectorClassPair[selector];
			elements.each(function(el, index) {
				el.observe('mouseenter', function(){
					el.addClassName(cssClass);
				});
				el.observe('mouseleave', function(){
					el.removeClassName(cssClass);
				});
			});
		}
	}
}
// end IE CSS3 shims


// start SelectAndGo
var SelectAndGo = Class.create ({
	initialize: function(selectbox)
	{
		this.selectbox = selectbox;
			this.sbOptions = this.selectbox.childElements();
			this.length = this.sbOptions.size();
		//always set the first option as default
		this.sbOptions[0].selected = 'selected';
		this.selectbox.observe('change', this.__Change.bindAsEventListener(this));
	},
	__Change: function(e)
	{
		var sbVal = $F(this.selectbox);
		//if first option, do nothing (should never fire)
		if (sbVal == this.sbOptions[0].value){return;}
		this.GoLink(sbVal);
	},
	GoLink: function(sbVal)
	{
		document.location = sbVal;
	}
});
// end SelectAndGo


// start PrintPage
var PrintPage = Class.create ({
	initialize: function(link)
	{
		this.link = link;
		this.link.observe('click', this.__Click.bindAsEventListener(this));
	},
	__Click: function(e)
	{
		e.stop();
		this.Print();
	},
	Print: function()
	{
		window.print();
	}
});
// end PrintPage


// start TextareaMaxlength
var TextareaMaxlength = Class.create ({
	initialize: function(textarea, maxlength)
	{
		this.textarea = textarea;
		this.maxlength = maxlength;
		this.textarea.observe('keyup', this.__Keyup.bindAsEventListener(this));
	},
	__Keyup: function(e)
	{
		e.stop();
		this.Enforce();
	},
	Enforce: function()
	{
		if ($F(this.textarea).length >= this.maxlength)
		{
			this.textarea.value = $F(this.textarea).substring(0, this.maxlength);
		}
	}
});
// end TextareaMaxlength


// start PopupWindow
var PopupWindow = Class.create ({
	initialize: function(link, width, height, extras)
	{
		this.winName = 'popup';
		this.altWidth = 640;
		this.altHeight = 360;
		this.altExtras = 'location=no,menubar=no,statusbar=no,toolbar=no,scrollbars=no,resizable=yes';
		this.link = link;
		this.url = link.getAttribute('href');
		this.w = width || this.altWidth;
		this.h = height || this.altHeight;
		this.x = extras || this.altExtras;
		this.features = 'width=' + this.w + ',height=' + this.h + ',' + this.x;
		this.link.observe('click', this.__Click.bindAsEventListener(this));
	},
	__Click: function(e)
	{
		e.stop();
		var win = window.open(this.url, this.winName, this.features);
		win.focus();
	}
});
// end PopupWindow


// start ClosePopup
var ClosePopup = Class.create ({
	initialize: function(link)
	{
		this.link = link;
		this.link.observe('click', this.__Click.bindAsEventListener(this));
	},
	__Click: function(e)
	{
		e.stop();
		window.close();
	}
});
// end ClosePopup


// Begin Falcon-Software Changes
document.observe('dom:loaded', function () {

    // mySPU button
    $$(".mySPUmenu").invoke('observe', 'mouseover', function (event) {
        this.setStyle({ cursor: 'pointer' });
        $('lockImage').src = "/_ui/img/mySPU-hover.png"
        //Effect.Appear('contentDivImg', { duration: 0.2 });
        $('contentDivImg').show();
    });
    $$(".mySPUmenu").invoke('observe', 'mouseout', function (event) {
        $('lockImage').src = "/_ui/img/mySPU.png"
        //Effect.Fade('contentDivImg', { duration: 0.1 });
        $('contentDivImg').hide();
    });

    // Search box
    $('uxGlobalSearchText').onfocus = function () {
        if (this.getValue() == "Search") {
            $('uxGlobalSearchText').value = "";
        }
    }

    $('uxGlobalSearchText').onblur = function () {
        if (this.getValue() == "") {
            $('uxGlobalSearchText').value = "Search";
        }
    }

});

