window.addEvent('domready', function() {

if ( $('navigation')!=null){
// find all the navigation items and use this fix to keep parent active while on sub ul //
$('navigation').getElements('li').each(function(el){
// set a class on all sub li elements //
el.className="ienot";
// set events on all sub li elements //
el.addEvents({
    'mouseenter': function(){
       this.className = "iehover";
    },
    'mouseleave': function(){
       this.className = "ienot";
    
    }
	});

});

}

if ( $('category-navigation')!=null){
// find all the navigation items and use this fix to keep parent active while on sub ul //
$('category-navigation').getElements('li').each(function(de){
// set a class on all sub li elements //
de.className = "ienot";
// set events on all sub li elements //
de.addEvents({
    'mouseenter': function(){
         this.className = "opensub";
    },
    'mouseleave': function(){
         this.className = "ienot";
    } 
	});

});

}

if ( $('coffee-bin')!=null){
// find if roast meter is active and in place //
$('coffee-bin').getElements('a').each(function(ds){
// set events on all sub li elements //
myBin = $('coffee-bin').className;

ds.addEvents({
    'mouseenter': function(){
     document.getElementById(myBin).innerHTML="&nbsp;"+this.innerHTML;
    },
    'mouseleave': function(){
     document.getElementById(myBin).innerHTML="";  
    } 
	});

});

}

if ( $('coffee-bin-short')!=null){
// find if second roast meter is active and in place //
$('coffee-bin-short').getElements('a').each(function(fs){
// set events on all sub li elements //
myBinShort = $('coffee-bin-short').className;

fs.addEvents({
    'mouseenter': function(){
     document.getElementById(myBinShort).innerHTML="&nbsp;"+this.innerHTML;
    },
    'mouseleave': function(){
     document.getElementById(myBinShort).innerHTML="";  
    } 
	});

});

}

if ( $('sendToAFriend')!=null){
		//example of a single element onto which an overlay event is being added.
		$('sendToAFriend').addEvent('click',function(e){
			e.preventDefault();
			var link = this.get('href');
			window.open (link , 'TellAFriend', 'height=420,width=568,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no');

		});

}
});


function moreLess(divId,aId){
	var myState = $(divId).style.display;
	if(myState!="block"){
		$(divId).style.display ="block";
		$(aId).innerHTML="Close >";
		}else{
		$(divId).style.display ="none";
		$(aId).innerHTML="More >";
	}


}






