// Auto clear text in input boxes
function initClearText(item) { 
    switch (item.type) {
        case 'text':
        case 'password':
            if (item.className.match(/\binputbox\b/)) {
                /* Add event handlers */
                item.addEvents({
                    'focus': function (e) {
                        var target = window.event ? window.event.srcElement : e ? e.target : null;
                        if (!target) return;
                        if (target.value == target.defaultText) target.value = '';
                    },
                    'blur': function (e) {
                        var target = window.event ? window.event.srcElement : e ? e.target : null;
                        if (!target) return;
                        if (target.value == '' && target.defaultText) target.value = target.defaultText;
                    }
                });
                /* Save the current value */
                if (item.value != '') item.defaultText = item.value;
            }
            break;
        default:
    }
}

// End Autoclear

window.addEvent('domready', function() {
									 
	MOS_WEB_ROOT = '';
	
    // IE6 PNG Fix: Background images -- delete if not needed!
    if (document.all && document.styleSheets && document.styleSheets[0] && document.styleSheets[0].addRule) {
        document.styleSheets[0].addRule('#footer_content a', 'behavior: url(' + MOS_WEB_ROOT + 'iepngfix.htc)');
		document.styleSheets[0].addRule('#footer_content2 a', 'behavior: url(' + MOS_WEB_ROOT + 'iepngfix.htc)');
		document.styleSheets[0].addRule('#footer_content3 a', 'behavior: url(' + MOS_WEB_ROOT + 'iepngfix.htc)');
		document.styleSheets[0].addRule('#footer_content4 a', 'behavior: url(' + MOS_WEB_ROOT + 'iepngfix.htc)');
	 }
    
    // IE6 PNG fix: Images in source
    // Not sure if this is the best solution - use wisely!
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
    if ((version >= 5.5) && (document.body.filters)) {
        for(var i=0; i<document.images.length; i++) {
            var img = document.images[i]
            var imgName = img.src.toUpperCase()
            if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
                var imgID = (img.id) ? "id='" + img.id + "' " : ""
                var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                var imgStyle = "display:inline-block;" + img.style.cssText
                if (img.align == "left") {
                    imgStyle = "float:left;" + imgStyle
                }
                if (img.align == "right") {
                    imgStyle = "float:right;" + imgStyle
                }
                if (img.parentElement.href) {
                    imgStyle = "cursor:hand;" + imgStyle
                }
                var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
                img.outerHTML = strNewHTML
                i = i-1
            }
        }
    }
    
    // IE6 suckfish dropdown
    $$('#navigation li').each(function(item){
        item.addEvents({
            'mouseover' : function() {
                item.addClass('over');
            },
            'mouseout' : function() {
                item.removeClass('over');
            }
        })
    });
	
	 $$('input').each( function (item) { initClearText(item); }); 
});