var Rules = {
	"dl#menu dt:click":function(element) {
		$$('dl#menu dt').each(function(dtElement) {
			Element.removeClassName(dtElement, 'selected');
		});
		
		Element.addClassName(element, 'selected');
		
		$$('dl#specialItems dt').each(function(dtElement) {
			Element.removeClassName(dtElement, 'selected');
		});
		
		if (element.innerHTML != 'prodotti') {
			$('screen').style.border = '1px #cccccc solid';
			$('screen').style.background = "url(/images/greyPixel.png) repeat";
			$('content').style.width = '729px';
			$('content').style.height = '413px';
		}
		
		silgaController.activeSection = element.innerHTML;
		silgaController.sectionSwitcher();
	},
	
	"#logo:click": function() {
		$$('dl#menu dt').each(function(dtElement) {
			Element.removeClassName(dtElement, 'selected');
		});
		
		silgaController.activeSection = 'home';
		document.location.href = "/";
	},
	
	"dl#specialItems dt:click":function(element) {
		$('content').innerHTML = "";
		
		if ($('sidebar').style.display != "none"){
			silgaController.closeProducts();
		}
		
		$$('dl#menu dt').each(function(dtElement) {
			Element.removeClassName(dtElement, 'selected');
		});
		
		$$('dl#specialItems dt').each(function(dtElement) {
			Element.removeClassName(dtElement, 'selected');
		});
		
		color="";
		bgcolor="";
		
		switch(element.id) {
			case 'blue': color = "99ccff"; section="/home/special/aliko"; bgcolor = "bluePixel.png"; break;
			case 'green': color = "99cc66"; section="/home/special/kottura"; bgcolor = "greenPixel.png"; break;
			case 'red': color = "ff6666"; section="/home/special/teknotherm"; bgcolor = "redPixel.png"; break;
			case 'yellow': color = "ffcc33"; section="/home/special/teknologie"; bgcolor = "yellowPixel.png"; break;
		}
		
		if (silgaController.slideshow != '') silgaController.slideshow.stop();
		
		new Effect.Fade('content', {duration:0.5, afterFinish: function(){
			new Ajax.Updater('content', '/home/change_section?section='+section, {asynchronous:true,
																										evalScripts:true,
																										onComplete: function() {
																											new Effect.Appear('content', {duration: 0.5, direction: 'top-left'});
																										}});
		}});
		
		
		$('screen').style.border = '1px #'+color+' solid';
		$('screen').style.background = "url(/images/"+bgcolor+") repeat";
		Element.addClassName(element, 'selected');
	},
	
	"div#sidebar dt:click":function(element) {
		$$('div#sidebar dt').each(function(dtElement) {
			Element.removeClassName(dtElement, 'selected');
		});
		
		Element.addClassName(element, 'selected');
		
		if (silgaController.slideshow != '') silgaController.slideshow.stop();
		
		new Effect.Fade('content', {duration:0.5, afterFinish: function(){
			new Ajax.Updater('content', '/home/change_section?section=/home/prodotti/'+element.id, {asynchronous:true,
																										evalScripts:true,
																										onComplete: function() {
																											new Effect.Appear('content', {duration: 0.5, direction: 'top-left'});
																										}});
		}});
		
	},
	
	"div#sidebar dt:mouseover":function(element, event) {
		if (browser == "Internet Explorer") {
			Event.findElement(event, 'dt').style.background = "repeat-x url(/images/sideBarButton.png) 0px 0px";
		}
	},
	
	"div#sidebar dt:mouseout":function(element, event) {
		if (browser == "Internet Explorer") {
			Event.findElement(event, 'dt').style.background = "repeat-x url(/images/sideBarButton.png) 0px 139px";
		}
	},
	
	"dl#menu dt:mouseover":function(element, event) {
		if (browser == "Internet Explorer") {
			Event.findElement(event, 'dt').style.background = "repeat-x url(/images/menuButton.png) 0px 0px";
		}
	},

	"dl#menu dt:mouseout":function(element, event) {
		if (browser == "Internet Explorer") {
			Event.findElement(event, 'dt').style.background = "repeat-x url(/images/menuButton.png) 231px 0px";
		}
	},
	
	"dl#specialItems dt:mouseover":function(element, event) {
		if (browser == "Internet Explorer") {
			dtElement = Event.findElement(event, 'dt');
			
			switch(dtElement.id) {
				case 'blue': image = "specialItemsBlue.png"; break;
				case 'green': image = "specialItemsGreen.png"; break;
				case 'red': image = "specialItemsRed.png"; break;
				case 'yellow': image = "specialItemsYellow.png"; break;
			}
			
			dtElement.style.background = "repeat-x url(/images/"+image+") 316px 0px;";
			
		}
	},

	"dl#specialItems dt:mouseout":function(element, event) {
		if (browser == "Internet Explorer") {
			dtElement = Event.findElement(event, 'dt');
			
			switch(dtElement.id) {
				case 'blue': image = "specialItemsBlue.png"; break;
				case 'green': image = "specialItemsGreen.png"; break;
				case 'red': image = "specialItemsRed.png"; break;
				case 'yellow': image = "specialItemsYellow.png"; break;
			}
			
			dtElement.style.background = "repeat-x url(/images/"+image+") 0px 0px;";
		}
	}
}