
window.addEvent('domready', function() {

	var navigation = new Class({
		
		initialize: function(){
			
			var txtBoxes = $$('#gcmsAreaContent.forside .txt');

			var txtBoxesNoLink = txtBoxes.filter(function(item, index){
				return !item.getElement('a')
			});
			var txtBoxesHasLink = txtBoxes.filter(function(item, index){
				return item.getElement('a')
			});	
			var txtBoxesOffset = txtBoxes.filter(function(item, index){
				return item.getElement('a.offset')
			});				

			txtBoxes.each(function(item, index) {
								   
				var icon = item.getElements('img'); 
								   
				var overlay = new Element('a');
				overlay.addClass('overlay');
				overlay.inject(item);
				
				var desscription = new Element('a');
				desscription.addClass('description');
				desscription.inject(item);
				desscription.appendText( item.getProperty('description') );
			
				item.addEvents({
					'mouseover': function(){
						overlay.setStyle('display', 'none');
						icon.setStyle('filter', 'none');
					}
				});
				item.addEvents({
					'mouseout': function(){
						overlay.setStyle('display', 'block');
						icon.setStyle('filter', 'gray');
					}
				});
				
			});
			
			txtBoxesOffset.each(function(item, index) {
				var parentObj = item.getParent();
				parentObj.addClass('offset');
			});
						
			txtBoxesNoLink.addEvents({
				'click': function(){
					var thisURL = 	'http://husavisen.dk/' + 
									'boligemne.asp?side=vissag.htm###sag=' + this.get('extshort1') + '###mgl=3330###visalleesoft=1'
					MOOdalBox.open( 
						'/assets/src.asp?src=' + escape(thisURL), 
						this.get('description'),
						"860 520" 
					);
				}
			});
			
			txtBoxesHasLink.addEvents({
				'click': function(){
					location.href=this.get('extshort1'); 
				}
			});
			
		},
		
		clickAction: function(){
		}
	});
	var forsideObj = new navigation();
});

