/**
 * @author OK3
 */

var controller = {
	
	initialize : function () {
		// drop menu initialize
		this.dropper.init();
        // external links
        this.external();
	},
	
	orform : function (form)
	{	
		form.request({
  			onCreate: function() { $('status').update('Sending form..');  }
		});
	},
	
	toggle: function(obj)
	{
		elt = Element.extend(obj);
		elt.up().next(0).toggle();
		return false;
	},
	
	dropper: {		
		init: function(){
			$$('ul#menu li.drop').each(function(drop){
				drop.observe('mouseover', controller.dropper.drop);
				drop.observe('mouseout', controller.dropper.undrop);
			});
		},
		drop: function(){
			if (navigator.appName.match('Internet Explorer')) {
				this.setStyle({ marginBottom: -3 });
			}			
			elt = this.childElements()[1];
			elt.show().setStyle({ opacity: 0.95 });
		},
		undrop: function(){
			this.childElements()[1].hide();			
		}
	},
    
    external: function() {
        $$('a.ext').each(function(link){
            link.observe('click', function(evt){
                evt.stop();
                window.open(this);    
            });
        });
    },
	
	nw : function(url)
	{
		// old skool javascript
		window.open(url);
		return false;
	}
};

document.observe("dom:loaded", function () { controller.initialize(); });
