var currentTab = null;
var currentDrag = null;
// rules
var commonRules = {
	'.iconLink' : function(element){
		element = $(element);
		
		/*
		element.onmouseover = function(){
			var newTab = this.id + "_desc";
			if(currentTab != newTab){
				if(currentTab != null){
					$(currentTab).style.display = "none";
				}
				currentTab = newTab;
				$(currentTab).style.display = "block";
				*//*
					if(currentTab != null){
						new Effect.BlindUp($(currentTab), {duration: 0.5, queue: {position:'end', scope: 'navmenuscope', limit:2}});	
					}
					currentTab = newTab;
					new Effect.BlindDown($(currentTab), {duration: 0.5, queue: {position:'end', scope: 'navmenuscope', limit:2}});
				*//*
			}
			return false;
		},*/
		
		element.onclick = function(){
			var url = element.getAttribute("href");
			showLoad();
			new Ajax.Updater('content', 
					 url, 
					 {
						method: 'get', 
						parameters: 'noheader=1',
						onComplete: delayHideLoad					
					 });
			return false;
		}
		
	}
/*
	'#logo' : function(element){
		element = $(element);
				
		element.onmousedown = function(){
			currentDrag = new Draggable("logoDrag", {});
		}

		element.onmouseup = function(){
			if(currentDrag != null){
				currentDrag.destroy();
			}
		}
	}
*/
/*	
	'#logo' : function(element){
		element = $(element);
				
		element.onmousedown = function(){
			currentDrag = new Draggable(this.id, {constraint:'horizontal'});
		}

		element.onmouseup = function(){
			if(currentDrag != null){
				currentDrag.destroy();
			}
		}
	}
*/
/*
	'.minimizeLink' : function(element){
		element = $(element);
		element.onclick = function(){
			if(Element.hasClassName(this.parentNode.parentNode.parentNode, 'windowBox')){
				new Effect.BlindUp($(this.parentNode.parentNode.parentNode.id + "_content"), {});
			}
			return false;
		}
	},
	'.maximizeLink' : function(element){
		element = $(element);
		element.onclick = function(){
			if(Element.hasClassName(this.parentNode.parentNode.parentNode, 'windowBox')){
				new Effect.BlindDown($(this.parentNode.parentNode.parentNode.id + "_content"), {});
			}
			return false;
		}
	},
	'.closeLink' : function(element){
		element = $(element);
		element.onclick = function(){
			if(Element.hasClassName(this.parentNode.parentNode.parentNode, 'windowBox')){
				new Effect.Fade(this.parentNode.parentNode.parentNode, {});
			}
			return false;
		}
	},
	'.resizeLink' : function(element){
		element = $(element);
		
		element.onmousedown = function(){
			if(Element.hasClassName(this.parentNode.parentNode.parentNode, 'windowBox')){
				//new Textarea.resize(this.parentNode.parentNode.parentNode.id,{handlePath:location_to_handle_img});
				currentResize = new Draggable(this.id, {});
			}
		}
		
		element.onmouseup = function(){
			if(Element.hasClassName(this.parentNode.parentNode.parentNode, 'windowBox')){
				currentResize.destroy();
				//new Textarea.resize(this.parentNode.parentNode.parentNode.id,{handlePath:location_to_handle_img});
			}
		}
	}*/
};

// register the rules in rules.js
Behaviour.register(commonRules);
