//when the DOM is ready, create a MooMenu instance
window.addEvent('domready', function() { 	
	
	var menu1 = new MooMenu({ 
		orientation:'vertical',
		tweakInitial:{x:0,y:-1},
		tweakSubsequent:{x:-1,y:0}	
	});	
	
	
	
});

window.addEvent('load',function(){
	if(Browser.Engine.trident4){
		(function(){ fix4IE6(); }).delay(1000);
	}else{
		$('aside').setStyles({'position':'fixed'});
		$(document.body).getElements('#subMenusContainer').each(function(item,index){
			item.setStyles({'position':'fixed'});
		});
		//$('subMenusContainer').setStyles({'position':'fixed'});
	}
});


function fix4IE6(){
	var navHeight = $('nav').getSize().y + 20;
	$('aside').setStyles({'height':navHeight});
	

	$(window).addEvents({
		'scroll': function(e){
				adjustbrImage();							
		}.bind(this),
		'load': function(e){
				adjustbrImage();							
		}.bind(this),
		'resize': function(e){
				adjustbrImage();							
		}.bind(this)
	});

}

function adjustbrImage(){
	$('brImage').setStyles({'top':$(window).getScroll().y +($(window).getSize().y - $('brImage').getSize().y )});
}

function copyToClipboard(s)
{
	if( window.clipboardData && clipboardData.setData )
	{
		clipboardData.setData("Text", s);
	}
	else
	{
		// You have to sign the code to enable this or allow the action in about:config by changing
		user_pref("signed.applets.codebase_principal_support", true);
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

		var clip; Components.classes['@mozilla.org/widget/clipboard;[[[[1]]]]'].createInstance(Components.interfaces.nsIClipboard);
		if (!clip) return;

		// create a transferable
		var trans = Components.classes['@mozilla.org/widget/transferable;[[[[1]]]]'].createInstance(Components.interfaces.nsITransferable);
		if (!trans) return;

		// specify the data we wish to handle. Plaintext in this case.
		trans.addDataFlavor('text/unicode');

		// To get the data from the transferable we need two new objects
		var str = new Object();
		var len = new Object();

		var str = Components.classes["@mozilla.org/supports-string;[[[[1]]]]"].createInstance(Components.interfaces.nsISupportsString);

		var copytext=meintext;

		str.data=copytext;

		trans.setTransferData("text/unicode",str,copytext.length*[[[[2]]]]);

		var clipid=Components.interfaces.nsIClipboard;

		if (!clip) return false;

		clip.setData(trans,null,clipid.kGlobalClipboard);	   
	}
}