var javascript_rules = {

}
Behaviour.register(javascript_rules);

var flash_rules = {
    '#productsubmenu' : function(el) {
        var FOSubmenu = {
                movie:"/flash/submenu.swf",
                flashvars: 'xmlURL=/groups.php',
                width:"500",
                height:"300",
                menu:"false",
                wmode:"transparent",
                xi:"true",
                majorversion:"7",
                build:"0"
        };
        UFO.create(FOSubmenu,"productsubmenu");
    },
    '#productsubmenu2' : function(el) {
        var FOSubmenu = {
                movie:"/flash/submenu2.swf",
                flashvars: 'xmlURL=/groups2.php',
                width:"500",
                height:"300",
                menu:"false",
                wmode:"transparent",
                xi:"true",
                majorversion:"7",
                build:"0"
        };
        UFO.create(FOSubmenu,"productsubmenu2");
    },
    '#refsubmenu' : function(el) {
        var FORefmenu = {
                movie:"/flash/submenu.swf",
                flashvars: 'xmlURL=/groups_ref.php',
                width:"500",
                height:"300",
                menu:"false",
                wmode:"transparent",
                xi:"true",
                majorversion:"7",
                build:"0"
        };
        UFO.create(FORefmenu,"refsubmenu");
    },
    '#refsubmenu2' : function(el) {
        var FORefmenu = {
                movie:"/flash/submenu2.swf",
                flashvars: 'xmlURL=/groups_ref2.php',
                width:"500",
                height:"300",
                menu:"false",
                wmode:"transparent",
                xi:"true",
                majorversion:"7",
                build:"0"
        };
        UFO.create(FORefmenu,"refsubmenu2");
    },
    '#flash' : function(el) {
        var FOBanner = {
                movie:"/flash/feeler.swf",
                width:"251",
                height:"436",
                menu:"false",
                wmode:"transparent",
                xi:"false",
                majorversion:"7",
                build:"0"
        };
        UFO.create(FOBanner,"flash");
    }
}
Behaviour.register(flash_rules);

var rollover_rules = {
    'img.rollover' : function(el) {
        el.onmouseover = function() {
            if (this.style.cssText.match(/src=/) != null) {
                parts = this.style.cssText.match(/src='(.+)\.(\w+)'/);
                if (parts[1] != null && parts[1].match(/_ro/) == null) {
                    this.style.cssText = this.style.cssText.replace(/src='.*'/,"src='" + parts[1] + "_ro." + parts[2] + "'");
                }
            } else {
                parts = this.src.match(/^(.+)\.(\w+)$/);
                if (parts[1] != null && parts[1].match(/_ro/) == null ) {
                    this.src = parts[1] + "_ro." + parts[2];
                }
            }
        };
        el.onmouseout = function() {
            if (this.style.cssText.match(/src=/) != null) {
                parts = this.style.cssText.match(/src='(.+)_ro\.(\w+)'/);
                if (parts != null) {
                    this.style.cssText = this.style.cssText.replace(/src='.*'/,"src='" + parts[1] + "." + parts[2] + "'");
                }
            } else {
                parts = this.src.match(/^(.+)_ro\.(\w+)$/);
                if (parts != null ) {
                    this.src = parts[1] + "." + parts[2];
                }
            }
        }
    },
    'a.rollover_orange' : function(el) {
        el.onmouseover = function() {
            var image = this.getElementsByTagName("img")[0];
            var parts = image.src.match(/^(.+)\.(\w+)$/);
            if (parts[1] != null && parts[1].match(/_orange/) == null ) {
                image.src = parts[1] + "_orange." + parts[2];
            }
        };
        el.onmouseout = function() {
            var image = this.getElementsByTagName("img")[0];
            var parts = image.src.match(/^(.+)_orange\.(\w+)$/);
            if (parts != null ) {
                image.src = parts[1] + "." + parts[2];
            }
        }
    },
    'ul.nav li' : function(el) {
        el.onmouseover = function() {
            this.className = 'MenuItemOver';
        };
        el.onmouseout = function() {
            this.className = 'MenuItem';
        };
    }
}
Behaviour.register(rollover_rules);
var popup_rules = {
    'a.popup' : function(el) {
        el.onclick = function() {
            window.open(this.href,
                'PopUp',
                'width=684,height=350,top=200,left=50%,scrollbars=0,status=no,resizable=0,toolbar=0,titlebar=0,menubar=0,location=0');
            return false;
        }
    },
    'a.status' : function(el) {
        el.onmouseover = function() {
            window.status=this.title;
            return true;
        };
        el.onmouseout = function() {
            window.status='';
            return true;
        }
    }
}
Behaviour.register(popup_rules);
var form_rules = {
    'input.auto_upper' : function(el) {
        el.onblur = function() {
            toUpper(this)
        };
        el.onchange = function() {
            toUpper(this)
        };

    },
	  '.auto_blur' : function(el) {
        if (typeof el.onfocus == 'function') {
            var cascade = el.onfocus;
        }
        el.onfocus = function() {
            if (typeof cascade == 'function') {
                cascade.call(this);
            }
            this.className = this.className.replace('_off','_on');
            var fieldLabel = $(this.id + '_label');
            if (fieldLabel) {
            	  fieldLabel.className = fieldLabel.className.replace('_off','_on');
                var image = fieldLabel.getElementsByTagName('img')[0];
                if (image) {
                    image.src = image.src.replace('_normal','_hover');
                }
            }
        };
        el.onblur = function() {
            this.className = this.className.replace('_on','_off');
            var fieldLabel = $(this.id + '_label');
            if (fieldLabel) {
            	  fieldLabel.className = fieldLabel.className.replace('_on','_off');
                var image = fieldLabel.getElementsByTagName('img')[0];
                if (image) {
                    image.src = image.src.replace('_hover','_normal');
                }
            }
        }
    },
    'input.auto_clear' : function(el) {
        if (typeof el.onfocus == 'function') {
            var cascadeOnFocus = el.onfocus;
        }
        el.onfocus = function() {
            if (typeof cascadeOnFocus == 'function') {
                cascadeOnFocus.call(this);
            }
            if (this.className.search('auto_clear') >= 1) {
                this.value='';
            }
            this.className=this.className.replace('auto_clear','');
        }
    },
    'input.rollover' : function(el) {
        el.onmouseover = function() {
            if (this.className.search('selected') == -1) {
                this.src = this.src.replace('_normal','_hover');
            }
        };
        el.onmouseout = function() {
            if (this.className.search('selected') == -1) {
                this.src = this.src.replace('_hover','_normal');
            }
        };
    }
}
Behaviour.register(form_rules);