
function hm()
{
	$('objj').innerHTML='Ok';
}



window.addEvent('domready',function() {
	/* settings */
	var temp=0;
	var jgmlock=false;
	var jgmshowDuration = 3000;
	var jgmcontainer = $('jgmenuimg-container');
	var jgmimages = jgmcontainer.getElements('img');
	var jgmcurrentIndex = 0;
	var jgminterval;
	var jgmleft=$$('table#jgmenu td.jgtab');
	var jgml=$$('#jgml div');
	var jgmr=$$('#jgmr div');

	function jgminitialize() {
		for(var i=0; i<jgmleft.length; i++) { jgmleft[i].pnum=i; }
		for(var i=0; i<jgml.length; i++) { jgml[i].pnum=i; }
		for(var i=0; i<jgmr.length; i++) { jgmr[i].pnum=i; }
		jgml.set('opacity',0);
		jgmr.set('opacity',0);
		/* First time show */
		jgmset(jgmcurrentIndex);
	}
	
	jgminitialize();
	enablemouseover();

	
	function jgmset(i) {
		jgmleft[i].setStyle('background','url(http://hel-lab-tech.gr/images/stories/belos2.png)');
		jgmleft[i].setStyle('color','#0a2e8a');
		jgml[i].set('opacity',100);
		jgmr[i].set('opacity',100);	
	}
	
	
	function jgmseton(i) {
		jgmleft[i].setStyle('background','url(http://hel-lab-tech.gr/images/stories/belos.png)');
	}
	
	function jgmreset() {
			jgml.set('opacity',0);
			jgmr.set('opacity',0);
			jgmleft.setStyle('background','url(http://hel-lab-tech.gr/images/stories/cell.png)');
			jgmleft.setStyle('color','#333');
	}
	
	
	jgmleft.addEvent('click', function(){
		temp = this.pnum;
		jgmlock=!jgmlock;
		if (jgmlock) {disablemouseover();jgmseton(temp);} else { jgmreset(); jgmcurrentIndex=temp; enablemouseover(); jgminitialize(); }
		});
		
		
	function enablemouseover() {
		jgmleft.addEvent('mouseover', function(){
			$clear(jgminterval);
			jgmreset();
			jgmset(this.pnum);
			jgmimages[jgmcurrentIndex].fade('out');
			jgmimages[jgmcurrentIndex = this.pnum ].fade('in');
		});
	}
	
	function disablemouseover() {
		var destroy = function(){}; 
		jgmleft.removeEvents('mouseover');
	}
		
	

	jgmleft.addEvent('mouseout', function(){
	
		/*jgml.set('opacity',0);
		jgmr.set('opacity',0);
		jgmleft.setStyle('background','url(http://hel-lab-tech.gr/images/stories/cell.png)');
		jgmleft.setStyle('color','#333');
		jgmleft[temp].setStyle('background','url(http://hel-lab-tech.gr/images/stories/belos.png)');
		jgmleft[temp].setStyle('color','#0a2e8a');
		jgml[temp].set('opacity',100);
		jgmr[temp].set('opacity',100);
		jgmimages[jgmcurrentIndex].fade('out');
		jgmimages[temp].fade('in');*/
		//jgminterval = jgshow.periodical(jgmshowDuration);
	});	
	
	
	
	
	/* opacity and fade */
	jgmimages.each(function(img,i){ 
		if(i > 0) {
			img.set('opacity',0);
		}
	});
	/* worker */
	var jgshow = function() {
		jgmimages[jgmcurrentIndex].fade('out');
		jgmreset();
		jgmimages[jgmcurrentIndex = jgmcurrentIndex < jgmimages.length - 1 ? jgmcurrentIndex+1 : 0].fade('in');
		jgmset(jgmcurrentIndex);
	};
	/* start once the page is finished loading */
	window.addEvent('load',function(){
		jgminterval = jgshow.periodical(jgmshowDuration);
	});
});



