﻿function load_content_into(container, url, callback) {
    var params = "&hash=" + Math.random();

    var contentAjax = new Ajax.Updater( {success: container},
        url, {
            method: 'get',
            parameters: params,
            evalScripts: true
        }
    );
}



function toggle_first_matching_child(elt, tag) {
	var children = elt.childNodes;
	for (var i = 0; i < children.length; i++) {
		if (children[i].nodeName == tag) {
			Element.toggle(children[i]);
			break;
		}
	}
}
			 
			 
function writesubnav(elt, tag) {
	var children = elt.childNodes;
	for (var i = 0; i < children.length; i++) {
		if (children[i].nodeName == tag) {
			$('subnav').innerHTML = children[i].innerHTML;
			break;
		}
	}
}
	
function unwritesubnav(elt, tag) {
	$('subnav').innerHTML = "";
}	
		 
var rules = {			
    '.menu_item' : {
        onmouseover : function() { this.style.color = '#006699'; toggle_first_matching_child(this, "TABLE"); },
        onmouseout : function() { this.style.color = 'black'; toggle_first_matching_child(this, "TABLE"); }
    },
    '.menu_item td' :{
        onmouseover : function() { this.style.background = '#c8c8c8'; },
        onmouseout : function() { this.style.background = 'white'; }    
    }
};

Behavior.register(rules);