			$.fn.x = function(n) {
			 var result = null;
			 this.each(function() {
				 var o = this;
				 if (n === undefined) {
					 var x = 0;
					 if (o.offsetParent) {
						 while (o.offsetParent) {
							 x += o.offsetLeft;
							 o = o.offsetParent;
						 }
					 }
					 if (result === null) {
						 result = x;
					 } else {
						 result = Math.min(result, x);
					 }
				 } else {
					 o.style.left = n + 'px';
				 }
			 });
			 return result;
		};
		
		$.fn.y = function(n) {
			 var result = null;
			 this.each(function() {
				 var o = this;
				 if (n === undefined) {
					 var y = 0;
					 if (o.offsetParent) {
						 while (o.offsetParent) {
							 y += o.offsetTop;
							 o = o.offsetParent;
						 }
					 }
					 if (result === null) {
						 result = y;
					 } else {
						 result = Math.min(result, y);
					 }
				 } else {
					 o.style.top = n + 'px';
				 }
			 });
			 return result;
		};
		
		
		
		var active = null;
		
		$(document).ready(function(){
			collapse();
			$('div#sector ul li a.hover').mouseover(function(){
				
				hideActive();
				
				//find position for div
				var temp_pos = {
					top: $(this).children("img").y(),
					left: $(this).children("img").x()
				}
			
				//get the ative div
				var t_counter = $(this).parent().attr('id');
				var p = t_counter.length;
				active = t_counter.substring(p-1);
				if(active < 4){
				
					//show the div
					$(this).siblings().show();
					$(this).siblings().css({top:temp_pos.top,left:temp_pos.left});
					$(this).addClass('active');
				}else{
					$(this).siblings().show();
					$(this).siblings().css({top:temp_pos.top,left:temp_pos.left-154});
					$(this).addClass('active');
				}
			});
			
			$('div#sector ul').hover(function(){
				//hideActive();
			},function(){
				hideActive();
			});
		});

		function collapse(){
			$('div.sect').hide();
			if ($('div#sector li').length > 0) {
				$('div#sector li').css({float:"left"});
			}
		}
		
		function hideActive(){
			if (active != null) {
				$('div#sector ul li#sector'+active+' a').removeClass('active');
				$('div#sector ul li#sector'+active+' div.sect').hide();
			}	
		}
		
             